c++: fix explicit/copy problem [PR109247]
[official-gcc.git] / gcc / testsuite / gdc.dg / torture / simd16488a.d
blob5578f78aba71b8784ff1449dd682a31d35bcb043
1 // https://issues.dlang.org/show_bug.cgi?id=16488
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 void foo_byte16(byte t, byte s)
9 byte16 f = s;
10 auto p = cast(byte*)&f;
11 foreach (i; 0 .. 16)
12 assert(p[i] == s);
15 void foo_ubyte16(ubyte t, ubyte s)
17 ubyte16 f = s;
18 auto p = cast(ubyte*)&f;
19 foreach (i; 0 .. 16)
20 assert(p[i] == s);
24 void foo_short8(short t, short s)
26 short8 f = s;
27 auto p = cast(short*)&f;
28 foreach (i; 0 .. 8)
29 assert(p[i] == s);
32 void foo_ushort8(ushort t, ushort s)
34 ushort8 f = s;
35 auto p = cast(ushort*)&f;
36 foreach (i; 0 .. 8)
37 assert(p[i] == s);
41 void foo_int4(int t, int s)
43 int4 f = s;
44 auto p = cast(int*)&f;
45 foreach (i; 0 .. 4)
46 assert(p[i] == s);
49 void foo_uint4(uint t, uint s, uint u)
51 uint4 f = s;
52 auto p = cast(uint*)&f;
53 foreach (i; 0 .. 4)
54 assert(p[i] == s);
58 void foo_long2(long t, long s, long u)
60 long2 f = s;
61 auto p = cast(long*)&f;
62 foreach (i; 0 .. 2)
63 assert(p[i] == s);
66 void foo_ulong2(ulong t, ulong s)
68 ulong2 f = s;
69 auto p = cast(ulong*)&f;
70 foreach (i; 0 .. 2)
71 assert(p[i] == s);
74 void foo_float4(float t, float s)
76 float4 f = s;
77 auto p = cast(float*)&f;
78 foreach (i; 0 .. 4)
79 assert(p[i] == s);
82 void foo_double2(double t, double s, double u)
84 double2 f = s;
85 auto p = cast(double*)&f;
86 foreach (i; 0 .. 2)
87 assert(p[i] == s);
90 void main()
92 foo_byte16(5, -10);
93 foo_ubyte16(5, 11);
95 foo_short8(5, -6);
96 foo_short8(5, 7);
98 foo_int4(5, -6);
99 foo_uint4(5, 0x12345678, 22);
101 foo_long2(5, -6, 1);
102 foo_ulong2(5, 0x12345678_87654321L);
104 foo_float4(5, -6);
105 foo_double2(5, -6, 2);