2021-04-03 06:05:11 -05:00
|
|
|
//
|
2019-07-13 10:16:57 -05:00
|
|
|
// compile-flags: -C no-prepopulate-passes
|
|
|
|
|
|
|
|
#![crate_type = "lib"]
|
|
|
|
|
2020-11-12 22:31:12 -06:00
|
|
|
#![allow(non_camel_case_types)]
|
|
|
|
#![feature(repr_simd, platform_intrinsics, min_const_generics)]
|
2019-07-13 10:16:57 -05:00
|
|
|
|
|
|
|
#[repr(simd)]
|
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
pub struct S<const N: usize>([f32; N]);
|
|
|
|
|
|
|
|
#[repr(simd)]
|
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
pub struct T([f32; 4]);
|
|
|
|
|
|
|
|
#[repr(simd)]
|
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
pub struct U(f32, f32, f32, f32);
|
|
|
|
|
|
|
|
// CHECK-LABEL: @build_array_s
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn build_array_s(x: [f32; 4]) -> S<4> {
|
2022-02-21 04:21:23 -06:00
|
|
|
// CHECK: call void @llvm.memcpy.{{.+}}({{.*}}, i{{[0-9]+}} 16, i1 false)
|
|
|
|
// CHECK: call void @llvm.memcpy.{{.+}}({{.*}}, i{{[0-9]+}} 16, i1 false)
|
2019-07-13 10:16:57 -05:00
|
|
|
S::<4>(x)
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @build_array_t
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn build_array_t(x: [f32; 4]) -> T {
|
2022-02-21 04:21:23 -06:00
|
|
|
// CHECK: call void @llvm.memcpy.{{.+}}({{.*}}, i{{[0-9]+}} 16, i1 false)
|
|
|
|
// CHECK: call void @llvm.memcpy.{{.+}}({{.*}}, i{{[0-9]+}} 16, i1 false)
|
2019-07-13 10:16:57 -05:00
|
|
|
T(x)
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @build_array_u
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn build_array_u(x: [f32; 4]) -> U {
|
2022-02-21 04:21:23 -06:00
|
|
|
// CHECK: call void @llvm.memcpy.{{.+}}({{.*}}, i{{[0-9]+}} 16, i1 false)
|
|
|
|
// CHECK: call void @llvm.memcpy.{{.+}}({{.*}}, i{{[0-9]+}} 16, i1 false)
|
2019-07-13 10:16:57 -05:00
|
|
|
unsafe { std::mem::transmute(x) }
|
|
|
|
}
|