Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.target / sh / pr50749-qihisi-predec-4.c
1 /* PR target/50749: Verify that pre-decrement addressing is generated
2    inside a loop.  */
3 /* { dg-do compile { target "sh*-*-*" } } */
4 /* { dg-options "-O2" } */
5 /* { dg-final { scan-assembler-times "mov.b\tr\[0-9]\+,@-r\[0-9]\+" 3 { xfail *-*-*} } } */
6 /* { dg-final { scan-assembler-times "mov.w\tr\[0-9]\+,@-r\[0-9]\+" 3 { xfail *-*-*} } } */
7 /* { dg-final { scan-assembler-times "mov.l\tr\[0-9]\+,@-r\[0-9]\+" 3 { xfail *-*-*} } } */
8
9 char*
10 test_func_00 (char* p, int c, int x)
11 {
12   do
13   {
14     *--p = (char)x;
15     *--p = (char)x;
16     *--p = (char)x;
17   } while (--c);
18   return p;
19 }
20
21 short*
22 test_func_01 (short* p, int c, int x)
23 {
24   do
25   {
26     *--p = (short)x;
27     *--p = (short)x;
28     *--p = (short)x;
29   } while (--c);
30   return p;
31 }
32
33 int*
34 test_func_02 (int* p, int c, int x)
35 {
36   do
37   {
38     *--p = x;
39     *--p = x;
40     *--p = x;
41   } while (--c);
42   return p;
43 }