1 /* { dg-do compile { target i?86-*-* x86_64-*-* } } */
2 /* { dg-options "-msse -O2 -fdump-tree-esra-details" } */
3
4 #include "xmmintrin.h"
5
6 typedef __m128 v4sf; // vector of 4 floats (SSE1)
7
8 #define ARRSZ 1024
9
10 typedef union {
11 float f[4];
12 v4sf v;
13 } V4SF;
14
15 struct COLOUR {
16 float r,g,b;
17 };
18
func(float * pre1,float pre2,struct COLOUR * a,V4SF * lpic)19 void func (float *pre1, float pre2, struct COLOUR *a, V4SF *lpic)
20 {
21 V4SF va;
22 int y;
23 va.f[0]=a->r;va.f[1]=a->g;va.f[2]=a->b;va.f[3]=0.f;
24 for (y=0; y<20; ++y)
25 {
26 float att = pre1[y]*pre2;
27 v4sf tmpatt=_mm_load1_ps(&att);
28 tmpatt=_mm_mul_ps(tmpatt,va.v);
29 lpic[y].v=_mm_add_ps(tmpatt,lpic[y].v);
30 }
31 }
32
main()33 int main()
34 {
35 V4SF lpic[ARRSZ];
36 float pre1[ARRSZ];
37 int i;
38 struct COLOUR col={0.,2.,4.};
39 for (i=0; i<20; ++i)
40 pre1[i]=0.4;
41 for (i=0;i<10000000;++i)
42 func(&pre1[0],0.3,&col,&lpic[0]);
43 return 0;
44 }
45
46 /* { dg-final { scan-tree-dump-times "Created a replacement" 0 "esra"} } */
47