OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [var-expand3.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do run { target { powerpc*-*-* && vmx_hw } } }} */
2
/* { dg-options "-O2 -funroll-loops -ffast-math -fvariable-expansion-in-unroller -maltivec -fdump-rtl-loop2_unroll" } */
3
 
4
#include "altivec.h"
5
extern void abort (void);
6
extern void exit (int);
7
 
8
#define N 256
9
 
10
float in1[N] __attribute__ ((__aligned__ (16))) = {0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57};
11
float in2[N] __attribute__ ((__aligned__ (16))) = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
12
 
13
float
14
foo (int n)
15
{
16
  unsigned i;
17
  vector float vp1, vp2, vp3, vaccum, vzero, vtmp;
18
  float accum = 1.0;
19
 
20
  vzero = (vector float){0, 0, 0, 0};
21
 
22
  vaccum = vzero;
23
 
24
  for (i = 0; i < n; i++)
25
    {
26
      vp1 = vec_ld (i * 16, in1);
27
      vp2 = vec_ld (i * 16, in2);
28
 
29
      vaccum = vec_madd (vp1, vp2, vaccum);
30
 
31
    }
32
  vtmp = vec_sld (vaccum, vaccum, 8);
33
  vp1 = vec_add (vaccum, vtmp);
34
  vtmp = vec_sld (vp1, vp1, 4);
35
  vp2 = vec_add (vp1, vtmp);
36
 
37
  vec_ste (vp2, 0, &accum);
38
  if (accum != 1518)
39
    return 0;
40
 
41
  return accum;
42
}
43
 
44
int
45
main (void)
46
{
47
  if (!foo (3))
48
    abort ();
49
 
50
   exit (0);
51
}
52
 
53
/* { dg-final { scan-rtl-dump "Expanding Accumulator" "loop2_unroll" } } */
54
/* { dg-final { cleanup-rtl-dump "loop*" } } */
55
 
56
 
57
 
58
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.