Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 20432c9

Browse files
author
Jesus Checa Hidalgo
committedMar 19, 2025
Use explicit cpu in some asm and codegen tests.
Some tests expect to be compiled for a specific CPU or require certain target features to be present (or absent). These tests work fine with default CPUs but fail in downstream builds for RHEL and Fedora, where we use non-default CPUs such as z13 on s390x, pwr9 on ppc64le, or x86-64-v2/x86-64-v3 on x86_64.
1 parent a7fc463 commit 20432c9

7 files changed

+29
-28
lines changed
 

‎tests/assembly/powerpc64-struct-abi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//@[elfv1-be] needs-llvm-components: powerpc
77
//@[elfv2-be] compile-flags: --target powerpc64-unknown-linux-musl
88
//@[elfv2-be] needs-llvm-components: powerpc
9-
//@[elfv2-le] compile-flags: --target powerpc64le-unknown-linux-gnu
9+
//@[elfv2-le] compile-flags: --target powerpc64le-unknown-linux-gnu -C target-cpu=pwr8
1010
//@[elfv2-le] needs-llvm-components: powerpc
1111
//@[aix] compile-flags: --target powerpc64-ibm-aix
1212
//@[aix] needs-llvm-components: powerpc

‎tests/assembly/s390x-vector-abi.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// ignore-tidy-linelength
33
//@ assembly-output: emit-asm
44
//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
5-
//@[z10] compile-flags: --target s390x-unknown-linux-gnu --cfg no_vector
5+
//@[z10] compile-flags: --target s390x-unknown-linux-gnu -C target-cpu=z10 --cfg no_vector
66
//@[z10] needs-llvm-components: systemz
7-
//@[z10_vector] compile-flags: --target s390x-unknown-linux-gnu -C target-feature=+vector
7+
//@[z10_vector] compile-flags: --target s390x-unknown-linux-gnu -C target-cpu=z10 -C target-feature=+vector
88
//@[z10_vector] needs-llvm-components: systemz
99
//@[z13] compile-flags: --target s390x-unknown-linux-gnu -C target-cpu=z13
1010
//@[z13] needs-llvm-components: systemz

‎tests/codegen/asm/s390x-clobbers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ add-core-stubs
22
//@ revisions: s390x
3-
//@[s390x] compile-flags: --target s390x-unknown-linux-gnu
3+
//@[s390x] compile-flags: --target s390x-unknown-linux-gnu -C target-cpu=z10
44
//@[s390x] needs-llvm-components: systemz
55

66
#![crate_type = "rlib"]

‎tests/codegen/slice-is-ascii.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ only-x86_64
2-
//@ compile-flags: -C opt-level=3
2+
//@ compile-flags: -C opt-level=3 -C target-cpu=x86-64
33
#![crate_type = "lib"]
44

55
/// Check that the fast-path of `is_ascii` uses a `pmovmskb` instruction.

‎tests/ui/abi/simd-abi-checks-avx.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@ only-x86_64
22
//@ build-pass
33
//@ ignore-pass (test emits codegen-time warnings)
4+
//@ compile-flags: -C target-feature=-avx
45

56
#![feature(avx512_target_feature)]
67
#![feature(portable_simd)]

‎tests/ui/abi/simd-abi-checks-avx.stderr

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
2-
--> $DIR/simd-abi-checks-avx.rs:64:11
2+
--> $DIR/simd-abi-checks-avx.rs:65:11
33
|
44
LL | f(g());
55
| ^^^ function called here
@@ -10,7 +10,7 @@ LL | f(g());
1010
= note: `#[warn(abi_unsupported_vector_types)]` on by default
1111

1212
warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
13-
--> $DIR/simd-abi-checks-avx.rs:64:9
13+
--> $DIR/simd-abi-checks-avx.rs:65:9
1414
|
1515
LL | f(g());
1616
| ^^^^^^ function called here
@@ -20,7 +20,7 @@ LL | f(g());
2020
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
2121

2222
warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
23-
--> $DIR/simd-abi-checks-avx.rs:72:14
23+
--> $DIR/simd-abi-checks-avx.rs:73:14
2424
|
2525
LL | gavx(favx());
2626
| ^^^^^^ function called here
@@ -30,7 +30,7 @@ LL | gavx(favx());
3030
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
3131

3232
warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
33-
--> $DIR/simd-abi-checks-avx.rs:72:9
33+
--> $DIR/simd-abi-checks-avx.rs:73:9
3434
|
3535
LL | gavx(favx());
3636
| ^^^^^^^^^^^^ function called here
@@ -40,7 +40,7 @@ LL | gavx(favx());
4040
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
4141

4242
warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
43-
--> $DIR/simd-abi-checks-avx.rs:84:19
43+
--> $DIR/simd-abi-checks-avx.rs:85:19
4444
|
4545
LL | w(Wrapper(g()));
4646
| ^^^ function called here
@@ -50,7 +50,7 @@ LL | w(Wrapper(g()));
5050
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
5151

5252
warning: this function call uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
53-
--> $DIR/simd-abi-checks-avx.rs:84:9
53+
--> $DIR/simd-abi-checks-avx.rs:85:9
5454
|
5555
LL | w(Wrapper(g()));
5656
| ^^^^^^^^^^^^^^^ function called here
@@ -60,7 +60,7 @@ LL | w(Wrapper(g()));
6060
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
6161

6262
warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
63-
--> $DIR/simd-abi-checks-avx.rs:100:9
63+
--> $DIR/simd-abi-checks-avx.rs:101:9
6464
|
6565
LL | some_extern();
6666
| ^^^^^^^^^^^^^ function called here
@@ -70,7 +70,7 @@ LL | some_extern();
7070
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
7171

7272
warning: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
73-
--> $DIR/simd-abi-checks-avx.rs:27:1
73+
--> $DIR/simd-abi-checks-avx.rs:28:1
7474
|
7575
LL | unsafe extern "C" fn g() -> __m256 {
7676
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
@@ -80,7 +80,7 @@ LL | unsafe extern "C" fn g() -> __m256 {
8080
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
8181

8282
warning: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
83-
--> $DIR/simd-abi-checks-avx.rs:21:1
83+
--> $DIR/simd-abi-checks-avx.rs:22:1
8484
|
8585
LL | unsafe extern "C" fn f(_: __m256) {
8686
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
@@ -90,7 +90,7 @@ LL | unsafe extern "C" fn f(_: __m256) {
9090
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
9191

9292
warning: this function definition uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
93-
--> $DIR/simd-abi-checks-avx.rs:15:1
93+
--> $DIR/simd-abi-checks-avx.rs:16:1
9494
|
9595
LL | unsafe extern "C" fn w(_: Wrapper) {
9696
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
@@ -100,7 +100,7 @@ LL | unsafe extern "C" fn w(_: Wrapper) {
100100
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
101101

102102
warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
103-
--> $DIR/simd-abi-checks-avx.rs:57:8
103+
--> $DIR/simd-abi-checks-avx.rs:58:8
104104
|
105105
LL | || g()
106106
| ^^^ function called here
@@ -113,7 +113,7 @@ warning: 11 warnings emitted
113113

114114
Future incompatibility report: Future breakage diagnostic:
115115
warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
116-
--> $DIR/simd-abi-checks-avx.rs:64:11
116+
--> $DIR/simd-abi-checks-avx.rs:65:11
117117
|
118118
LL | f(g());
119119
| ^^^ function called here
@@ -125,7 +125,7 @@ LL | f(g());
125125

126126
Future breakage diagnostic:
127127
warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
128-
--> $DIR/simd-abi-checks-avx.rs:64:9
128+
--> $DIR/simd-abi-checks-avx.rs:65:9
129129
|
130130
LL | f(g());
131131
| ^^^^^^ function called here
@@ -137,7 +137,7 @@ LL | f(g());
137137

138138
Future breakage diagnostic:
139139
warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
140-
--> $DIR/simd-abi-checks-avx.rs:72:14
140+
--> $DIR/simd-abi-checks-avx.rs:73:14
141141
|
142142
LL | gavx(favx());
143143
| ^^^^^^ function called here
@@ -149,7 +149,7 @@ LL | gavx(favx());
149149

150150
Future breakage diagnostic:
151151
warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
152-
--> $DIR/simd-abi-checks-avx.rs:72:9
152+
--> $DIR/simd-abi-checks-avx.rs:73:9
153153
|
154154
LL | gavx(favx());
155155
| ^^^^^^^^^^^^ function called here
@@ -161,7 +161,7 @@ LL | gavx(favx());
161161

162162
Future breakage diagnostic:
163163
warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
164-
--> $DIR/simd-abi-checks-avx.rs:84:19
164+
--> $DIR/simd-abi-checks-avx.rs:85:19
165165
|
166166
LL | w(Wrapper(g()));
167167
| ^^^ function called here
@@ -173,7 +173,7 @@ LL | w(Wrapper(g()));
173173

174174
Future breakage diagnostic:
175175
warning: this function call uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
176-
--> $DIR/simd-abi-checks-avx.rs:84:9
176+
--> $DIR/simd-abi-checks-avx.rs:85:9
177177
|
178178
LL | w(Wrapper(g()));
179179
| ^^^^^^^^^^^^^^^ function called here
@@ -185,7 +185,7 @@ LL | w(Wrapper(g()));
185185

186186
Future breakage diagnostic:
187187
warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
188-
--> $DIR/simd-abi-checks-avx.rs:100:9
188+
--> $DIR/simd-abi-checks-avx.rs:101:9
189189
|
190190
LL | some_extern();
191191
| ^^^^^^^^^^^^^ function called here
@@ -197,7 +197,7 @@ LL | some_extern();
197197

198198
Future breakage diagnostic:
199199
warning: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
200-
--> $DIR/simd-abi-checks-avx.rs:27:1
200+
--> $DIR/simd-abi-checks-avx.rs:28:1
201201
|
202202
LL | unsafe extern "C" fn g() -> __m256 {
203203
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
@@ -209,7 +209,7 @@ LL | unsafe extern "C" fn g() -> __m256 {
209209

210210
Future breakage diagnostic:
211211
warning: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
212-
--> $DIR/simd-abi-checks-avx.rs:21:1
212+
--> $DIR/simd-abi-checks-avx.rs:22:1
213213
|
214214
LL | unsafe extern "C" fn f(_: __m256) {
215215
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
@@ -221,7 +221,7 @@ LL | unsafe extern "C" fn f(_: __m256) {
221221

222222
Future breakage diagnostic:
223223
warning: this function definition uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
224-
--> $DIR/simd-abi-checks-avx.rs:15:1
224+
--> $DIR/simd-abi-checks-avx.rs:16:1
225225
|
226226
LL | unsafe extern "C" fn w(_: Wrapper) {
227227
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
@@ -233,7 +233,7 @@ LL | unsafe extern "C" fn w(_: Wrapper) {
233233

234234
Future breakage diagnostic:
235235
warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
236-
--> $DIR/simd-abi-checks-avx.rs:57:8
236+
--> $DIR/simd-abi-checks-avx.rs:58:8
237237
|
238238
LL | || g()
239239
| ^^^ function called here

‎tests/ui/abi/simd-abi-checks-s390x.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@ add-core-stubs
22
//@ revisions: z10 z13_no_vector z13_soft_float
33
//@ build-fail
4-
//@[z10] compile-flags: --target s390x-unknown-linux-gnu
4+
//@[z10] compile-flags: --target s390x-unknown-linux-gnu -C target-cpu=z10
55
//@[z10] needs-llvm-components: systemz
66
//@[z13_no_vector] compile-flags: --target s390x-unknown-linux-gnu -C target-cpu=z13 -C target-feature=-vector
77
//@[z13_no_vector] needs-llvm-components: systemz

0 commit comments

Comments
 (0)
Failed to load comments.