Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.target / sh / pr50749-qihisi-predec-3.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]\+" 1 } } */
6 /* { dg-final { scan-assembler-times "mov.w\tr\[0-9]\+,@-r\[0-9]\+" 1 } } */
7 /* { dg-final { scan-assembler-times "mov.l\tr\[0-9]\+,@-r\[0-9]\+" 1 } } */
8
9 char*
10 test_func_00 (char* p, int c, int x)
11 {
12   do
13   {
14     *--p = (char)x;
15   } while (--c);
16   return p;
17 }
18
19 short*
20 test_func_01 (short* p, int c, int x)
21 {
22   do
23   {
24     *--p = (short)x;
25   } while (--c);
26   return p;
27 }
28
29 int*
30 test_func_02 (int* p, int c, int x)
31 {
32   do
33   {
34     *--p = x;
35   } while (--c);
36   return p;
37 }