summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/sms-4.c
blob: eafb395627d437812bf939b3c2c7f3621a49ce3a (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
/* Inspired from sbitmap_a_or_b_and_c_cg function in sbitmap.c.  */
/* { dg-do run } */
/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms" } */

extern void abort (void);

int a[5] = { 0, 1, 0, 0, 0 };
int b[5] = { 0, 1, 0, 1, 0 };
int c[5] = { 0, 0, 1, 1, 0 };
int dst[5] = { 0, 0, 0, 0, 0 };

__attribute__ ((noinline))
void
foo (int size, int *ap, int *bp, int *cp, int *dstp)
{
  unsigned int i, n = size;
  int changed = 0;

  for (i = 0; i < n; i++)
    {
      const int tmp = *ap++ | (*bp++ & *cp++);
      changed |= *dstp ^ tmp;
      *dstp++ = tmp;
    }

  if (changed == 0)
    abort ();
}

int
main ()
{
  foo (5, a, b, c, dst);
  return 0;
}

/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target spu-*-* powerpc*-*-* } } } */
/* { dg-final { cleanup-rtl-dump "sms" } } */