d: Fix gdc -O2 -mavx generates misaligned vmovdqa instruction [PR114171]
[official-gcc.git] / gcc / testsuite / gdc.dg / torture / simd21727.d
blobd277f5366da92719ce3409a7c5c65f8019c3ccd1
1 // https://issues.dlang.org/show_bug.cgi?id=21727
2 // { dg-additional-options "-mavx" { target avx_runtime } }
3 // { dg-do run { target { avx_runtime || vect_sizes_16B_8B } } }
4 // { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
5 import core.simd;
7 @nogc nothrow pure @safe:
9 struct Float4
11 float4 mVector;
13 pragma(inline, false) ref typeof(this) doubleInPlace() return
14 @nogc nothrow pure @safe
16 mVector = mVector + mVector;
17 return this;
21 pragma(inline, false) Float4 identity(Float4 a)
23 return a;
26 pragma(inline, true) Float4 twoTimes(const ref Float4 a)
28 return Float4(a.mVector + a.mVector);
31 pragma(inline, false) Float4 fourTimes(const Float4 a)
33 auto x = identity(a);
34 auto y = x.doubleInPlace(); // This crashed in dmd.backend.cgxmm.xmmload.
35 auto z = twoTimes(y);
36 return z;
39 void main()
41 const c = fourTimes(Float4([5,7,11,13]));
42 assert(c.mVector.array == [20, 28, 44, 52]);