aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-3.c
blob: 6e54d4dd721360d27b83e6fd3d1c60ee1250da0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* PR target/50749: Verify that post-increment addressing is generated
   inside a loop.  */
/* { dg-do compile }  */
/* { dg-options "-O2" } */
/* { dg-final { scan-assembler-times "mov.b\t@r\[0-9]\+\\+,r\[0-9]\+" 1 } } */
/* { dg-final { scan-assembler-times "mov.w\t@r\[0-9]\+\\+,r\[0-9]\+" 1 } } */
/* { dg-final { scan-assembler-times "mov.l\t@r\[0-9]\+\\+,r\[0-9]\+" 1 } } */

int
test_func_00 (char* p, int c)
{
  int r = 0;
  do
  {
    r += *p++;
  } while (--c);
  return r;
}

int
test_func_01 (short* p, int c)
{
  int r = 0;
  do
  {
    r += *p++;
  } while (--c);
  return r;
}

int
test_func_02 (int* p, int c)
{
  int r = 0;
  do
  {
    r += *p++;
  } while (--c);
  return r;
}