2014-01-30 Alangi Derick <alangiderick@gmail.com>
[official-gcc.git] / gcc / testsuite / g++.dg / vect / slp-pr50819.cc
blob515d774a22833da11fa61f14d83c99be86fd4cb6
1 /* { dg-do compile } */
2 /* { dg-require-effective-target vect_float } */
4 typedef float Value;
6 struct LorentzVector
9 LorentzVector(Value x=0, Value y=0, Value z=0, Value t=0) :
10 theX(x),theY(y),theZ(z),theT(t){}
11 LorentzVector & operator+=(const LorentzVector & a) {
12 theX += a.theX;
13 theY += a.theY;
14 theZ += a.theZ;
15 theT += a.theT;
16 return *this;
19 Value theX;
20 Value theY;
21 Value theZ;
22 Value theT;
23 } __attribute__ ((aligned(16)));
25 inline LorentzVector
26 operator+(LorentzVector const & a, LorentzVector const & b) {
27 return
28 LorentzVector(a.theX+b.theX,a.theY+b.theY,a.theZ+b.theZ,a.theT+b.theT);
31 inline LorentzVector
32 operator*(LorentzVector const & a, Value s) {
33 return LorentzVector(a.theX*s,a.theY*s,a.theZ*s,a.theT*s);
36 inline LorentzVector
37 operator*(Value s, LorentzVector const & a) {
38 return a*s;
42 void sum1(LorentzVector & res, Value s, LorentzVector const & v1, LorentzVector
43 const & v2) {
44 res += s*(v1+v2);
47 void sum2(LorentzVector & res, Value s, LorentzVector const & v1, LorentzVector
48 const & v2) {
49 res = res + s*(v1+v2);
52 /* { dg-final { scan-tree-dump-times "basic block vectorized" 2 "slp" } } */
53 /* { dg-final { cleanup-tree-dump "slp" } } */