]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/70098 (PowerPC64: eigen hits ICE following invalid register...
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Mon, 25 Apr 2016 22:29:49 +0000 (22:29 +0000)
committerWilliam Schmidt <wschmidt@gcc.gnu.org>
Mon, 25 Apr 2016 22:29:49 +0000 (22:29 +0000)
[gcc]

2016-04-25  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

Backport from mainline
2016-03-14  Segher Boessenkool  <segher@kernel.crashing.org>

PR target/70098
* config/rs6000/rs6000.md (*ctr<mode>_internal1, *ctr<mode>_internal2,
*ctr<mode>_internal5, *ctr<mode>_internal6): Also allow "d" as output.
(define_split for the GPR case): Use int_reg_operand instead of
gpc_reg_operand for the output.

[gcc/testsuite]

2016-04-25  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

Backport from mainline
2016-03-14  Segher Boessenkool  <segher@kernel.crashing.org>

PR target/70098
* lib/target-supports.exp (check_effective_target_powerpc64_no_dm):
New function.
* g++.dg/pr70098.C: New testcase.

From-SVN: r235424

gcc/ChangeLog
gcc/config/rs6000/rs6000.md
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr70098.C [new file with mode: 0644]
gcc/testsuite/lib/target-supports.exp

index d6d083faddde785af3e8b6c83f429af562368f23..b2498c79005880ed606cb45a5d695390679d34bc 100644 (file)
@@ -1,3 +1,14 @@
+2016-04-25  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       Backport from mainline
+       2016-03-14  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       PR target/70098
+       * config/rs6000/rs6000.md (*ctr<mode>_internal1, *ctr<mode>_internal2,
+       *ctr<mode>_internal5, *ctr<mode>_internal6): Also allow "d" as output.
+       (define_split for the GPR case): Use int_reg_operand instead of
+       gpc_reg_operand for the output.
+
 2016-04-21  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
 
        Backport from mainline
index bd43b1bd08a025387a2ca469ed0086232a3d093e..a3efbbc0022a42be30aa85dffbb6185e3441435e 100644 (file)
                          (const_int 1))
                      (label_ref (match_operand 0 "" ""))
                      (pc)))
-   (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
+   (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*d*c*l")
        (plus:P (match_dup 1)
                 (const_int -1)))
    (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
                          (const_int 1))
                      (pc)
                      (label_ref (match_operand 0 "" ""))))
-   (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
+   (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*d*c*l")
        (plus:P (match_dup 1)
                 (const_int -1)))
    (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
                          (const_int 1))
                      (label_ref (match_operand 0 "" ""))
                      (pc)))
-   (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
+   (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*d*c*l")
        (plus:P (match_dup 1)
                 (const_int -1)))
    (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
                          (const_int 1))
                      (pc)
                      (label_ref (match_operand 0 "" ""))))
-   (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
+   (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*d*c*l")
        (plus:P (match_dup 1)
                 (const_int -1)))
    (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
                                       (const_int 1)])
                      (match_operand 5 "" "")
                      (match_operand 6 "" "")))
-   (set (match_operand:P 0 "gpc_reg_operand" "")
+   (set (match_operand:P 0 "int_reg_operand" "")
        (plus:P (match_dup 1) (const_int -1)))
    (clobber (match_scratch:CC 3 ""))
    (clobber (match_scratch:P 4 ""))]
index 868b415670f7f04c5eb487f8bde78b02a7db1dce..e0e8039b436bd478dfb4aeb1c27a61c4a493eb41 100644 (file)
@@ -1,3 +1,13 @@
+2016-04-25  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       Backport from mainline
+       2016-03-14  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       PR target/70098
+       * lib/target-supports.exp (check_effective_target_powerpc64_no_dm):
+       New function.
+       * g++.dg/pr70098.C: New testcase.
+
 2016-04-21  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
 
        Backport from mainline
diff --git a/gcc/testsuite/g++.dg/pr70098.C b/gcc/testsuite/g++.dg/pr70098.C
new file mode 100644 (file)
index 0000000..f5eb48f
--- /dev/null
@@ -0,0 +1,91 @@
+// PR target/70098
+// { dg-do compile }
+// { dg-options -O2 }
+// { dg-require-effective-target c++11 }
+// { dg-xfail-if "PR70098" { lp64 && powerpc64_no_dm } }
+// { dg-prune-output ".*internal compiler error.*" }
+
+template < typename > struct traits;
+template < typename, int _Rows, int _Cols, int = 0, int = _Rows,
+       int = _Cols > class Matrix;
+template < typename > class G;
+template < typename Derived > struct A {
+       typedef G < Derived > type;
+};
+
+template < typename Derived > class C {
+public:
+       enum { RowsAtCompileTime =
+                   traits < Derived >::RowsAtCompileTime } static Zero;
+};
+
+template < typename Derived > class G:public C < Derived > {
+};
+
+template < int _Rows > class D {
+public:
+       long rows() {
+               return _Rows;
+       }
+};
+
+template < typename Derived > class PlainObjectBase:public A < Derived >::type {
+       typedef typename A < Derived >::type Base;
+       D < Base::RowsAtCompileTime > m_storage;
+
+public:
+       long rows() {
+               return m_storage.rows();
+       }
+};
+
+int fn1();
+
+struct B {
+       static long run(long x, long) {
+               int offset(fn1());
+                return x + offset;
+}};
+
+long fn2(int x)
+{
+       return B::run(x, 0);
+}
+
+template < typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows,
+    int _MaxCols >
+    struct traits <Matrix < _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols >> {
+       enum { RowsAtCompileTime = _Rows };
+};
+
+template < typename, int, int, int, int _MaxRows, int _MaxCols >
+       class Matrix:public PlainObjectBase < Matrix < double, _MaxRows,
+       _MaxCols >> {
+public:
+       template < typename OtherDerived > Matrix(OtherDerived);
+};
+
+struct F {
+       static Matrix < double, 2, 2 > run(long size) {
+               Matrix < double, 2, 2 > diag = Matrix < double, 2, 2 >::Zero;
+               long i = 0;
+               while (i < size) {
+                       long randomInt = fn2(-1);
+                       if (randomInt == 0)
+                               ++i;
+                       else {
+                               double alpha(randomInt);
+                                diag = alpha;
+                                i = 2;
+                       }
+               }
+
+               return diag;
+       }
+};
+
+void fn3(Matrix < double, 2, 2 > m)
+{
+       long size = m.rows();
+       F::run(size);
+}
index 29489ff800ee883c30fe0c42c73699dca877de33..19c512f4eb900a02bd5d3c4dfd0378cccf79edc2 100644 (file)
@@ -1393,6 +1393,19 @@ proc check_effective_target_avx_runtime { } {
     return 0
 }
 
+# Return 1 if we are compiling for 64-bit PowerPC but we do not use direct
+# move instructions for moves from GPR to FPR.
+
+proc check_effective_target_powerpc64_no_dm { } {
+    # The "mulld" checks if we are generating PowerPC64 code.  The "lfd"
+    # checks if we do not use direct moves, but use the old-fashioned
+    # slower move-via-the-stack.
+    return [check_no_messages_and_pattern powerpc64_no_dm \
+       {\mmulld\M.*\mlfd} assembly {
+           double f(long long x) { return x*x; }
+       } {-O2}]
+}
+
 # Return 1 if the target supports executing power8 vector instructions, 0
 # otherwise.  Cache the result.