fix test suite

This commit is contained in:
Ralf Jung 2021-05-12 17:08:45 +02:00
parent 2a245e0226
commit c61e8face0
7 changed files with 63 additions and 74 deletions

View File

@ -11,7 +11,8 @@ extern "platform-intrinsic" {
fn main() {
unsafe {
let _: I32x2 = simd_shuffle2(I32x2(1, 2), I32x2(3, 4), [0, 0]);
let _: I32x2 = simd_shuffle2(I32x2(1, 2), I32x2(3, 4), [0, 0]);
const IDX: [u32; 2] = [0, 0];
let _: I32x2 = simd_shuffle2(I32x2(1, 2), I32x2(3, 4), IDX);
let _: I32x2 = simd_shuffle2(I32x2(1, 2), I32x2(3, 4), IDX);
}
}

View File

@ -1,20 +0,0 @@
// run-pass
// ignore-emscripten FIXME(#45351)
#![feature(platform_intrinsics, repr_simd)]
extern "platform-intrinsic" {
fn simd_shuffle2<T, U>(x: T, y: T, idx: [u32; 2]) -> U;
}
#[repr(simd)]
#[derive(Clone, Copy)]
#[allow(non_camel_case_types)]
struct u64x2(u64, u64);
fn main() {
let a = u64x2(1, 2);
let r: u64x2 = unsafe { simd_shuffle2(a, a, [0-0, 0-0]) };
assert_eq!(r.0, 1);
assert_eq!(r.1, 1);
}

View File

@ -50,25 +50,28 @@ fn main() {
simd_extract::<_, f32>(x, 0);
//~^ ERROR expected return type `i32` (element of input `i32x4`), found `f32`
simd_shuffle2::<i32, i32>(0, 0, [0; 2]);
const IDX2: [u32; 2] = [0; 2];
simd_shuffle2::<i32, i32>(0, 0, IDX2);
//~^ ERROR expected SIMD input type, found non-SIMD `i32`
simd_shuffle4::<i32, i32>(0, 0, [0; 4]);
const IDX4: [u32; 4] = [0; 4];
simd_shuffle4::<i32, i32>(0, 0, IDX4);
//~^ ERROR expected SIMD input type, found non-SIMD `i32`
simd_shuffle8::<i32, i32>(0, 0, [0; 8]);
const IDX8: [u32; 8] = [0; 8];
simd_shuffle8::<i32, i32>(0, 0, IDX8);
//~^ ERROR expected SIMD input type, found non-SIMD `i32`
simd_shuffle2::<_, f32x2>(x, x, [0; 2]);
simd_shuffle2::<_, f32x2>(x, x, IDX2);
//~^ ERROR element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32`
simd_shuffle4::<_, f32x4>(x, x, [0; 4]);
simd_shuffle4::<_, f32x4>(x, x, IDX4);
//~^ ERROR element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32`
simd_shuffle8::<_, f32x8>(x, x, [0; 8]);
simd_shuffle8::<_, f32x8>(x, x, IDX8);
//~^ ERROR element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32`
simd_shuffle2::<_, i32x8>(x, x, [0; 2]);
simd_shuffle2::<_, i32x8>(x, x, IDX2);
//~^ ERROR expected return type of length 2, found `i32x8` with length 8
simd_shuffle4::<_, i32x8>(x, x, [0; 4]);
simd_shuffle4::<_, i32x8>(x, x, IDX4);
//~^ ERROR expected return type of length 4, found `i32x8` with length 8
simd_shuffle8::<_, i32x2>(x, x, [0; 8]);
simd_shuffle8::<_, i32x2>(x, x, IDX8);
//~^ ERROR expected return type of length 8, found `i32x2` with length 2
}
}

View File

@ -17,58 +17,58 @@ LL | simd_extract::<_, f32>(x, 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected SIMD input type, found non-SIMD `i32`
--> $DIR/simd-intrinsic-generic-elements.rs:53:9
--> $DIR/simd-intrinsic-generic-elements.rs:54:9
|
LL | simd_shuffle2::<i32, i32>(0, 0, [0; 2]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | simd_shuffle2::<i32, i32>(0, 0, IDX2);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected SIMD input type, found non-SIMD `i32`
--> $DIR/simd-intrinsic-generic-elements.rs:55:9
|
LL | simd_shuffle4::<i32, i32>(0, 0, [0; 4]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected SIMD input type, found non-SIMD `i32`
--> $DIR/simd-intrinsic-generic-elements.rs:57:9
|
LL | simd_shuffle8::<i32, i32>(0, 0, [0; 8]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | simd_shuffle4::<i32, i32>(0, 0, IDX4);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32`
error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected SIMD input type, found non-SIMD `i32`
--> $DIR/simd-intrinsic-generic-elements.rs:60:9
|
LL | simd_shuffle2::<_, f32x2>(x, x, [0; 2]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | simd_shuffle8::<i32, i32>(0, 0, IDX8);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32`
--> $DIR/simd-intrinsic-generic-elements.rs:63:9
|
LL | simd_shuffle2::<_, f32x2>(x, x, IDX2);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32`
--> $DIR/simd-intrinsic-generic-elements.rs:62:9
--> $DIR/simd-intrinsic-generic-elements.rs:65:9
|
LL | simd_shuffle4::<_, f32x4>(x, x, [0; 4]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | simd_shuffle4::<_, f32x4>(x, x, IDX4);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32`
--> $DIR/simd-intrinsic-generic-elements.rs:64:9
|
LL | simd_shuffle8::<_, f32x8>(x, x, [0; 8]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected return type of length 2, found `i32x8` with length 8
--> $DIR/simd-intrinsic-generic-elements.rs:67:9
|
LL | simd_shuffle2::<_, i32x8>(x, x, [0; 2]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | simd_shuffle8::<_, f32x8>(x, x, IDX8);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected return type of length 2, found `i32x8` with length 8
--> $DIR/simd-intrinsic-generic-elements.rs:70:9
|
LL | simd_shuffle2::<_, i32x8>(x, x, IDX2);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected return type of length 4, found `i32x8` with length 8
--> $DIR/simd-intrinsic-generic-elements.rs:69:9
--> $DIR/simd-intrinsic-generic-elements.rs:72:9
|
LL | simd_shuffle4::<_, i32x8>(x, x, [0; 4]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | simd_shuffle4::<_, i32x8>(x, x, IDX4);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected return type of length 8, found `i32x2` with length 2
--> $DIR/simd-intrinsic-generic-elements.rs:71:9
--> $DIR/simd-intrinsic-generic-elements.rs:74:9
|
LL | simd_shuffle8::<_, i32x2>(x, x, [0; 8]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | simd_shuffle8::<_, i32x2>(x, x, IDX8);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 12 previous errors

View File

@ -21,5 +21,6 @@ fn main() {
#[inline(always)]
unsafe fn inline_me() -> Simd2 {
simd_shuffle2(Simd2(10, 11), Simd2(12, 13), [0, 3])
const IDX: [u32; 2] = [0, 3];
simd_shuffle2(Simd2(10, 11), Simd2(12, 13), IDX)
}

View File

@ -15,7 +15,8 @@ struct Simd2(u8, u8);
fn main() {
unsafe {
let p_res: Simd2 = simd_shuffle2(Simd2(10, 11), Simd2(12, 13), [0, 1]);
const IDX: [u32; 2] = [0, 1];
let p_res: Simd2 = simd_shuffle2(Simd2(10, 11), Simd2(12, 13), IDX);
let a_res: Simd2 = inline_me();
assert_10_11(p_res);
@ -36,5 +37,6 @@ fn assert_10_13(x: Simd2) {
#[inline(always)]
unsafe fn inline_me() -> Simd2 {
simd_shuffle2(Simd2(10, 11), Simd2(12, 13), [0, 3])
const IDX: [u32; 2] = [0, 3];
simd_shuffle2(Simd2(10, 11), Simd2(12, 13), IDX)
}

View File

@ -2,6 +2,8 @@
// ignore-emscripten FIXME(#45351) hits an LLVM assert
#![feature(repr_simd, platform_intrinsics)]
#![allow(incomplete_features)]
#![feature(inline_const)]
#[repr(simd)]
#[derive(Copy, Clone, Debug, PartialEq)]
@ -82,19 +84,19 @@ fn main() {
let y4 = i32x4(140, 141, 142, 143);
let y8 = i32x8(180, 181, 182, 183, 184, 185, 186, 187);
unsafe {
all_eq!(simd_shuffle2(x2, y2, [3, 0]), i32x2(121, 20));
all_eq!(simd_shuffle4(x2, y2, [3, 0, 1, 2]), i32x4(121, 20, 21, 120));
all_eq!(simd_shuffle8(x2, y2, [3, 0, 1, 2, 1, 2, 3, 0]),
all_eq!(simd_shuffle2(x2, y2, const { [3u32, 0] }), i32x2(121, 20));
all_eq!(simd_shuffle4(x2, y2, const { [3u32, 0, 1, 2] }), i32x4(121, 20, 21, 120));
all_eq!(simd_shuffle8(x2, y2, const { [3u32, 0, 1, 2, 1, 2, 3, 0] }),
i32x8(121, 20, 21, 120, 21, 120, 121, 20));
all_eq!(simd_shuffle2(x4, y4, [7, 2]), i32x2(143, 42));
all_eq!(simd_shuffle4(x4, y4, [7, 2, 5, 0]), i32x4(143, 42, 141, 40));
all_eq!(simd_shuffle8(x4, y4, [7, 2, 5, 0, 3, 6, 4, 1]),
all_eq!(simd_shuffle2(x4, y4, const { [7u32, 2] }), i32x2(143, 42));
all_eq!(simd_shuffle4(x4, y4, const { [7u32, 2, 5, 0] }), i32x4(143, 42, 141, 40));
all_eq!(simd_shuffle8(x4, y4, const { [7u32, 2, 5, 0, 3, 6, 4, 1] }),
i32x8(143, 42, 141, 40, 43, 142, 140, 41));
all_eq!(simd_shuffle2(x8, y8, [11, 5]), i32x2(183, 85));
all_eq!(simd_shuffle4(x8, y8, [11, 5, 15, 0]), i32x4(183, 85, 187, 80));
all_eq!(simd_shuffle8(x8, y8, [11, 5, 15, 0, 3, 8, 12, 1]),
all_eq!(simd_shuffle2(x8, y8, const { [11u32, 5] }), i32x2(183, 85));
all_eq!(simd_shuffle4(x8, y8, const { [11u32, 5, 15, 0] }), i32x4(183, 85, 187, 80));
all_eq!(simd_shuffle8(x8, y8, const { [11u32, 5, 15, 0, 3, 8, 12, 1] }),
i32x8(183, 85, 187, 80, 83, 180, 184, 81));
}