combine: Fix for PR81423
authorSegher Boessenkool <segher@kernel.crashing.org>
Wed, 19 Jul 2017 19:31:26 +0000 (21:31 +0200)
committerSegher Boessenkool <segher@gcc.gnu.org>
Wed, 19 Jul 2017 19:31:26 +0000 (21:31 +0200)
We here have an AND of a SUBREG of an LSHIFTRT.  If that SUBREG is
paradoxical, the extraction we form is the length of the size of the
inner mode, which includes some bits that should not be in the result.
Just give up in that case.

PR rtl-optimization/81423
* combine.c (make_compound_operation_int): Don't try to optimize
the AND of a SUBREG of an LSHIFTRT if that SUBREG is paradoxical.

From-SVN: r250365

gcc/ChangeLog
gcc/combine.c

index 4de6391..96c0e35 100644 (file)
@@ -1,3 +1,9 @@
+2018-07-19  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       PR rtl-optimization/81423
+       * combine.c (make_compound_operation_int): Don't try to optimize
+       the AND of a SUBREG of an LSHIFTRT if that SUBREG is paradoxical.
+
 2017-07-19  Segher Boessenkool  <segher@kernel.crashing.org>
 
        PR rtl-optimization/81423
index c1eec91..8dc62b5 100644 (file)
@@ -7956,18 +7956,9 @@ make_compound_operation_int (machine_mode mode, rtx *x_ptr,
                                     XEXP (inner_x0, 1),
                                     i, 1, 0, in_code == COMPARE);
 
-         if (new_rtx)
-           {
-             /* If we narrowed the mode when dropping the subreg, then
-                we must zero-extend to keep the semantics of the AND.  */
-             if (GET_MODE_SIZE (inner_mode) >= GET_MODE_SIZE (mode))
-               ;
-             else if (SCALAR_INT_MODE_P (inner_mode))
-               new_rtx = simplify_gen_unary (ZERO_EXTEND, mode,
-                                             new_rtx, inner_mode);
-             else
-               new_rtx = NULL;
-           }
+         /* If we narrowed the mode when dropping the subreg, then we lose.  */
+         if (GET_MODE_SIZE (inner_mode) < GET_MODE_SIZE (mode))
+           new_rtx = NULL;
 
          /* If that didn't give anything, see if the AND simplifies on
             its own.  */