Debian Codegraph @

gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-3.c

raw
1 /* PR target/50749: Verify that post-increment addressing is generated
2 inside a loop. */
3 /* { dg-do compile } */
4 /* { dg-options "-O2" } */
5 /* { dg-final { scan-assembler-times "mov.b\t@r\[0-9]\+\\+,r\[0-9]\+" 1 } } */
6 /* { dg-final { scan-assembler-times "mov.w\t@r\[0-9]\+\\+,r\[0-9]\+" 1 } } */
7 /* { dg-final { scan-assembler-times "mov.l\t@r\[0-9]\+\\+,r\[0-9]\+" 1 } } */
8
9 int
10 test_func_00 (char* p, int c)
11 {
12 int r = 0;
13 do
14 {
15 r += *p++;
16 } while (--c);
17 return r;
18 }
19
20 int
21 test_func_01 (short* p, int c)
22 {
23 int r = 0;
24 do
25 {
26 r += *p++;
27 } while (--c);
28 return r;
29 }
30
31 int
32 test_func_02 (int* p, int c)
33 {
34 int r = 0;
35 do
36 {
37 r += *p++;
38 } while (--c);
39 return r;
40 }