Skip to content

Commit 1b79bb9

Browse files
committed
Add inline comments why we're forcing the target cpu
1 parent 706f06c commit 1b79bb9

9 files changed

+25
-19
lines changed

tests/assembly/simd-intrinsic-mask-reduce.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// verify that simd mask reductions do not introduce additional bit shift operations
22
//@ revisions: x86 aarch64
33
//@ [x86] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel
4+
// Set the base cpu explicitly, in case the default has been changed.
45
//@ [x86] compile-flags: -C target-cpu=x86-64
56
//@ [x86] needs-llvm-components: x86
67
//@ [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu

tests/assembly/x86_64-floating-point-clamp.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// so check to make sure that's what it's actually emitting.
33

44
//@ assembly-output: emit-asm
5+
// Set the base cpu explicitly, in case the default has been changed.
56
//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel -C target-cpu=x86-64
67
//@ only-x86_64
78
//@ ignore-sgx

tests/codegen/target-feature-inline-closure.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@ only-x86_64
2+
// Set the base cpu explicitly, in case the default has been changed.
23
//@ compile-flags: -Copt-level=3 -Ctarget-cpu=x86-64
34

45
#![crate_type = "lib"]

tests/ui/asm/x86_64/target-feature-attr.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@ only-x86_64
2+
// Set the base cpu explicitly, in case the default has been changed.
23
//@ compile-flags: -C target-cpu=x86-64
34

45
#![feature(avx512_target_feature)]

tests/ui/asm/x86_64/target-feature-attr.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
error: register class `ymm_reg` requires the `avx` target feature
2-
--> $DIR/target-feature-attr.rs:19:40
2+
--> $DIR/target-feature-attr.rs:20:40
33
|
44
LL | asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x);
55
| ^^^^^^^^^^^^^
66

77
error: register class `ymm_reg` requires the `avx` target feature
8-
--> $DIR/target-feature-attr.rs:19:55
8+
--> $DIR/target-feature-attr.rs:20:55
99
|
1010
LL | asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x);
1111
| ^^^^^^^^^^^^^
1212

1313
error: register class `ymm_reg` requires the `avx` target feature
14-
--> $DIR/target-feature-attr.rs:19:70
14+
--> $DIR/target-feature-attr.rs:20:70
1515
|
1616
LL | asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x);
1717
| ^^^^^^^^^^^^^^^^^^
1818

1919
error: register class `kreg` requires at least one of the following target features: avx512bw, avx512f
20-
--> $DIR/target-feature-attr.rs:34:23
20+
--> $DIR/target-feature-attr.rs:35:23
2121
|
2222
LL | asm!("/* {0} */", in(kreg) x);
2323
| ^^^^^^^^^^

tests/ui/consts/const-eval/const_fn_target_feature.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@ only-x86_64
2+
// Set the base cpu explicitly, in case the default has been changed.
23
//@ compile-flags: -C target-cpu=x86-64 -C target-feature=+ssse3
34

45
#![crate_type = "lib"]

tests/ui/consts/const-eval/const_fn_target_feature.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0080]: evaluation of constant value failed
2-
--> $DIR/const_fn_target_feature.rs:10:24
2+
--> $DIR/const_fn_target_feature.rs:11:24
33
|
44
LL | const B: () = unsafe { avx2_fn() };
55
| ^^^^^^^^^ calling a function that requires unavailable target features: avx2

tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@ only-x86_64
2+
// Set the base cpu explicitly, in case the default has been changed.
23
//@ compile-flags: -C target-cpu=x86-64
34

45
#![feature(target_feature_11)]

tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
2-
--> $DIR/safe-calls.rs:26:5
2+
--> $DIR/safe-calls.rs:27:5
33
|
44
LL | sse2();
55
| ^^^^^^ call to function with `#[target_feature]`
@@ -8,39 +8,39 @@ LL | sse2();
88
= note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
99

1010
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
11-
--> $DIR/safe-calls.rs:28:5
11+
--> $DIR/safe-calls.rs:29:5
1212
|
1313
LL | avx_bmi2();
1414
| ^^^^^^^^^^ call to function with `#[target_feature]`
1515
|
1616
= help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
1717

1818
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
19-
--> $DIR/safe-calls.rs:30:5
19+
--> $DIR/safe-calls.rs:31:5
2020
|
2121
LL | Quux.avx_bmi2();
2222
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
2323
|
2424
= help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
2525

2626
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
27-
--> $DIR/safe-calls.rs:36:5
27+
--> $DIR/safe-calls.rs:37:5
2828
|
2929
LL | avx_bmi2();
3030
| ^^^^^^^^^^ call to function with `#[target_feature]`
3131
|
3232
= help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
3333

3434
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
35-
--> $DIR/safe-calls.rs:38:5
35+
--> $DIR/safe-calls.rs:39:5
3636
|
3737
LL | Quux.avx_bmi2();
3838
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
3939
|
4040
= help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
4141

4242
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
43-
--> $DIR/safe-calls.rs:44:5
43+
--> $DIR/safe-calls.rs:45:5
4444
|
4545
LL | sse2();
4646
| ^^^^^^ call to function with `#[target_feature]`
@@ -49,23 +49,23 @@ LL | sse2();
4949
= note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
5050

5151
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
52-
--> $DIR/safe-calls.rs:46:5
52+
--> $DIR/safe-calls.rs:47:5
5353
|
5454
LL | avx_bmi2();
5555
| ^^^^^^^^^^ call to function with `#[target_feature]`
5656
|
5757
= help: in order for the call to be safe, the context requires the following additional target feature: bmi2
5858

5959
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
60-
--> $DIR/safe-calls.rs:48:5
60+
--> $DIR/safe-calls.rs:49:5
6161
|
6262
LL | Quux.avx_bmi2();
6363
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
6464
|
6565
= help: in order for the call to be safe, the context requires the following additional target feature: bmi2
6666

6767
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
68-
--> $DIR/safe-calls.rs:55:5
68+
--> $DIR/safe-calls.rs:56:5
6969
|
7070
LL | sse2();
7171
| ^^^^^^ call to function with `#[target_feature]`
@@ -74,7 +74,7 @@ LL | sse2();
7474
= note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
7575

7676
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
77-
--> $DIR/safe-calls.rs:59:15
77+
--> $DIR/safe-calls.rs:60:15
7878
|
7979
LL | const _: () = sse2();
8080
| ^^^^^^ call to function with `#[target_feature]`
@@ -83,7 +83,7 @@ LL | const _: () = sse2();
8383
= note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
8484

8585
error[E0133]: call to function `sse2_and_fxsr` with `#[target_feature]` is unsafe and requires unsafe function or block
86-
--> $DIR/safe-calls.rs:62:15
86+
--> $DIR/safe-calls.rs:63:15
8787
|
8888
LL | const _: () = sse2_and_fxsr();
8989
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
@@ -92,7 +92,7 @@ LL | const _: () = sse2_and_fxsr();
9292
= note: the fxsr and sse2 target features being enabled in the build configuration does not remove the requirement to list them in `#[target_feature]`
9393

9494
error: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe block (error E0133)
95-
--> $DIR/safe-calls.rs:69:5
95+
--> $DIR/safe-calls.rs:70:5
9696
|
9797
LL | sse2();
9898
| ^^^^^^ call to function with `#[target_feature]`
@@ -101,12 +101,12 @@ LL | sse2();
101101
= help: in order for the call to be safe, the context requires the following additional target feature: sse2
102102
= note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
103103
note: an unsafe function restricts its caller, but its body is safe by default
104-
--> $DIR/safe-calls.rs:68:1
104+
--> $DIR/safe-calls.rs:69:1
105105
|
106106
LL | unsafe fn needs_unsafe_block() {
107107
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
108108
note: the lint level is defined here
109-
--> $DIR/safe-calls.rs:65:8
109+
--> $DIR/safe-calls.rs:66:8
110110
|
111111
LL | #[deny(unsafe_op_in_unsafe_fn)]
112112
| ^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)