Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.target / sh / pr50751-5.c
1 /* Check that the mov.w displacement addressing insn is generated and the 
2    base address is adjusted only once.  On SH2A this test is skipped because
3    there is a 4 byte mov.w insn that can handle larger displacements.  Thus
4    on SH2A the base address will not be adjusted in this case.  */
5 /* { dg-do compile { target "sh*-*-*" } } */
6 /* { dg-options "-O1" } */
7 /* { dg-skip-if "" { "sh*-*-*" } { "-m5*" "-m2a*" } { "" } } */
8 /* { dg-final { scan-assembler-times "add" 2 } } */
9
10 void
11 testfunc_00 (const short* ap, short* bp)
12 {
13   bp[0] = ap[15];
14   bp[2] = ap[5];
15   bp[9] = ap[7];
16   bp[0] = ap[25];
17 }
18
19 void
20 testfunc_01 (volatile const short* ap, volatile short* bp)
21 {
22   bp[0] = ap[15];
23   bp[2] = ap[5];
24   bp[9] = ap[7];
25   bp[0] = ap[25];
26 }
27