* simplify-rtx.c (simplify_binary_operation_1) <case IOR>: Ensure that
mask bits outside of mode are just sign-extension from mode to HWI.
* gcc.c-torture/execute/pr57829.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200768
138bc75d-0d04-0410-961f-
82ee72b054a4
+2013-07-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/57829
+ * simplify-rtx.c (simplify_binary_operation_1) <case IOR>: Ensure that
+ mask bits outside of mode are just sign-extension from mode to HWI.
+
2013-07-08 Michael Zolotukhin <michael.v.zolotukhin@gmail.com>
* config/i386/i386-opts.h (enum stringop_alg): Add vector_loop.
HOST_WIDE_INT mask = INTVAL (trueop1) << count;
if (mask >> count == INTVAL (trueop1)
+ && trunc_int_for_mode (mask, mode) == mask
&& (mask & nonzero_bits (XEXP (op0, 0), mode)) == 0)
return simplify_gen_binary (ASHIFTRT, mode,
plus_constant (mode, XEXP (op0, 0),
+2013-07-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/57829
+ * gcc.c-torture/execute/pr57829.c: New test.
+
2013-07-08 Michael Zolotukhin <michael.v.zolotukhin@gmail.com>
* gcc.target/i386/memcpy-vector_loop-1.c: New.
--- /dev/null
+/* PR rtl-optimization/57829 */
+
+__attribute__((noinline, noclone))
+int
+f1 (int k)
+{
+ return 2 | ((k - 1) >> ((int) sizeof (int) * __CHAR_BIT__ - 1));
+}
+
+__attribute__((noinline, noclone))
+long int
+f2 (long int k)
+{
+ return 2L | ((k - 1L) >> ((int) sizeof (long int) * __CHAR_BIT__ - 1));
+}
+
+__attribute__((noinline, noclone))
+int
+f3 (int k)
+{
+ k &= 63;
+ return 4 | ((k + 2) >> 5);
+}
+
+int
+main ()
+{
+ if (f1 (1) != 2 || f2 (1L) != 2L || f3 (63) != 6 || f3 (1) != 4)
+ __builtin_abort ();
+ return 0;
+}