fix CTFE/Miri simd_insert/extract on array-style repr(simd) types
This commit is contained in:
parent
41301c3b23
commit
2f1a1f530b
5 changed files with 67 additions and 38 deletions
|
|
@ -7,7 +7,8 @@
|
|||
|
||||
#[repr(simd)] struct i8x1(i8);
|
||||
#[repr(simd)] struct u16x2(u16, u16);
|
||||
#[repr(simd)] struct f32x4(f32, f32, f32, f32);
|
||||
// Make one of them an array type to ensure those also work.
|
||||
#[repr(simd)] struct f32x4([f32; 4]);
|
||||
|
||||
extern "platform-intrinsic" {
|
||||
#[rustc_const_stable(feature = "foo", since = "1.3.37")]
|
||||
|
|
@ -38,12 +39,12 @@ fn main() {
|
|||
assert_eq!(Y1, 42);
|
||||
}
|
||||
{
|
||||
const U: f32x4 = f32x4(13., 14., 15., 16.);
|
||||
const U: f32x4 = f32x4([13., 14., 15., 16.]);
|
||||
const V: f32x4 = unsafe { simd_insert(U, 1_u32, 42_f32) };
|
||||
const X0: f32 = V.0;
|
||||
const X1: f32 = V.1;
|
||||
const X2: f32 = V.2;
|
||||
const X3: f32 = V.3;
|
||||
const X0: f32 = V.0[0];
|
||||
const X1: f32 = V.0[1];
|
||||
const X2: f32 = V.0[2];
|
||||
const X3: f32 = V.0[3];
|
||||
const Y0: f32 = unsafe { simd_extract(V, 0) };
|
||||
const Y1: f32 = unsafe { simd_extract(V, 1) };
|
||||
const Y2: f32 = unsafe { simd_extract(V, 2) };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue