Skip to content

Commit 3bf5575

Browse files
committed
Auto merge of #89541 - workingjubilee:abbrev-shufvec-t, r=Mark-Simulacrum
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.
2 parents 41dfaaa + 2a7b511 commit 3bf5575

File tree

58 files changed

+205
-358
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+205
-358
lines changed

src/test/ui/simd-intrinsic/simd-intrinsic-generic-bitmask.rs

-92
This file was deleted.

src/test/ui/simd/simd-array-trait.stderr renamed to src/test/ui/simd/array-trait.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: unconstrained generic constant
2-
--> $DIR/simd-array-trait.rs:23:23
2+
--> $DIR/array-trait.rs:23:23
33
|
44
LL | pub struct T<S: Simd>([S::Lane; S::SIZE]);
55
| ^^^^^^^^^^^^^^^^^^
File renamed without changes.
File renamed without changes.

src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.stderr renamed to src/test/ui/simd/intrinsic/generic-arithmetic-2.stderr

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,89 @@
11
error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `i32`
2-
--> $DIR/simd-intrinsic-generic-arithmetic.rs:69:9
2+
--> $DIR/generic-arithmetic-2.rs:69:9
33
|
44
LL | simd_add(0, 0);
55
| ^^^^^^^^^^^^^^
66

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

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

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

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

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

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

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

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

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

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

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

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

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

8585
error[E0511]: invalid monomorphization of `simd_xor` intrinsic: unsupported operation on `f32x4` with element `f32`
86-
--> $DIR/simd-intrinsic-generic-arithmetic.rs:100:9
86+
--> $DIR/generic-arithmetic-2.rs:100:9
8787
|
8888
LL | simd_xor(z, z);
8989
| ^^^^^^^^^^^^^^

src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.stderr renamed to src/test/ui/simd/intrinsic/generic-arithmetic-saturating-2.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
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
2-
--> $DIR/simd-intrinsic-generic-arithmetic-saturating.rs:33:9
2+
--> $DIR/generic-arithmetic-saturating-2.rs:33:9
33
|
44
LL | simd_saturating_add(z, z);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^
66

77
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
8-
--> $DIR/simd-intrinsic-generic-arithmetic-saturating.rs:35:9
8+
--> $DIR/generic-arithmetic-saturating-2.rs:35:9
99
|
1010
LL | simd_saturating_sub(z, z);
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// build-fail
2+
3+
// Test that the simd_bitmask intrinsic produces ok-ish error
4+
// messages when misused.
5+
6+
#![feature(repr_simd, platform_intrinsics)]
7+
#![allow(non_camel_case_types)]
8+
9+
#[repr(simd)]
10+
#[derive(Copy, Clone)]
11+
pub struct u32x2([u32; 2]);
12+
13+
#[repr(simd)]
14+
#[derive(Copy, Clone)]
15+
pub struct u32x4([u32; 4]);
16+
17+
#[repr(simd)]
18+
#[derive(Copy, Clone)]
19+
struct u8x8([u8; 8]);
20+
21+
#[repr(simd)]
22+
#[derive(Copy, Clone)]
23+
struct u8x16([u8; 16]);
24+
25+
#[repr(simd)]
26+
#[derive(Copy, Clone)]
27+
struct u8x32([u8; 32]);
28+
29+
#[repr(simd)]
30+
#[derive(Copy, Clone)]
31+
struct u8x64([u8; 64]);
32+
33+
extern "platform-intrinsic" {
34+
fn simd_bitmask<T, U>(x: T) -> U;
35+
}
36+
37+
fn main() {
38+
let m2 = u32x2([0; 2]);
39+
let m4 = u32x4([0; 4]);
40+
let m8 = u8x8([0; 8]);
41+
let m16 = u8x16([0; 16]);
42+
let m32 = u8x32([0; 32]);
43+
let m64 = u8x64([0; 64]);
44+
45+
unsafe {
46+
let _: u8 = simd_bitmask(m2);
47+
let _: u8 = simd_bitmask(m4);
48+
let _: u8 = simd_bitmask(m8);
49+
let _: u16 = simd_bitmask(m16);
50+
let _: u32 = simd_bitmask(m32);
51+
let _: u64 = simd_bitmask(m64);
52+
53+
let _: u16 = simd_bitmask(m2);
54+
//~^ ERROR bitmask `u16`, expected `u8`
55+
56+
let _: u16 = simd_bitmask(m8);
57+
//~^ ERROR bitmask `u16`, expected `u8`
58+
59+
let _: u32 = simd_bitmask(m16);
60+
//~^ ERROR bitmask `u32`, expected `u16`
61+
62+
let _: u64 = simd_bitmask(m32);
63+
//~^ ERROR bitmask `u64`, expected `u32`
64+
65+
let _: u128 = simd_bitmask(m64);
66+
//~^ ERROR bitmask `u128`, expected `u64`
67+
68+
}
69+
}

src/test/ui/simd-intrinsic/simd-intrinsic-generic-bitmask.stderr renamed to src/test/ui/simd/intrinsic/generic-bitmask.stderr

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

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

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

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

2525
error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: bitmask `u128`, expected `u64`
26-
--> $DIR/simd-intrinsic-generic-bitmask.rs:88:23
26+
--> $DIR/generic-bitmask.rs:65:23
2727
|
2828
LL | let _: u128 = simd_bitmask(m64);
2929
| ^^^^^^^^^^^^^^^^^

src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.stderr renamed to src/test/ui/simd/intrinsic/generic-cast.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD input type, found non-SIMD `i32`
2-
--> $DIR/simd-intrinsic-generic-cast.rs:34:9
2+
--> $DIR/generic-cast.rs:34:9
33
|
44
LL | simd_cast::<i32, i32>(0);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^
66

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

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

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

0 commit comments

Comments
 (0)