2018-02-09 Sebastian Perta <sebastian.perta@renesas.com>
[official-gcc.git] / gcc / testsuite / gcc.target / sh / pr39423-1.c
blob8bf87b56c4b81da1a2b1096fb1f8b5fd81960772
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-final { scan-assembler-not "add\t#1" } } */
7 int
8 test_00 (int tab[], int index)
10 return tab[index + 1];
13 int
14 test_01 (short tab[], int index)
16 return tab[index + 1];
19 int
20 test_02 (unsigned short tab[], int index)
22 return tab[index + 1];
25 int
26 test_03 (long long tab[], int index)
28 return (int)tab[index + 1];
31 void
32 test_04 (int tab[], int index, int val)
34 tab[index + 1] = val;
37 void
38 test_05 (short tab[], int index, int val)
40 tab[index + 1] = (short)val;
43 void
44 test_06 (unsigned short tab[], int index, int val)
46 tab[index + 1] = (unsigned short)val;