Skip to content

Commit

Permalink
Auto merge of #89541 - workingjubilee:abbrev-shufvec-t, r=Mark-Simula…
Browse files Browse the repository at this point in the history
…crum

Cleanup src/test/ui/{simd,simd-intrinsic}

Initial motivation was to simplify a huge macro expansion using a tuple, since we can just use an array in `#[repr(simd)]` now for the same result. But also, several tests were going unnoticed during development of SIMD intrinsics because people kept looking in the wrong directory, and many are basically run-pass vs. build-fail versions of the same tests, so let's keep them close together and simplify their names, so they're easier to sift through.
  • Loading branch information
bors committed Oct 10, 2021
2 parents 41dfaaa + 2a7b511 commit 3bf5575
Show file tree
Hide file tree
Showing 58 changed files with 205 additions and 358 deletions.
92 changes: 0 additions & 92 deletions src/test/ui/simd-intrinsic/simd-intrinsic-generic-bitmask.rs

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: unconstrained generic constant
--> $DIR/simd-array-trait.rs:23:23
--> $DIR/array-trait.rs:23:23
|
LL | pub struct T<S: Simd>([S::Lane; S::SIZE]);
| ^^^^^^^^^^^^^^^^^^
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,89 +1,89 @@
error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `i32`
--> $DIR/simd-intrinsic-generic-arithmetic.rs:69:9
--> $DIR/generic-arithmetic-2.rs:69:9
|
LL | simd_add(0, 0);
| ^^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_sub` intrinsic: expected SIMD input type, found non-SIMD `i32`
--> $DIR/simd-intrinsic-generic-arithmetic.rs:71:9
--> $DIR/generic-arithmetic-2.rs:71:9
|
LL | simd_sub(0, 0);
| ^^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_mul` intrinsic: expected SIMD input type, found non-SIMD `i32`
--> $DIR/simd-intrinsic-generic-arithmetic.rs:73:9
--> $DIR/generic-arithmetic-2.rs:73:9
|
LL | simd_mul(0, 0);
| ^^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_div` intrinsic: expected SIMD input type, found non-SIMD `i32`
--> $DIR/simd-intrinsic-generic-arithmetic.rs:75:9
--> $DIR/generic-arithmetic-2.rs:75:9
|
LL | simd_div(0, 0);
| ^^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_shl` intrinsic: expected SIMD input type, found non-SIMD `i32`
--> $DIR/simd-intrinsic-generic-arithmetic.rs:77:9
--> $DIR/generic-arithmetic-2.rs:77:9
|
LL | simd_shl(0, 0);
| ^^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_shr` intrinsic: expected SIMD input type, found non-SIMD `i32`
--> $DIR/simd-intrinsic-generic-arithmetic.rs:79:9
--> $DIR/generic-arithmetic-2.rs:79:9
|
LL | simd_shr(0, 0);
| ^^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_and` intrinsic: expected SIMD input type, found non-SIMD `i32`
--> $DIR/simd-intrinsic-generic-arithmetic.rs:81:9
--> $DIR/generic-arithmetic-2.rs:81:9
|
LL | simd_and(0, 0);
| ^^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_or` intrinsic: expected SIMD input type, found non-SIMD `i32`
--> $DIR/simd-intrinsic-generic-arithmetic.rs:83:9
--> $DIR/generic-arithmetic-2.rs:83:9
|
LL | simd_or(0, 0);
| ^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_xor` intrinsic: expected SIMD input type, found non-SIMD `i32`
--> $DIR/simd-intrinsic-generic-arithmetic.rs:85:9
--> $DIR/generic-arithmetic-2.rs:85:9
|
LL | simd_xor(0, 0);
| ^^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_neg` intrinsic: expected SIMD input type, found non-SIMD `i32`
--> $DIR/simd-intrinsic-generic-arithmetic.rs:88:9
--> $DIR/generic-arithmetic-2.rs:88:9
|
LL | simd_neg(0);
| ^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_shl` intrinsic: unsupported operation on `f32x4` with element `f32`
--> $DIR/simd-intrinsic-generic-arithmetic.rs:92:9
--> $DIR/generic-arithmetic-2.rs:92:9
|
LL | simd_shl(z, z);
| ^^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_shr` intrinsic: unsupported operation on `f32x4` with element `f32`
--> $DIR/simd-intrinsic-generic-arithmetic.rs:94:9
--> $DIR/generic-arithmetic-2.rs:94:9
|
LL | simd_shr(z, z);
| ^^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_and` intrinsic: unsupported operation on `f32x4` with element `f32`
--> $DIR/simd-intrinsic-generic-arithmetic.rs:96:9
--> $DIR/generic-arithmetic-2.rs:96:9
|
LL | simd_and(z, z);
| ^^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_or` intrinsic: unsupported operation on `f32x4` with element `f32`
--> $DIR/simd-intrinsic-generic-arithmetic.rs:98:9
--> $DIR/generic-arithmetic-2.rs:98:9
|
LL | simd_or(z, z);
| ^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_xor` intrinsic: unsupported operation on `f32x4` with element `f32`
--> $DIR/simd-intrinsic-generic-arithmetic.rs:100:9
--> $DIR/generic-arithmetic-2.rs:100:9
|
LL | simd_xor(z, z);
| ^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error[E0511]: invalid monomorphization of `simd_saturating_add` intrinsic: expected element type `f32` of vector type `f32x4` to be a signed or unsigned integer type
--> $DIR/simd-intrinsic-generic-arithmetic-saturating.rs:33:9
--> $DIR/generic-arithmetic-saturating-2.rs:33:9
|
LL | simd_saturating_add(z, z);
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_saturating_sub` intrinsic: expected element type `f32` of vector type `f32x4` to be a signed or unsigned integer type
--> $DIR/simd-intrinsic-generic-arithmetic-saturating.rs:35:9
--> $DIR/generic-arithmetic-saturating-2.rs:35:9
|
LL | simd_saturating_sub(z, z);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
69 changes: 69 additions & 0 deletions src/test/ui/simd/intrinsic/generic-bitmask.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// build-fail

// Test that the simd_bitmask intrinsic produces ok-ish error
// messages when misused.

#![feature(repr_simd, platform_intrinsics)]
#![allow(non_camel_case_types)]

#[repr(simd)]
#[derive(Copy, Clone)]
pub struct u32x2([u32; 2]);

#[repr(simd)]
#[derive(Copy, Clone)]
pub struct u32x4([u32; 4]);

#[repr(simd)]
#[derive(Copy, Clone)]
struct u8x8([u8; 8]);

#[repr(simd)]
#[derive(Copy, Clone)]
struct u8x16([u8; 16]);

#[repr(simd)]
#[derive(Copy, Clone)]
struct u8x32([u8; 32]);

#[repr(simd)]
#[derive(Copy, Clone)]
struct u8x64([u8; 64]);

extern "platform-intrinsic" {
fn simd_bitmask<T, U>(x: T) -> U;
}

fn main() {
let m2 = u32x2([0; 2]);
let m4 = u32x4([0; 4]);
let m8 = u8x8([0; 8]);
let m16 = u8x16([0; 16]);
let m32 = u8x32([0; 32]);
let m64 = u8x64([0; 64]);

unsafe {
let _: u8 = simd_bitmask(m2);
let _: u8 = simd_bitmask(m4);
let _: u8 = simd_bitmask(m8);
let _: u16 = simd_bitmask(m16);
let _: u32 = simd_bitmask(m32);
let _: u64 = simd_bitmask(m64);

let _: u16 = simd_bitmask(m2);
//~^ ERROR bitmask `u16`, expected `u8`

let _: u16 = simd_bitmask(m8);
//~^ ERROR bitmask `u16`, expected `u8`

let _: u32 = simd_bitmask(m16);
//~^ ERROR bitmask `u32`, expected `u16`

let _: u64 = simd_bitmask(m32);
//~^ ERROR bitmask `u64`, expected `u32`

let _: u128 = simd_bitmask(m64);
//~^ ERROR bitmask `u128`, expected `u64`

}
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: bitmask `u16`, expected `u8`
--> $DIR/simd-intrinsic-generic-bitmask.rs:76:22
--> $DIR/generic-bitmask.rs:53:22
|
LL | let _: u16 = simd_bitmask(m2);
| ^^^^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: bitmask `u16`, expected `u8`
--> $DIR/simd-intrinsic-generic-bitmask.rs:79:22
--> $DIR/generic-bitmask.rs:56:22
|
LL | let _: u16 = simd_bitmask(m8);
| ^^^^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: bitmask `u32`, expected `u16`
--> $DIR/simd-intrinsic-generic-bitmask.rs:82:22
--> $DIR/generic-bitmask.rs:59:22
|
LL | let _: u32 = simd_bitmask(m16);
| ^^^^^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: bitmask `u64`, expected `u32`
--> $DIR/simd-intrinsic-generic-bitmask.rs:85:22
--> $DIR/generic-bitmask.rs:62:22
|
LL | let _: u64 = simd_bitmask(m32);
| ^^^^^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: bitmask `u128`, expected `u64`
--> $DIR/simd-intrinsic-generic-bitmask.rs:88:23
--> $DIR/generic-bitmask.rs:65:23
|
LL | let _: u128 = simd_bitmask(m64);
| ^^^^^^^^^^^^^^^^^
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD input type, found non-SIMD `i32`
--> $DIR/simd-intrinsic-generic-cast.rs:34:9
--> $DIR/generic-cast.rs:34:9
|
LL | simd_cast::<i32, i32>(0);
| ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD input type, found non-SIMD `i32`
--> $DIR/simd-intrinsic-generic-cast.rs:36:9
--> $DIR/generic-cast.rs:36:9
|
LL | simd_cast::<i32, i32x4>(0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD return type, found non-SIMD `i32`
--> $DIR/simd-intrinsic-generic-cast.rs:38:9
--> $DIR/generic-cast.rs:38:9
|
LL | simd_cast::<i32x4, i32>(x);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i32x8` with length 8
--> $DIR/simd-intrinsic-generic-cast.rs:40:9
--> $DIR/generic-cast.rs:40:9
|
LL | simd_cast::<_, i32x8>(x);
| ^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Loading

0 comments on commit 3bf5575

Please sign in to comment.