1 /* Check that 64 bit integer abs is generated as negc instruction pairs
2 and conditional branch instead of default branch-free code. */
3 /* { dg-do compile } */
4 /* { dg-options "-O1" } */
5 /* { dg-final { scan-assembler-times "negc" 4 } } */
6
7
8 /* Normal integer absolute value. */
9 long long
abs_0(long long i)10 abs_0 (long long i)
11 {
12 return (i < 0) ? -i : i;
13 }
14
15 /* Negated integer absolute value.
16 The generated code should be the same, except that the branch
17 condition is inverted. */
18 long long
abs_1(long long i)19 abs_1 (long long i)
20 {
21 return (i > 0) ? -i : i;
22 }
23