Skip to content

Commit eb905c0

Browse files
committed
add codegen smoke test
1 parent e886dc5 commit eb905c0

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/test/codegen/simd_arith_offset.rs

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

0 commit comments

Comments
 (0)