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-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } } */
6 /* { dg-final { scan-assembler-times "negc" 4 } } */
7
8
9 /* Normal integer absolute value. */
10 long long
abs_0(long long i)11 abs_0 (long long i)
12 {
13 return (i < 0) ? -i : i;
14 }
15
16 /* Negated integer absolute value.
17 The generated code should be the same, except that the branch
18 condition is inverted. */
19 long long
abs_1(long long i)20 abs_1 (long long i)
21 {
22 return (i > 0) ? -i : i;
23 }
24