aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.dg
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2022-10-29 09:05:54 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2022-10-29 13:02:26 +0200
commit7e7ebe3e350fde90fe49ab41ce3b92a811bb6370 (patch)
treebe7a6dd9ae43a807ff7107d51ed03069a4a336f2 /gcc/testsuite/gdc.dg
parentcfd85418051e8413e84ae7011cb5cb99cd8e337c (diff)
downloadgcc-7e7ebe3e350fde90fe49ab41ce3b92a811bb6370.zip
gcc-7e7ebe3e350fde90fe49ab41ce3b92a811bb6370.tar.gz
gcc-7e7ebe3e350fde90fe49ab41ce3b92a811bb6370.tar.bz2
d: Merge upstream dmd, druntime e4f8919591, phobos 3ad507b51.
D front-end changes: - Import dmd v2.101.0-beta.1. - Add predefined version `D_Optimized' when compiling with `-O'. - Shortened method syntax (DIP1043) is now enabled by default. - Array literals assigned to `scope' array variables are now allocated on the stack. - Implement `@system' variables (DIP1035), available behind the preview feature flag `-fpreview=systemvariables'. D runtime changes: - Import druntime v2.101.0-beta.1. Phobos changes: - Import phobos v2.101.0-beta.1. - Added `std.typecons.SafeRefCounted', that can be used in `@safe' code with `-fpreview=dip1000'. gcc/d/ChangeLog: * d-attribs.cc (apply_user_attributes): Update for new front-end interface. * d-builtins.cc (d_init_versions): Predefine `D_Optimized' with compiling with optimizations enabled. * d-lang.cc (d_handle_option): Update for new front-end interface. Handle new option `-fpreview=systemvariables'. * dmd/MERGE: Merge upstream dmd e4f8919591. * dmd/VERSION: Bump version to v2.101.0-beta.1. * expr.cc (ExprVisitor::visit (AssignExp *)): Treat construction of static arrays from a call expression as a simple assignment. (ExprVisitor::visit (ArrayLiteralExp *)): Handle array literals with `scope' storage. * gdc.texi: Update documentation of `-fpreview=' options. * lang.opt (fpreview=shortenedmethods): Remove. (fpreview=systemvariables): New option. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime e4f8919591. * src/MERGE: Merge upstream phobos 3ad507b51. gcc/testsuite/ChangeLog: * gdc.dg/simd19630.d: Move tests with errors to ... * gdc.dg/simd19630b.d: ... here. New test. * gdc.dg/simd19630c.d: New test. * gdc.dg/simd_ctfe.d: Removed. * gdc.dg/simd18867.d: New test. * gdc.dg/simd19788.d: New test. * gdc.dg/simd21469.d: New test. * gdc.dg/simd21672.d: New test. * gdc.dg/simd23077.d: New test. * gdc.dg/simd23084.d: New test. * gdc.dg/simd23085.d: New test. * gdc.dg/torture/simd19632.d: New test. * gdc.dg/torture/simd20041.d: New test. * gdc.dg/torture/simd21673.d: New test. * gdc.dg/torture/simd21676.d: New test. * gdc.dg/torture/simd22438.d: New test. * gdc.dg/torture/simd23009.d: New test. * gdc.dg/torture/simd23077.d: New test. * gdc.dg/torture/simd8.d: New test. * gdc.dg/torture/simd9.d: New test. * gdc.dg/torture/simd_prefetch.d: New test.
Diffstat (limited to 'gcc/testsuite/gdc.dg')
-rw-r--r--gcc/testsuite/gdc.dg/simd18867.d11
-rw-r--r--gcc/testsuite/gdc.dg/simd19630.d10
-rw-r--r--gcc/testsuite/gdc.dg/simd19630b.d17
-rw-r--r--gcc/testsuite/gdc.dg/simd19630c.d15
-rw-r--r--gcc/testsuite/gdc.dg/simd19788.d11
-rw-r--r--gcc/testsuite/gdc.dg/simd21469.d9
-rw-r--r--gcc/testsuite/gdc.dg/simd21672.d17
-rw-r--r--gcc/testsuite/gdc.dg/simd23077.d11
-rw-r--r--gcc/testsuite/gdc.dg/simd23084.d17
-rw-r--r--gcc/testsuite/gdc.dg/simd23085.d11
-rw-r--r--gcc/testsuite/gdc.dg/simd_ctfe.d88
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd19632.d15
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd20041.d22
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd21673.d20
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd21676.d36
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd22438.d18
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd23009.d22
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd23077.d11
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd8.d26
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd9.d46
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd_prefetch.d21
21 files changed, 356 insertions, 98 deletions
diff --git a/gcc/testsuite/gdc.dg/simd18867.d b/gcc/testsuite/gdc.dg/simd18867.d
new file mode 100644
index 0000000..295b0f8
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/simd18867.d
@@ -0,0 +1,11 @@
+// https://issues.dlang.org/show_bug.cgi?id=18867
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } }
+import core.simd;
+
+ulong2 test18867(ulong s)
+{
+ ulong2 v;
+ v[0] = s;
+ return v;
+}
diff --git a/gcc/testsuite/gdc.dg/simd19630.d b/gcc/testsuite/gdc.dg/simd19630.d
index 0d45d28..c29acfe 100644
--- a/gcc/testsuite/gdc.dg/simd19630.d
+++ b/gcc/testsuite/gdc.dg/simd19630.d
@@ -3,19 +3,13 @@
// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } }
import core.simd;
-enum fail19630a = int4.init[1..2];
enum fail19630b = int4.init.array[1..2];
enum fail19630c = (cast(int[4])int4.init.array)[1..2];
enum fail19630d = (cast(int[4])int4.init)[1..2];
-enum fail19630e = int4(0)[1..2];
enum fail19630f = int4(0).array[1..2];
enum fail19630g = (cast(int[4])int4(0).array)[1..2];
enum fail19630h = (cast(int[4])int4(0))[1..2];
-enum int4 v19630a = int4.init;
-enum slice19630a = v19630a[1..2];
-static assert(slice19630a == [0]);
-
enum int[4] v19630b = int4.init.array;
enum slice19630b = v19630b[1..2];
static assert(slice19630b == [0]);
@@ -28,10 +22,6 @@ enum int[4] v19630d = cast(int[4])int4.init;
enum slice19630d = v19630d[1..2];
static assert(slice19630d == [0]);
-enum int4 v19630e = int4(0);
-enum slice19630e = v19630e[1..2];
-static assert(slice19630e == [0]);
-
enum int[4] v19630f = int4(0).array;
enum slice19630f = v19630f[1..2];
static assert(slice19630f == [0]);
diff --git a/gcc/testsuite/gdc.dg/simd19630b.d b/gcc/testsuite/gdc.dg/simd19630b.d
new file mode 100644
index 0000000..4f09597
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/simd19630b.d
@@ -0,0 +1,17 @@
+// https://issues.dlang.org/show_bug.cgi?id=19630
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } }
+import core.simd;
+
+enum fail19630a = int4.init[1..2];
+// { dg-error "'__vector\\\(int\\\[4\\\]\\\)' cannot be sliced with '\\\[\\\]'" "" { target *-*-* } .-1 }
+enum fail19630e = int4(0)[1..2];
+// { dg-error "'__vector\\\(int\\\[4\\\]\\\)' cannot be sliced with '\\\[\\\]'" "" { target *-*-* } .-1 }
+
+enum int4 v19630a = int4.init;
+enum slice19630a = v19630a[1..2];
+// { dg-error "'__vector\\\(int\\\[4\\\]\\\)' cannot be sliced with '\\\[\\\]'" "" { target *-*-* } .-1 }
+
+enum int4 v19630e = int4(0);
+enum slice19630e = v19630e[1..2];
+// { dg-error "'__vector\\\(int\\\[4\\\]\\\)' cannot be sliced with '\\\[\\\]'" "" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/gdc.dg/simd19630c.d b/gcc/testsuite/gdc.dg/simd19630c.d
new file mode 100644
index 0000000..d17cf1a
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/simd19630c.d
@@ -0,0 +1,15 @@
+// https://issues.dlang.org/show_bug.cgi?id=19630
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } }
+import core.simd;
+
+int4 testz19630()
+{
+ return [0,0,0,0];
+}
+
+void test19630()
+{
+ assert(testz19630()[] == [0,0,0,0]);
+ // { dg-error "'__vector\\\(int\\\[4\\\]\\\)' cannot be sliced with '\\\[\\\]'" "" { target *-*-* } .-1 }
+}
diff --git a/gcc/testsuite/gdc.dg/simd19788.d b/gcc/testsuite/gdc.dg/simd19788.d
new file mode 100644
index 0000000..74ab008
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/simd19788.d
@@ -0,0 +1,11 @@
+// https://issues.dlang.org/show_bug.cgi?id=19788
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+void test19788()
+{
+ enum v = __vector(float[4]).init;
+ const(float)[] a = v[];
+ // { dg-error "'__vector\\\(float\\\[4\\\]\\\)' cannot be sliced with '\\\[\\\]'" "" { target *-*-* } .-1 }
+}
diff --git a/gcc/testsuite/gdc.dg/simd21469.d b/gcc/testsuite/gdc.dg/simd21469.d
new file mode 100644
index 0000000..9596f5e
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/simd21469.d
@@ -0,0 +1,9 @@
+// https://issues.dlang.org/show_bug.cgi?id=18867
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } }
+import core.simd;
+
+int4 test21469(short a)
+{
+ return cast(int4)(short8(a));
+}
diff --git a/gcc/testsuite/gdc.dg/simd21672.d b/gcc/testsuite/gdc.dg/simd21672.d
new file mode 100644
index 0000000..c5bd1df
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/simd21672.d
@@ -0,0 +1,17 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=213
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } }
+
+import core.simd;
+
+struct S213
+{
+ int4 vec;
+}
+
+void test213()
+{
+ S213 s, b;
+
+ assert(s == b);
+}
diff --git a/gcc/testsuite/gdc.dg/simd23077.d b/gcc/testsuite/gdc.dg/simd23077.d
new file mode 100644
index 0000000..150ec9f
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/simd23077.d
@@ -0,0 +1,11 @@
+// https://issues.dlang.org/show_bug.cgi?id=23077
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+float test23077(float x)
+{
+ short i = *cast(short*)&x;
+ ++i;
+ return *cast(float*)&i; // this cast is not allowed in @safe code
+}
diff --git a/gcc/testsuite/gdc.dg/simd23084.d b/gcc/testsuite/gdc.dg/simd23084.d
new file mode 100644
index 0000000..1f40e3c
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/simd23084.d
@@ -0,0 +1,17 @@
+// https://issues.dlang.org/show_bug.cgi?id=23084
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+import core.simd;
+
+__vector(int[4]) test23084a(__vector(int[4]) a)
+{
+ __vector(short[8]) r = cast(short)(a.array[0]);
+ return cast(__vector(int[4]))r;
+}
+
+__vector(int[4]) test23084b(__vector(int[4]) a)
+{
+ __vector(byte[16]) r = cast(byte)(a.array[0]);
+ return cast(__vector(int[4]))r;
+}
diff --git a/gcc/testsuite/gdc.dg/simd23085.d b/gcc/testsuite/gdc.dg/simd23085.d
new file mode 100644
index 0000000..66444ad
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/simd23085.d
@@ -0,0 +1,11 @@
+// https://issues.dlang.org/show_bug.cgi?id=23085
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+float test23085(float x)
+{
+ byte i = *cast(byte*)&x;
+ ++i;
+ return *cast(float*)&i; // this cast is not allowed in @safe code
+}
diff --git a/gcc/testsuite/gdc.dg/simd_ctfe.d b/gcc/testsuite/gdc.dg/simd_ctfe.d
deleted file mode 100644
index 507de17..0000000
--- a/gcc/testsuite/gdc.dg/simd_ctfe.d
+++ /dev/null
@@ -1,88 +0,0 @@
-// { dg-additional-options "-mavx" { target avx_runtime } }
-// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } }
-import core.simd;
-
-// https://issues.dlang.org/show_bug.cgi?id=19627
-enum int[4] fail19627 = cast(int[4])int4(0);
-
-// https://issues.dlang.org/show_bug.cgi?id=19628
-enum ice19628a = int4.init[0];
-enum ice19628b = int4.init.array[0];
-enum ice19628c = (cast(int[4])int4.init.array)[0];
-enum ice19628d = (cast(int[4])int4.init)[0];
-
-// https://issues.dlang.org/show_bug.cgi?id=19629
-enum fail19629a = int4(0)[0];
-enum fail19629b = int4(0).array[0];
-enum fail19629c = (cast(int[4])int4(0).array)[0];
-enum fail19628d = (cast(int[4])int4(0))[0];
-
-// https://issues.dlang.org/show_bug.cgi?id=19630
-enum fail19630a = int4.init[1..2];
-enum fail19630b = int4.init.array[1..2];
-enum fail19630c = (cast(int[4])int4.init.array)[1..2];
-enum fail19630d = int4(0)[1..2];
-enum fail19630e = int4(0).array[1..2];
-enum fail19630f = (cast(int[4])int4(0).array)[1..2];
-enum fail19630g = (cast(int[4])int4.init)[1..2];
-enum fail19630h = (cast(int[4])int4(0))[1..2];
-
-// Same tests as above, but use access via enum.
-enum int4 V1 = int4.init;
-enum int[4] V2 = int4.init.array;
-enum int[4] V3 = cast(int[4])int4.init;
-enum int[4] V4 = cast(int[4])int4.init.array;
-enum int4 V5 = int4(0);
-enum int[4] V6 = int4(0).array;
-enum int[4] V7 = cast(int[4])int4(0);
-enum int[4] V8 = cast(int[4])int4(0).array;
-
-// CTFE index tests
-enum I1 = V1[0]; static assert(I1 == 0);
-enum I2 = V2[0]; static assert(I2 == 0);
-enum I3 = V3[0]; static assert(I3 == 0);
-enum I4 = V4[0]; static assert(I4 == 0);
-enum I5 = V5[0]; static assert(I5 == 0);
-enum I6 = V6[0]; static assert(I6 == 0);
-enum I7 = V7[0]; static assert(I7 == 0);
-enum I8 = V8[0]; static assert(I8 == 0);
-
-// CTFE slice tests
-enum S1 = V1[1..2]; static assert(S1 == [0]);
-enum S2 = V2[1..2]; static assert(S2 == [0]);
-enum S3 = V3[1..2]; static assert(S3 == [0]);
-enum S4 = V4[1..2]; static assert(S4 == [0]);
-enum S5 = V5[1..2]; static assert(S5 == [0]);
-enum S6 = V6[1..2]; static assert(S6 == [0]);
-enum S7 = V7[1..2]; static assert(S7 == [0]);
-enum S8 = V8[1..2]; static assert(S8 == [0]);
-
-// Same tests as above, but use access via immutable.
-//immutable int4 v1 = int4.init; // Cannot cast to immutable at compile time
-immutable int[4] v2 = int4.init.array;
-immutable int[4] v3 = cast(int[4])int4.init;
-immutable int[4] v4 = cast(int[4])int4.init.array;
-//immutable int4 v5 = int4(0); // Cannot cast to immutable at compile time
-immutable int[4] v6 = int4(0).array;
-immutable int[4] v7 = cast(int[4])int4(0);
-immutable int[4] v8 = cast(int[4])int4(0).array;
-
-// CTFE index tests
-//immutable i1 = v1[0]; static assert(i1 == 0);
-immutable i2 = v2[0]; static assert(i2 == 0);
-immutable i3 = v3[0]; static assert(i3 == 0);
-immutable i4 = v4[0]; static assert(i4 == 0);
-//immutable i5 = v5[0]; static assert(i5 == 0);
-immutable i6 = v6[0]; static assert(i6 == 0);
-immutable i7 = v7[0]; static assert(i7 == 0);
-immutable i8 = v8[0]; static assert(i8 == 0);
-
-// CTFE slice tests
-//immutable s1 = v1[1..2]; static assert(s1 == [0]);
-immutable s2 = v2[1..2]; static assert(s2 == [0]);
-immutable s3 = v3[1..2]; static assert(s3 == [0]);
-immutable s4 = v4[1..2]; static assert(s4 == [0]);
-//immutable s5 = v5[1..2]; static assert(s5 == [0]);
-immutable s6 = v6[1..2]; static assert(s6 == [0]);
-immutable s7 = v7[1..2]; static assert(s7 == [0]);
-immutable s8 = v8[1..2]; static assert(s8 == [0]);
diff --git a/gcc/testsuite/gdc.dg/torture/simd19632.d b/gcc/testsuite/gdc.dg/torture/simd19632.d
new file mode 100644
index 0000000..e74a3e8
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/simd19632.d
@@ -0,0 +1,15 @@
+// https://issues.dlang.org/show_bug.cgi?id=19632
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do run { target { avx_runtime || vect_sizes_16B_8B } } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+import core.simd;
+
+void main()
+{
+ int4 v = [1, 2, 3, 4];
+ int sum = 0;
+ foreach (ref e; v)
+ sum += (e *= 2);
+ assert(v.array[] == [2, 4, 6, 8]);
+ assert(sum == 20);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/simd20041.d b/gcc/testsuite/gdc.dg/torture/simd20041.d
new file mode 100644
index 0000000..a74f58a
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/simd20041.d
@@ -0,0 +1,22 @@
+// https://issues.dlang.org/show_bug.cgi?id=20041
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do run { target { avx_runtime || vect_sizes_16B_8B } } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+import core.simd;
+
+immutable(float4) test20041()
+{
+ float4 raw = 2.0f;
+ raw.array[0] = 1;
+ return cast(immutable)raw;
+}
+
+void main()
+{
+ static immutable float4 v = test20041();
+
+ assert(v.array[0] == 1);
+ assert(v.array[1] == 2);
+ assert(v.array[2] == 2);
+ assert(v.array[3] == 2);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/simd21673.d b/gcc/testsuite/gdc.dg/torture/simd21673.d
new file mode 100644
index 0000000..701e33a
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/simd21673.d
@@ -0,0 +1,20 @@
+// https://issues.dlang.org/show_bug.cgi?id=21673
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do run { target { avx_runtime || vect_sizes_16B_8B } } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+import core.simd;
+
+float4 _mm_move_ss(float4 a, float4 b)
+{
+ a.ptr[0] = b.array[0];
+ return a;
+}
+
+void main()
+{
+ float4 A = [1.0f, 2.0f, 3.0f, 4.0f];
+ float4 B = [5.0f, 6.0f, 7.0f, 8.0f];
+ float4 R = _mm_move_ss(A, B);
+ float[4] correct = [5.0f, 2.0f, 3.0f, 4.0f];
+ assert(R.array == correct);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/simd21676.d b/gcc/testsuite/gdc.dg/torture/simd21676.d
new file mode 100644
index 0000000..1d7b911
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/simd21676.d
@@ -0,0 +1,36 @@
+// https://issues.dlang.org/show_bug.cgi?id=23009
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do run { target { avx_runtime || vect_sizes_16B_8B } } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+import core.simd;
+
+double2 loadUnaligned21676(const(double)* pvec)
+{
+ double2 result;
+ foreach(i; 0..2)
+ {
+ result[i] = pvec[i];
+ }
+ return result;
+}
+
+double2 _mm_setr_pd(double e1, double e0)
+{
+ double[2] result = [e1, e0];
+ return loadUnaligned21676(result.ptr);
+}
+
+double2 fun(double2 a, double2 b)
+{
+ a[0] = (a[0] < b[0]) ? a[0] : b[0];
+ return a;
+}
+
+void main()
+{
+ double2 A = _mm_setr_pd(1.0, 2.0);
+ double2 B = _mm_setr_pd(4.0, 1.0);
+ double2 C = fun(A, B);
+ assert(C.array[0] == 1.0);
+ assert(C.array[1] == 2.0);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/simd22438.d b/gcc/testsuite/gdc.dg/torture/simd22438.d
new file mode 100644
index 0000000..9199be6
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/simd22438.d
@@ -0,0 +1,18 @@
+// https://issues.dlang.org/show_bug.cgi?id=22438
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+struct T22438 { int x; double d; }
+
+T22438 foo22438(int x, double d) { return T22438(x, d); }
+
+struct S22438 { T22438 t; string r; }
+
+void main()
+{
+ S22438 s = S22438(foo22438(10, 3.14), "str");
+ assert(s.t.x == 10);
+ assert(s.t.d == 3.14);
+ assert(s.r == "str");
+}
diff --git a/gcc/testsuite/gdc.dg/torture/simd23009.d b/gcc/testsuite/gdc.dg/torture/simd23009.d
new file mode 100644
index 0000000..a45ec4d
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/simd23009.d
@@ -0,0 +1,22 @@
+// https://issues.dlang.org/show_bug.cgi?id=23009
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do run { target { avx_runtime || vect_sizes_16B_8B } } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+import core.simd;
+
+double2 _mm_loadl_pd(double2 a, const(double)* mem_addr)
+{
+ a[0] = *mem_addr;
+ return a;
+}
+
+void main()
+{
+ double A = 7.0;
+ double2 B;
+ B[0] = 4.0;
+ B[1] = -5.0;
+ double2 R = _mm_loadl_pd(B, &A);
+ double[2] correct = [ 7.0, -5.0 ];
+ assert(R.array == correct);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/simd23077.d b/gcc/testsuite/gdc.dg/torture/simd23077.d
new file mode 100644
index 0000000..150ec9f
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/simd23077.d
@@ -0,0 +1,11 @@
+// https://issues.dlang.org/show_bug.cgi?id=23077
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+float test23077(float x)
+{
+ short i = *cast(short*)&x;
+ ++i;
+ return *cast(float*)&i; // this cast is not allowed in @safe code
+}
diff --git a/gcc/testsuite/gdc.dg/torture/simd8.d b/gcc/testsuite/gdc.dg/torture/simd8.d
new file mode 100644
index 0000000..3847732
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/simd8.d
@@ -0,0 +1,26 @@
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do run { target { avx_runtime || vect_sizes_16B_8B } } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+import gcc.simd;
+
+alias __m128 = __vector(float[4]);
+
+__m128 _mm_setr_ps (float e3, float e2, float e1, float e0) pure @trusted
+{
+ float[4] result = [e3, e2, e1, e0];
+ return loadUnaligned!(__m128)(cast(__m128*)result.ptr);
+}
+
+__m128 _mm_movehdup_ps (__m128 a) pure @trusted
+{
+ a.ptr[0] = a.array[1];
+ a.ptr[2] = a.array[3];
+ return a;
+}
+
+void main()
+{
+ __m128 A = _mm_movehdup_ps(_mm_setr_ps(1, 2, 3, 4));
+ float[4] correct = [2.0f, 2, 4, 4 ];
+ assert(A.array == correct);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/simd9.d b/gcc/testsuite/gdc.dg/torture/simd9.d
new file mode 100644
index 0000000..0653531
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/simd9.d
@@ -0,0 +1,46 @@
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+__gshared int testsroa_x;
+
+template SROA(T1, T2)
+{
+ struct FPoint
+ {
+ T1 x;
+ T2 y;
+ }
+
+ void sroa(FPoint p1, ref FPoint quad)
+ {
+ quad = FPoint(p1.x, p1.y);
+ }
+
+ void testit()
+ {
+ FPoint p1 = FPoint(1, 2);
+
+ FPoint quad;
+ sroa(p1, quad);
+
+ if (quad != p1)
+ {
+ assert(0);
+ }
+ ++testsroa_x;
+ }
+}
+
+void main()
+{
+ SROA!(int, int ).testit();
+ SROA!(int, float).testit();
+ SROA!(float, float).testit();
+ SROA!(float, int ).testit();
+
+ SROA!(long, long ).testit();
+ SROA!(long, double).testit();
+ SROA!(double, double).testit();
+ SROA!(double, long ).testit();
+}
diff --git a/gcc/testsuite/gdc.dg/torture/simd_prefetch.d b/gcc/testsuite/gdc.dg/torture/simd_prefetch.d
new file mode 100644
index 0000000..1778476
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/simd_prefetch.d
@@ -0,0 +1,21 @@
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+import gcc.simd;
+
+int testprefetch(byte a)
+{
+ prefetch!(false, 0)(&a);
+ prefetch!(false, 1)(&a);
+ prefetch!(false, 2)(&a);
+ prefetch!(false, 3)(&a);
+ prefetch!(true, 0)(&a);
+ prefetch!(true, 1)(&a);
+ prefetch!(true, 2)(&a);
+ prefetch!(true, 3)(&a);
+ return 3;
+}
+
+void main()
+{
+ int i = testprefetch(1);
+ assert(i == 3);
+}