2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / sh / pr49468-si.c
blob2b259203a71a5a3dda9701db3bae1dd887e44f12
1 /* Check that 32 bit integer abs is generated as neg instruction and
2 conditional branch instead of default branch-free code. */
3 /* { dg-do compile } */
4 /* { dg-options "-O1" } */
5 /* { dg-final { scan-assembler-times "neg" 2 } } */
8 /* Normal integer absolute value. */
9 int
10 abs_0 (int i)
12 return (i < 0) ? -i : i;
15 /* Negated integer absolute value.
16 The generated code should be the same, except that the branch
17 condition is inverted. */
18 int
19 abs_1 (int i)
21 return (i > 0) ? -i : i;