]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gdc.dg/simd17720b.d
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / gdc.dg / simd17720b.d
1 // https://issues.dlang.org/show_bug.cgi?id=17720
2 // { dg-additional-options "-mavx2" { target avx2_runtime } }
3 // { dg-do compile { target { avx2_runtime || vect_sizes_32B_16B } } }
4 import core.simd;
5
6 alias TypeTuple(T...) = T;
7
8 void test17720()
9 {
10 alias Vector32s = TypeTuple!(
11 void32, byte32, short16, int8, long4,
12 ubyte32, ushort16, uint8, ulong4, float8, double4);
13
14 // OK: __vector(T) -> __vector(void[]) of same size.
15 // NG: __vector(T) -> __vector(void[]) of different size.
16 // NG: explicit cast __vector(T) -> __vector(void[]) of different size.
17 foreach (V; Vector32s)
18 {
19 static assert( __traits(compiles, { void32 v = V.init; }));
20 static assert(!__traits(compiles, { void16 v = V.init; }));
21 static assert(!__traits(compiles, { void16 v = cast(void16)V.init; }));
22 }
23
24 // NG: __vector(T) -> __vector(T) of same size.
25 // OK: explicit cast __vector(T) -> __vector(T) of same size.
26 // NG: __vector(T) -> __vector(T) of different size.
27 // NG: explicit cast __vector(T) -> __vector(T) of different size.
28 foreach (V; Vector32s)
29 {
30 static if (is(V == double4))
31 {
32 static assert(!__traits(compiles, { long4 v = V.init; }));
33 static assert( __traits(compiles, { long4 v = cast(long4)V.init; }));
34 }
35 else
36 {
37 static assert(!__traits(compiles, { double4 v = V.init; }));
38 static assert( __traits(compiles, { double4 v = cast(double4)V.init; }));
39 }
40 static assert(!__traits(compiles, { double2 v = V.init; }));
41 static assert(!__traits(compiles, { double2 v = cast(double2)V.init; }));
42 }
43 }