Commit 8382457c by Jakub Jelinek Committed by Jakub Jelinek

re PR rtl-optimization/78438 (incorrect comparison optimization)

	PR rtl-optimization/78438
	PR rtl-optimization/78477
	* gcc.c-torture/execute/pr78438.c: New test.
	* gcc.c-torture/execute/pr78477.c: New test.

From-SVN: r242883
parent ad7a69db
2016-11-25 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/78438
PR rtl-optimization/78477
* gcc.c-torture/execute/pr78438.c: New test.
* gcc.c-torture/execute/pr78477.c: New test.
PR rtl-optimization/78526
* gcc.dg/pr78526.c: New test.
......
/* PR target/78438 */
char a = 0;
int b = 197412621;
__attribute__ ((noinline, noclone))
void foo ()
{
a = 0 > (short) (b >> 11);
}
int
main ()
{
asm volatile ("" : : : "memory");
if (__CHAR_BIT__ != 8 || sizeof (short) != 2 || sizeof (int) < 4)
return 0;
foo ();
if (a != 0)
__builtin_abort ();
return 0;
}
/* PR rtl-optimization/78477 */
unsigned a;
unsigned short b;
unsigned
foo (unsigned x)
{
b = x;
a >>= (b & 1);
b = 1 | (b << 5);
b >>= 15;
x = (unsigned char) b > ((2 - (unsigned char) b) & 1);
b = 0;
return x;
}
int
main ()
{
if (__CHAR_BIT__ != 8 || sizeof (short) != 2 || sizeof (int) < 4)
return 0;
unsigned x = foo (12345);
if (x != 0)
__builtin_abort ();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment