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