diff options
Diffstat (limited to 'gcc/testsuite/gcc.target/arm/thumb-ifcvt-2.c')
-rw-r--r-- | gcc/testsuite/gcc.target/arm/thumb-ifcvt-2.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/arm/thumb-ifcvt-2.c b/gcc/testsuite/gcc.target/arm/thumb-ifcvt-2.c new file mode 100644 index 00000000000..3da9ef080f4 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/thumb-ifcvt-2.c @@ -0,0 +1,18 @@ +/* Check that Thumb 16-bit shifts by immediate can be if-converted. */ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_thumb2_ok } */ +/* { dg-options "-O2 -mthumb" } */ + +int +foo (int a, int b) +{ + if (a != b) + a = a << 1; + else + a = a >> 1; + + return a + b; +} + +/* { dg-final { scan-assembler "lslne" } } */ +/* { dg-final { scan-assembler "asreq" } } */ |