1 /* PR target/57819 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -mtune=core2" } */
4 
5 void foo (void);
6 
7 __extension__ typedef __INTPTR_TYPE__ intptr_t;
8 
9 int
test1(intptr_t x,intptr_t n)10 test1 (intptr_t x, intptr_t n)
11 {
12   n &= sizeof (intptr_t) * __CHAR_BIT__ - 1;
13 
14   if (x & ((intptr_t) 1 << n))
15     foo ();
16 
17   return 0;
18 }
19 
20 int
test2(intptr_t x,intptr_t n)21 test2 (intptr_t x, intptr_t n)
22 {
23   if (x & ((intptr_t) 1 << ((int) n & (sizeof (intptr_t) * __CHAR_BIT__ - 1))))
24     foo ();
25 
26   return 0;
27 }
28 
29 int
test3(intptr_t x,intptr_t n)30 test3 (intptr_t x, intptr_t n)
31 {
32   if (x & ((intptr_t) 1 << ((int) n & ((int) sizeof (intptr_t) * __CHAR_BIT__ - 1))))
33     foo ();
34 
35   return 0;
36 }
37 
38 /* { dg-final { scan-assembler-not "and\[lq\]\[ \t\]" } } */
39