summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/i386-signbit-2.c
blob: 5687d857a0776abacc0b13a9fb0aa4d6ff2ded19 (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
/* PR optimization/8746 */
/* { dg-do run { target i?86-*-* } } */
/* { dg-options "-O1 -mtune=i586" } */

extern void abort (void);

unsigned short r0;

int foo(int x)
{
  unsigned short r = x&0xf000;

  if (!(r&0x8000))
  {
    r0 = r;
    return 0;
  }
  else
    return 1;
}

int main(void)
{
  if (foo(0x8000) != 1)
    abort();

   return 0;
}