aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/sh/pr39423-1.c
blob: 1e02937ccba19645a8a5ff21325c5c5a92240d8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* Check that displacement addressing is used for indexed addresses with a
   small offset, instead of re-calculating the index.  */
/* { dg-do compile }  */
/* { 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;
}