]>
git.proxmox.com Git - rustc.git/blob - tests/codegen/simd-intrinsic/simd-intrinsic-generic-extract-insert.rs
1 // compile-flags: -C no-prepopulate-passes
5 #![feature(repr_simd, platform_intrinsics, min_const_generics)]
6 #![allow(non_camel_case_types)]
10 pub struct M(pub f32, pub f32, pub f32, pub f32);
13 #[derive(Copy, Clone)]
14 pub struct S
<const N
: usize>([f32; N
]);
16 extern "platform-intrinsic" {
17 fn simd_extract
<T
, U
>(x
: T
, idx
: u32) -> U
;
18 fn simd_insert
<T
, U
>(x
: T
, idx
: u32, b
: U
) -> T
;
21 // CHECK-LABEL: @extract_m
23 pub unsafe fn extract_m(v
: M
, i
: u32) -> f32 {
24 // CHECK: extractelement <4 x float> %{{v|_3}}, i32 %i
28 // CHECK-LABEL: @extract_s
30 pub unsafe fn extract_s(v
: S
<4>, i
: u32) -> f32 {
31 // CHECK: extractelement <4 x float> %{{v|_3}}, i32 %i
35 // CHECK-LABEL: @insert_m
37 pub unsafe fn insert_m(v
: M
, i
: u32, j
: f32) -> M
{
38 // CHECK: insertelement <4 x float> %{{v|_4}}, float %j, i32 %i
42 // CHECK-LABEL: @insert_s
44 pub unsafe fn insert_s(v
: S
<4>, i
: u32, j
: f32) -> S
<4> {
45 // CHECK: insertelement <4 x float> %{{v|_4}}, float %j, i32 %i