diff options
Diffstat (limited to 'gcc/testsuite/gcc.target/sh/pr55303-2.c')
-rw-r--r-- | gcc/testsuite/gcc.target/sh/pr55303-2.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/sh/pr55303-2.c b/gcc/testsuite/gcc.target/sh/pr55303-2.c new file mode 100644 index 0000000..a70a30a --- /dev/null +++ b/gcc/testsuite/gcc.target/sh/pr55303-2.c @@ -0,0 +1,35 @@ +/* Verify that for SH2A smax/smin -> cbranch conversion is done properly + if the clips insn is not used and the expected comparison insns are + generated. */ +/* { dg-do compile { target "sh*-*-*" } } */ +/* { dg-options "-O2" } */ +/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" } } */ +/* { dg-final { scan-assembler-times "cmp/pl" 4 } } */ + +int +test_00 (int a) +{ + /* 1x cmp/pl */ + return a >= 0 ? a : 0; +} + +int +test_01 (int a) +{ + /* 1x cmp/pl */ + return a <= 0 ? a : 0; +} + +int +test_02 (int a) +{ + /* 1x cmp/pl */ + return a < 1 ? 1 : a; +} + +int +test_03 (int a) +{ + /* 1x cmp/pl */ + return a < 1 ? a : 1; +} |