about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2022-04-12 22:25:52 -0400
committerRalf Jung <post@ralfj.de>2022-04-15 15:04:00 -0400
commit73f9571d4f45fb56a2076d2c43d21ff618c396d2 (patch)
tree66f587a74c6bd531ed9ec4aa93d604108cb1e939
parente886dc52eedf3d074c6cc66f0518a996f7bbe735 (diff)
downloadrust-73f9571d4f45fb56a2076d2c43d21ff618c396d2.tar.gz
rust-73f9571d4f45fb56a2076d2c43d21ff618c396d2.zip
add codegen smoke test
-rw-r--r--src/test/codegen/simd_arith_offset.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/codegen/simd_arith_offset.rs b/src/test/codegen/simd_arith_offset.rs
new file mode 100644
index 00000000000..a858270d4e7
--- /dev/null
+++ b/src/test/codegen/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 i8*> %_3, <8 x i64> %_4
+    unsafe { simd_arith_offset(ptrs, offsets) }
+}