Use conditional internal functions in if-conversion
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / abs_1.c
blob39364f477d603b903bf1e3cb0fc98bb9cc90385e
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fno-inline --save-temps" } */
4 extern long long llabs (long long);
5 extern void abort (void);
7 long long
8 abs64 (long long a)
10 /* { dg-final { scan-assembler "csneg\t" } } */
11 return llabs (a);
14 long long
15 abs64_in_dreg (long long a)
17 /* { dg-final { scan-assembler "csneg\t" } } */
18 register long long x asm ("d8") = a;
19 register long long y asm ("d9");
20 asm volatile ("" : : "w" (x));
21 y = llabs (x);
22 asm volatile ("" : : "w" (y));
23 return y;
26 int
27 main (void)
29 volatile long long ll0 = 0LL, ll1 = 1LL, llm1 = -1LL;
31 if (abs64 (ll0) != 0LL)
32 abort ();
34 if (abs64 (ll1) != 1LL)
35 abort ();
37 if (abs64 (llm1) != 1LL)
38 abort ();
40 if (abs64_in_dreg (ll0) != 0LL)
41 abort ();
43 if (abs64_in_dreg (ll1) != 1LL)
44 abort ();
46 if (abs64_in_dreg (llm1) != 1LL)
47 abort ();
49 return 0;