mirror of git://gcc.gnu.org/git/gcc.git
simplify-rtx.c (simplify_binary_operation_1): Do not simplify IOR to a constant if one operand has side effects.
* simplify-rtx.c (simplify_binary_operation_1): Do not simplify IOR to a constant if one operand has side effects. testsuite: * gcc.c-torture/execute/20120808-1.c: New test. From-SVN: r190237
This commit is contained in:
parent
215770ada8
commit
e7160b278e
|
|
@ -1,3 +1,8 @@
|
||||||
|
2012-08-08 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
|
* simplify-rtx.c (simplify_binary_operation_1): Do not simplify
|
||||||
|
IOR to a constant if one operand has side effects.
|
||||||
|
|
||||||
2012-08-08 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
|
2012-08-08 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
|
||||||
|
|
||||||
* builtins.c (expand_builtin_atomic_compare_exchange): Pass old
|
* builtins.c (expand_builtin_atomic_compare_exchange): Pass old
|
||||||
|
|
|
||||||
|
|
@ -2420,7 +2420,9 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
|
||||||
case IOR:
|
case IOR:
|
||||||
if (trueop1 == CONST0_RTX (mode))
|
if (trueop1 == CONST0_RTX (mode))
|
||||||
return op0;
|
return op0;
|
||||||
if (INTEGRAL_MODE_P (mode) && trueop1 == CONSTM1_RTX (mode))
|
if (INTEGRAL_MODE_P (mode)
|
||||||
|
&& trueop1 == CONSTM1_RTX (mode)
|
||||||
|
&& !side_effects_p (op0))
|
||||||
return op1;
|
return op1;
|
||||||
if (rtx_equal_p (trueop0, trueop1) && ! side_effects_p (op0))
|
if (rtx_equal_p (trueop0, trueop1) && ! side_effects_p (op0))
|
||||||
return op0;
|
return op0;
|
||||||
|
|
@ -2434,7 +2436,8 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
|
||||||
/* (ior A C) is C if all bits of A that might be nonzero are on in C. */
|
/* (ior A C) is C if all bits of A that might be nonzero are on in C. */
|
||||||
if (CONST_INT_P (op1)
|
if (CONST_INT_P (op1)
|
||||||
&& HWI_COMPUTABLE_MODE_P (mode)
|
&& HWI_COMPUTABLE_MODE_P (mode)
|
||||||
&& (nonzero_bits (op0, mode) & ~UINTVAL (op1)) == 0)
|
&& (nonzero_bits (op0, mode) & ~UINTVAL (op1)) == 0
|
||||||
|
&& !side_effects_p (op0))
|
||||||
return op1;
|
return op1;
|
||||||
|
|
||||||
/* Canonicalize (X & C1) | C2. */
|
/* Canonicalize (X & C1) | C2. */
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
2012-08-08 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
|
* gcc.c-torture/execute/20120808-1.c: New test.
|
||||||
|
|
||||||
2012-08-08 H.J. Lu <hongjiu.lu@intel.com>
|
2012-08-08 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
PR rtl-optimization/54157
|
PR rtl-optimization/54157
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
extern void exit (int);
|
||||||
|
extern void abort (void);
|
||||||
|
|
||||||
|
volatile int i;
|
||||||
|
unsigned char *volatile cp;
|
||||||
|
unsigned char d[32] = { 0 };
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
unsigned char c[32] = { 0 };
|
||||||
|
unsigned char *p = d + i;
|
||||||
|
int j;
|
||||||
|
for (j = 0; j < 30; j++)
|
||||||
|
{
|
||||||
|
int x = 0xff;
|
||||||
|
int y = *++p;
|
||||||
|
switch (j)
|
||||||
|
{
|
||||||
|
case 1: x ^= 2; break;
|
||||||
|
case 2: x ^= 4; break;
|
||||||
|
case 25: x ^= 1; break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
c[j] = y | x;
|
||||||
|
cp = p;
|
||||||
|
}
|
||||||
|
if (c[0] != 0xff
|
||||||
|
|| c[1] != 0xfd
|
||||||
|
|| c[2] != 0xfb
|
||||||
|
|| c[3] != 0xff
|
||||||
|
|| c[4] != 0xff
|
||||||
|
|| c[25] != 0xfe
|
||||||
|
|| cp != d + 30)
|
||||||
|
abort ();
|
||||||
|
exit (0);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue