Debian Codegraph @

gcc/testsuite/gdc.dg/torture/simd16488a.d

raw
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;
6
7 void foo_byte16(byte t, byte s)
8 {
9 byte16 f = s;
10 auto p = cast(byte*)&f;
11 foreach (i; 0 .. 16)
12 assert(p[i] == s);
13 }
14
15 void foo_ubyte16(ubyte t, ubyte s)
16 {
17 ubyte16 f = s;
18 auto p = cast(ubyte*)&f;
19 foreach (i; 0 .. 16)
20 assert(p[i] == s);
21 }
22
23
24 void foo_short8(short t, short s)
25 {
26 short8 f = s;
27 auto p = cast(short*)&f;
28 foreach (i; 0 .. 8)
29 assert(p[i] == s);
30 }
31
32 void foo_ushort8(ushort t, ushort s)
33 {
34 ushort8 f = s;
35 auto p = cast(ushort*)&f;
36 foreach (i; 0 .. 8)
37 assert(p[i] == s);
38 }
39
40
41 void foo_int4(int t, int s)
42 {
43 int4 f = s;
44 auto p = cast(int*)&f;
45 foreach (i; 0 .. 4)
46 assert(p[i] == s);
47 }
48
49 void foo_uint4(uint t, uint s, uint u)
50 {
51 uint4 f = s;
52 auto p = cast(uint*)&f;
53 foreach (i; 0 .. 4)
54 assert(p[i] == s);
55 }
56
57
58 void foo_long2(long t, long s, long u)
59 {
60 long2 f = s;
61 auto p = cast(long*)&f;
62 foreach (i; 0 .. 2)
63 assert(p[i] == s);
64 }
65
66 void foo_ulong2(ulong t, ulong s)
67 {
68 ulong2 f = s;
69 auto p = cast(ulong*)&f;
70 foreach (i; 0 .. 2)
71 assert(p[i] == s);
72 }
73
74 void foo_float4(float t, float s)
75 {
76 float4 f = s;
77 auto p = cast(float*)&f;
78 foreach (i; 0 .. 4)
79 assert(p[i] == s);
80 }
81
82 void foo_double2(double t, double s, double u)
83 {
84 double2 f = s;
85 auto p = cast(double*)&f;
86 foreach (i; 0 .. 2)
87 assert(p[i] == s);
88 }
89
90 void main()
91 {
92 foo_byte16(5, -10);
93 foo_ubyte16(5, 11);
94
95 foo_short8(5, -6);
96 foo_short8(5, 7);
97
98 foo_int4(5, -6);
99 foo_uint4(5, 0x12345678, 22);
100
101 foo_long2(5, -6, 1);
102 foo_ulong2(5, 0x12345678_87654321L);
103
104 foo_float4(5, -6);
105 foo_double2(5, -6, 2);
106 }