summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/ifcvt-onecmpl-abs-1.c
blob: c8caab5f1df4d4a100dcd0ccee745502673a5be6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* { dg-do compile } */
/* This test checks for if-conversion of one's complement
 * abs function.  */
/* { dg-options "-O -mtune=generic" } */
/* { dg-final { scan-assembler "sar" } } */
/* { dg-final { scan-assembler "xor" } } */

/* Check code generation for one's complement version of abs */

int onecmplabs(int x)
{
  if (x < 0)
    x = ~x;
  return x;
}