diff options
Diffstat (limited to 'gcc/testsuite/gcc.target/sh/pr39423-1.c')
-rw-r--r-- | gcc/testsuite/gcc.target/sh/pr39423-1.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/sh/pr39423-1.c b/gcc/testsuite/gcc.target/sh/pr39423-1.c new file mode 100644 index 00000000000..dac0f89eea3 --- /dev/null +++ b/gcc/testsuite/gcc.target/sh/pr39423-1.c @@ -0,0 +1,48 @@ +/* Check that displacement addressing is used for indexed addresses with a + small offset, instead of re-calculating the index. */ +/* { dg-do compile { target "sh*-*-*" } } */ +/* { dg-options "-O2" } */ +/* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } } */ +/* { dg-final { scan-assembler-not "add\t#1" } } */ + +int +test_00 (int tab[], int index) +{ + return tab[index + 1]; +} + +int +test_01 (short tab[], int index) +{ + return tab[index + 1]; +} + +int +test_02 (unsigned short tab[], int index) +{ + return tab[index + 1]; +} + +int +test_03 (long long tab[], int index) +{ + return (int)tab[index + 1]; +} + +void +test_04 (int tab[], int index, int val) +{ + tab[index + 1] = val; +} + +void +test_05 (short tab[], int index, int val) +{ + tab[index + 1] = (short)val; +} + +void +test_06 (unsigned short tab[], int index, int val) +{ + tab[index + 1] = (unsigned short)val; +} |