2 // { dg-additional-options "-ffast-math -fopenmp-simd" }
3 // { dg-additional-options "-msse2" { target x86_64-*-* i?86-*-* } }
5 inline void* my_alloc (__SIZE_TYPE__ bytes
) {void *ptr
; __builtin_posix_memalign (&ptr
, bytes
, 128); return 0; }
6 inline void my_free (void* memory
) {__builtin_free (memory
);}
16 Vec (int n
) : isize (n
) {data
= (T
*)my_alloc (isize
*sizeof (T
));}
17 ~Vec () {my_free(data
);}
19 Vec
& operator = (const Vec
& other
)
22 __builtin_memcpy (data
, other
.data
, isize
*sizeof (T
));
26 T
& operator [] (int i
) {return data
[i
];}
27 const T
& operator [] (int i
) const {return data
[i
];}
28 T
& at (int i
) {return data
[i
];}
29 const T
& at (int i
) const {return data
[i
];}
31 operator T
* () {return data
;}
32 int size () const {return isize
;}
53 Ss (int n1
, int n2
): S_n(n1
), S_m(n2
), v1(n1
, n2
)
55 C1
= new float[n1
* 3];
56 C2
= new float[n2
* 4];
59 ~Ss () { delete C1
; delete C2
;}
60 void foo (float *in
, float w
);
62 void Ss::foo (float *in
, float w
)
65 for (int i
= 0; i
< S_n
; i
++)
67 float w1
= C2
[S_n
+ i
] * w
;
73 // { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target x86_64-*-* i?86-*-* } } }