Rebase.
[official-gcc.git] / gcc / testsuite / gcc.target / sh / pr39423-1.c
blob1e02937ccba19645a8a5ff21325c5c5a92240d8a
1 /* Check that displacement addressing is used for indexed addresses with a
2 small offset, instead of re-calculating the index. */
3 /* { dg-do compile } */
4 /* { dg-options "-O2" } */
5 /* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } } */
6 /* { dg-final { scan-assembler-not "add\t#1" } } */
8 int
9 test_00 (int tab[], int index)
11 return tab[index + 1];
14 int
15 test_01 (short tab[], int index)
17 return tab[index + 1];
20 int
21 test_02 (unsigned short tab[], int index)
23 return tab[index + 1];
26 int
27 test_03 (long long tab[], int index)
29 return (int)tab[index + 1];
32 void
33 test_04 (int tab[], int index, int val)
35 tab[index + 1] = val;
38 void
39 test_05 (short tab[], int index, int val)
41 tab[index + 1] = (short)val;
44 void
45 test_06 (unsigned short tab[], int index, int val)
47 tab[index + 1] = (unsigned short)val;