From eb905c08c90e7d1c09f4ad73e7e10fe9bd4534e4 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 12 Apr 2022 22:25:52 -0400 Subject: [PATCH] add codegen smoke test --- src/test/codegen/simd_arith_offset.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/test/codegen/simd_arith_offset.rs diff --git a/src/test/codegen/simd_arith_offset.rs b/src/test/codegen/simd_arith_offset.rs new file mode 100644 index 0000000000000..cb885ac6c3516 --- /dev/null +++ b/src/test/codegen/simd_arith_offset.rs @@ -0,0 +1,25 @@ +// compile-flags: -C no-prepopulate-passes +// + +#![crate_type = "lib"] +#![feature(repr_simd, platform_intrinsics)] + +extern "platform-intrinsic" { + pub(crate) fn simd_arith_offset(ptrs: T, offsets: U) -> T; +} + +/// A vector of *const T. +#[derive(Debug, Copy, Clone)] +#[repr(simd)] +pub struct SimdConstPtr([*const T; LANES]); + +#[derive(Debug, Copy, Clone)] +#[repr(simd)] +pub struct Simd([T; LANES]); + +// CHECK-LABEL: smoke +#[no_mangle] +pub fn smoke(ptrs: SimdConstPtr, offsets: Simd) -> SimdConstPtr { + // CHECK: getelementptr i8, <8 x i8*> %_3, <8 x i64> %_4 + unsafe { simd_arith_offset(ptrs, offsets) } +}