Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.target / sh / pr50751-1.c
1 /* Check that the mov.b 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 { target "sh*-*-*" } } */
5 /* { dg-options "-O1" } */
6 /* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } } */
7 /* { dg-final { scan-assembler-not "add|sub" } } */
8
9 void
10 testfunc_00 (const char* ap, char* bp, char 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
21 testfunc_01 (volatile const char* ap, volatile char* bp, char 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