about summary refs log tree commit diff
path: root/tests/codegen/simd/simd_arith_offset.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-08-07 05:29:11 +0200
committerGitHub <noreply@github.com>2023-08-07 05:29:11 +0200
commitfe1c3a1a5e6afa5e8d342e5313aa3952bad30625 (patch)
treed778de75adf1b93a1a816fb0dc9d02a8360d281f /tests/codegen/simd/simd_arith_offset.rs
parent137177386b1d2c991a6f34bc0be57b5f4224159c (diff)
parentc81d3e23d1aa58571ce82de0af916cc7f3c9a1be (diff)
Rollup merge of #114230 - workingjubilee:codegen-tests-that-nest, r=Mark-Simulacrum
Nest other codegen test topics

This PR is like rust-lang/rust#114229 in that it mostly pushes codegen tests around, shoving them into their own directories, but because all of the changes are very simple cleanups I pulled them into a separate PR. The other PR might involve actually evaluating the correctness of the test after changes, but here it is mostly a matter of taste. The only "functional" change is deleting a few tests that... hinge on a version of LLVM that we don't support (as of rust-lang/rust#114148 anyways).

I considered a few different ways to group other topics but I feel the question of whether `tests/codegen/{vec,array,slice}` should exist is more subtle than these choices, as it might be better to group such related tests by other topics like bounds check elision, thus I avoided making it.
Diffstat (limited to 'tests/codegen/simd/simd_arith_offset.rs')
-rw-r--r--tests/codegen/simd/simd_arith_offset.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/codegen/simd/simd_arith_offset.rs b/tests/codegen/simd/simd_arith_offset.rs
new file mode 100644
index 00000000000..1ee73de1186
--- /dev/null
+++ b/tests/codegen/simd/simd_arith_offset.rs
@@ -0,0 +1,26 @@
+// compile-flags: -C no-prepopulate-passes
+// only-64bit (because the LLVM type of i64 for usize shows up)
+//
+
+#![crate_type = "lib"]
+#![feature(repr_simd, platform_intrinsics)]
+
+extern "platform-intrinsic" {
+    pub(crate) fn simd_arith_offset<T, U>(ptrs: T, offsets: U) -> T;
+}
+
+/// A vector of *const T.
+#[derive(Debug, Copy, Clone)]
+#[repr(simd)]
+pub struct SimdConstPtr<T, const LANES: usize>([*const T; LANES]);
+
+#[derive(Debug, Copy, Clone)]
+#[repr(simd)]
+pub struct Simd<T, const LANES: usize>([T; LANES]);
+
+// CHECK-LABEL: smoke
+#[no_mangle]
+pub fn smoke(ptrs: SimdConstPtr<u8, 8>, offsets: Simd<usize, 8>) -> SimdConstPtr<u8, 8> {
+    // CHECK: getelementptr i8, <8 x ptr> %0, <8 x i64> %1
+    unsafe { simd_arith_offset(ptrs, offsets) }
+}