2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / pr57819.c
blobb086a40c4ce7b0666854a6e16e70729fea8ce012
1 /* PR target/57819 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -mtune=core2" } */
5 void foo (void);
7 __extension__ typedef __INTPTR_TYPE__ intptr_t;
9 int
10 test1 (intptr_t x, intptr_t n)
12 n &= sizeof (intptr_t) * __CHAR_BIT__ - 1;
14 if (x & ((intptr_t) 1 << n))
15 foo ();
17 return 0;
20 int
21 test2 (intptr_t x, intptr_t n)
23 if (x & ((intptr_t) 1 << ((int) n & (sizeof (intptr_t) * __CHAR_BIT__ - 1))))
24 foo ();
26 return 0;
29 int
30 test3 (intptr_t x, intptr_t n)
32 if (x & ((intptr_t) 1 << ((int) n & ((int) sizeof (intptr_t) * __CHAR_BIT__ - 1))))
33 foo ();
35 return 0;
38 /* { dg-final { scan-assembler-not "and\[lq\]\[ \t\]" } } */