1 /* Check that the mov.w displacement addressing insn is generated.
2 If the insn is generated as expected, there should be no address
3 calculations outside the mov insns. */
4 /* { dg-do compile } */
5 /* { dg-options "-O1" } */
6 /* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } } */
7 /* { dg-final { scan-assembler-not "add|sub" } } */
8
9 void
testfunc_00(const short * ap,short * bp,short val)10 testfunc_00 (const short* ap, short* bp, short val)
11 {
12 bp[0] = ap[15];
13 bp[2] = ap[5];
14 bp[9] = ap[7];
15 bp[0] = ap[15];
16 bp[4] = val;
17 bp[14] = val;
18 }
19
20 void
testfunc_01(volatile const short * ap,volatile short * bp,short val)21 testfunc_01 (volatile const short* ap, volatile short* bp, short val)
22 {
23 bp[0] = ap[15];
24 bp[2] = ap[5];
25 bp[9] = ap[7];
26 bp[0] = ap[15];
27 bp[4] = val;
28 bp[14] = val;
29 }
30
31