Skip to content

Commit 73f9571

Browse files
committed
add codegen smoke test
1 parent e886dc5 commit 73f9571

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/test/codegen/simd_arith_offset.rs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// compile-flags: -C no-prepopulate-passes
2+
// only-64bit (because the LLVM type of i64 for usize shows up)
3+
//
4+
5+
#![crate_type = "lib"]
6+
#![feature(repr_simd, platform_intrinsics)]
7+
8+
extern "platform-intrinsic" {
9+
pub(crate) fn simd_arith_offset<T, U>(ptrs: T, offsets: U) -> T;
10+
}
11+
12+
/// A vector of *const T.
13+
#[derive(Debug, Copy, Clone)]
14+
#[repr(simd)]
15+
pub struct SimdConstPtr<T, const LANES: usize>([*const T; LANES]);
16+
17+
#[derive(Debug, Copy, Clone)]
18+
#[repr(simd)]
19+
pub struct Simd<T, const LANES: usize>([T; LANES]);
20+
21+
// CHECK-LABEL: smoke
22+
#[no_mangle]
23+
pub fn smoke(ptrs: SimdConstPtr<u8, 8>, offsets: Simd<usize, 8>) -> SimdConstPtr<u8, 8> {
24+
// CHECK: getelementptr i8, <8 x i8*> %_3, <8 x i64> %_4
25+
unsafe { simd_arith_offset(ptrs, offsets) }
26+
}

0 commit comments

Comments
 (0)