1/* { dg-do compile } */ 2/* { dg-require-effective-target vect_float } */ 3 4typedef float Value; 5 6struct LorentzVector 7{ 8 9 LorentzVector(Value x=0, Value y=0, Value z=0, Value t=0) : 10theX(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; 17 } 18 19 Value theX; 20 Value theY; 21 Value theZ; 22 Value theT; 23} __attribute__ ((aligned(16))); 24 25inline LorentzVector 26operator+(LorentzVector const & a, LorentzVector const & b) { 27 return 28LorentzVector(a.theX+b.theX,a.theY+b.theY,a.theZ+b.theZ,a.theT+b.theT); 29} 30 31inline LorentzVector 32operator*(LorentzVector const & a, Value s) { 33 return LorentzVector(a.theX*s,a.theY*s,a.theZ*s,a.theT*s); 34} 35 36inline LorentzVector 37operator*(Value s, LorentzVector const & a) { 38 return a*s; 39} 40 41 42void sum1(LorentzVector & res, Value s, LorentzVector const & v1, LorentzVector 43const & v2) { 44 res += s*(v1+v2); 45} 46 47void sum2(LorentzVector & res, Value s, LorentzVector const & v1, LorentzVector 48const & v2) { 49 res = res + s*(v1+v2); 50} 51 52/* { dg-final { scan-tree-dump-times "basic block vectorized" 2 "slp2" } } */ 53/* { dg-final { cleanup-tree-dump "slp2" } } */ 54