diff options
| author | Ralf Jung <post@ralfj.de> | 2022-04-12 22:25:52 -0400 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2022-04-15 15:04:00 -0400 |
| commit | 73f9571d4f45fb56a2076d2c43d21ff618c396d2 (patch) | |
| tree | 66f587a74c6bd531ed9ec4aa93d604108cb1e939 | |
| parent | e886dc52eedf3d074c6cc66f0518a996f7bbe735 (diff) | |
| download | rust-73f9571d4f45fb56a2076d2c43d21ff618c396d2.tar.gz rust-73f9571d4f45fb56a2076d2c43d21ff618c396d2.zip | |
add codegen smoke test
| -rw-r--r-- | src/test/codegen/simd_arith_offset.rs | 26 |
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) } +} |
