aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/i386/pr57819.c
blob: b086a40c4ce7b0666854a6e16e70729fea8ce012 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* PR target/57819 */
/* { dg-do compile } */
/* { dg-options "-O2 -mtune=core2" } */

void foo (void);

__extension__ typedef __INTPTR_TYPE__ intptr_t;

int
test1 (intptr_t x, intptr_t n)
{
  n &= sizeof (intptr_t) * __CHAR_BIT__ - 1;

  if (x & ((intptr_t) 1 << n))
    foo ();

  return 0;
}

int
test2 (intptr_t x, intptr_t n)
{
  if (x & ((intptr_t) 1 << ((int) n & (sizeof (intptr_t) * __CHAR_BIT__ - 1))))
    foo ();

  return 0;
}

int
test3 (intptr_t x, intptr_t n)
{
  if (x & ((intptr_t) 1 << ((int) n & ((int) sizeof (intptr_t) * __CHAR_BIT__ - 1))))
    foo ();

  return 0;
}

/* { dg-final { scan-assembler-not "and\[lq\]\[ \t\]" } } */