Debian Codegraph @

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

raw
1 // https://issues.dlang.org/show_bug.cgi?id=16703
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 float index(float4 f4, size_t i)
8 {
9 return f4[i];
10 }
11
12 float[4] slice(float4 f4)
13 {
14 return f4[];
15 }
16
17 float slice2(float4 f4, size_t lwr, size_t upr, size_t i)
18 {
19 float[] fa = f4[lwr .. upr];
20 return fa[i];
21 }
22
23 void main()
24 {
25 float4 f4 = [1,2,3,4];
26 assert(index(f4, 0) == 1);
27 assert(index(f4, 1) == 2);
28 assert(index(f4, 2) == 3);
29 assert(index(f4, 3) == 4);
30
31 float[4] fsa = slice(f4);
32 assert(fsa == [1.0f,2,3,4]);
33
34 assert(slice2(f4, 1, 3, 0) == 2);
35 assert(slice2(f4, 1, 3, 1) == 3);
36 }