combine.c (simplify_comparison): Do not commute a AND into a paradoxical SUBREG if...
authorJeffrey A Law <law@cygnus.com>
Sun, 5 Jul 1998 23:20:51 +0000 (23:20 +0000)
committerJeff Law <law@gcc.gnu.org>
Sun, 5 Jul 1998 23:20:51 +0000 (17:20 -0600)
* combine.c (simplify_comparison): Do not commute a AND into
a paradoxical SUBREG if not WORD_REGISTER_OPERATIONS.

From-SVN: r20934

gcc/ChangeLog
gcc/combine.c

index e91a7e08cc8e0338960e9972d4183a947be59180..8e9c2e4c42b17d89d55db26c1ed8312cfb30065e 100644 (file)
@@ -1,5 +1,8 @@
 Sun Jul  5 23:58:19 1998  Jeffrey A Law  (law@cygnus.com)
 
+       * combine.c (simplify_comparison): Do not commute a AND into
+       a paradoxical SUBREG if not WORD_REGISTER_OPERATIONS.
+
        * i386/freebsd-elf.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Protect with
        HAVE_GAS_MAX_SKIP_P2ALIGN.
        * i386/linux.h: Likewise.
index a0c78648c31ae25a8e5a78c1248236762b994dd7..a299fb098ec54a02c47c54ea43f28db6fd1dc261 100644 (file)
@@ -10154,6 +10154,16 @@ simplify_comparison (code, pop0, pop1)
                  || subreg_lowpart_p (XEXP (op0, 0))
 #endif
                  )
+#ifndef WORD_REGISTER_OPERATIONS
+             /* It is unsafe to commute the AND into the SUBREG if the SUBREG
+                is paradoxical and WORD_REGISTER_OPERATIONS is not defined.
+                As originally written the upper bits have a defined value
+                due to the AND operation.  However, if we commute the AND
+                inside the SUBREG then they no longer have defined values
+                and the meaning of the code has been changed.  */
+             && (GET_MODE_SIZE (GET_MODE (XEXP (op0, 0)))
+                 <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (XEXP (op0, 0)))))
+#endif
              && GET_CODE (XEXP (op0, 1)) == CONST_INT
              && mode_width <= HOST_BITS_PER_WIDE_INT
              && (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (XEXP (op0, 0))))