Skip to content

Commit cff1a40

Browse files
authored
Unrolled build for rust-lang#136758
Rollup merge of rust-lang#136758 - workingjubilee:specify-opt-level-for-tests, r=saethlin tests: `-Copt-level=3` instead of `-O` in assembly tests An effective blocker for redefining the meaning of `-O` is to stop reusing this somewhat ambiguous alias in our own assembly test suite. The choice between `-Copt-level=2` and `-Copt-level=3` is arbitrary for most of our tests. In most cases it makes no difference, so I set most of them to `-Copt-level=3`, as it will lead to slightly more "normalized" assembly.
2 parents ced8e65 + 833f070 commit cff1a40

27 files changed

+83
-67
lines changed

tests/assembly/asm/aarch64-modifiers.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ add-core-stubs
22
//@ assembly-output: emit-asm
3-
//@ compile-flags: -O -C panic=abort
3+
//@ compile-flags: -Copt-level=3 -C panic=abort
44
//@ compile-flags: --target aarch64-unknown-linux-gnu
55
//@ compile-flags: -Zmerge-functions=disabled
66
//@ needs-llvm-components: aarch64
@@ -15,7 +15,7 @@ use minicore::*;
1515

1616
macro_rules! check {
1717
($func:ident $reg:ident $code:literal) => {
18-
// -O and extern "C" guarantee that the selected register is always r0/s0/d0/q0
18+
// -Copt-level=3 and extern "C" guarantee that the selected register is always r0/s0/d0/q0
1919
#[no_mangle]
2020
pub unsafe extern "C" fn $func() -> i32 {
2121
let y;

tests/assembly/asm/aarch64-outline-atomics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ assembly-output: emit-asm
2-
//@ compile-flags: -O
2+
//@ compile-flags: -Copt-level=3
33
//@ compile-flags: --target aarch64-unknown-linux-gnu
44
//@ needs-llvm-components: aarch64
55
//@ only-aarch64

tests/assembly/asm/arm-modifiers.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ add-core-stubs
22
//@ assembly-output: emit-asm
3-
//@ compile-flags: -O -C panic=abort
3+
//@ compile-flags: -Copt-level=3 -C panic=abort
44
//@ compile-flags: --target armv7-unknown-linux-gnueabihf
55
//@ compile-flags: -C target-feature=+neon
66
//@ compile-flags: -Zmerge-functions=disabled
@@ -21,7 +21,7 @@ impl Copy for f32x4 {}
2121

2222
macro_rules! check {
2323
($func:ident $modifier:literal $reg:ident $ty:ident $mov:literal) => {
24-
// -O and extern "C" guarantee that the selected register is always r0/s0/d0/q0
24+
// -Copt-level=3 and extern "C" guarantee that the selected register is always r0/s0/d0/q0
2525
#[no_mangle]
2626
pub unsafe extern "C" fn $func() -> $ty {
2727
let y;

tests/assembly/asm/x86-modifiers.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@ add-core-stubs
22
//@ revisions: x86_64 i686
33
//@ assembly-output: emit-asm
4-
//@ compile-flags: -O -C panic=abort
4+
//@ compile-flags: -Copt-level=3 -C panic=abort
55
//@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu
66
//@[x86_64] needs-llvm-components: x86
77
//@[i686] compile-flags: --target i686-unknown-linux-gnu
@@ -20,7 +20,7 @@ use minicore::*;
2020

2121
macro_rules! check {
2222
($func:ident $modifier:literal $reg:ident $mov:literal) => {
23-
// -O and extern "C" guarantee that the selected register is always ax/xmm0
23+
// -Copt-level=3 and extern "C" guarantee that the selected register is always ax/xmm0
2424
#[no_mangle]
2525
pub unsafe extern "C" fn $func() -> i32 {
2626
let y;

tests/assembly/libs/issue-115339-zip-arrays.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ assembly-output: emit-asm
22
// # zen3 previously exhibited odd vectorization
3-
//@ compile-flags: --crate-type=lib -Ctarget-cpu=znver3 -O
3+
//@ compile-flags: --crate-type=lib -Ctarget-cpu=znver3 -Copt-level=3
44
//@ only-x86_64
55
//@ ignore-sgx
66

tests/assembly/manual-eq-efficient.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Regression test for #106269
22
//@ assembly-output: emit-asm
3-
//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel
3+
//@ compile-flags: --crate-type=lib -Copt-level=3 -C llvm-args=-x86-asm-syntax=intel
44
//@ only-x86_64
55
//@ ignore-sgx
66

tests/assembly/panic-no-unwind-no-uwtable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ assembly-output: emit-asm
22
//@ only-x86_64-unknown-linux-gnu
3-
//@ compile-flags: -C panic=unwind -C force-unwind-tables=n -O
3+
//@ compile-flags: -C panic=unwind -C force-unwind-tables=n -Copt-level=3
44

55
#![crate_type = "lib"]
66

tests/assembly/powerpc64-struct-abi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ revisions: elfv1-be elfv2-be elfv2-le aix
22
//@ assembly-output: emit-asm
3-
//@ compile-flags: -O
3+
//@ compile-flags: -Copt-level=3
44
//@[elfv1-be] compile-flags: --target powerpc64-unknown-linux-gnu
55
//@[elfv1-be] needs-llvm-components: powerpc
66
//@[elfv2-be] compile-flags: --target powerpc64-unknown-linux-musl

tests/assembly/s390x-backchain-toggle.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ revisions: enable-backchain disable-backchain
22
//@ assembly-output: emit-asm
3-
//@ compile-flags: -O --crate-type=lib --target=s390x-unknown-linux-gnu
3+
//@ compile-flags: -Copt-level=3 --crate-type=lib --target=s390x-unknown-linux-gnu
44
//@ needs-llvm-components: systemz
55
//@[enable-backchain] compile-flags: -Ctarget-feature=+backchain
66
//@[disable-backchain] compile-flags: -Ctarget-feature=-backchain

tests/assembly/s390x-vector-abi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@ revisions: z10 z10_vector z13 z13_no_vector
22
// ignore-tidy-linelength
33
//@ assembly-output: emit-asm
4-
//@ compile-flags: -O -Z merge-functions=disabled
4+
//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
55
//@[z10] compile-flags: --target s390x-unknown-linux-gnu --cfg no_vector
66
//@[z10] needs-llvm-components: systemz
77
//@[z10_vector] compile-flags: --target s390x-unknown-linux-gnu -C target-feature=+vector

tests/assembly/simd-bitmask.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//@ [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu
1111
//@ [aarch64] needs-llvm-components: aarch64
1212
//@ assembly-output: emit-asm
13-
//@ compile-flags: --crate-type=lib -O -C panic=abort
13+
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort
1414

1515
#![feature(no_core, lang_items, repr_simd, intrinsics)]
1616
#![no_core]

tests/assembly/simd-intrinsic-gather.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq
44
//@ [x86-avx512] needs-llvm-components: x86
55
//@ assembly-output: emit-asm
6-
//@ compile-flags: --crate-type=lib -O -C panic=abort
6+
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort
77

88
#![feature(no_core, lang_items, repr_simd, intrinsics)]
99
#![no_core]

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq
77
//@ [x86-avx512] needs-llvm-components: x86
88
//@ assembly-output: emit-asm
9-
//@ compile-flags: --crate-type=lib -O -C panic=abort
9+
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort
1010

1111
#![feature(no_core, lang_items, repr_simd, intrinsics)]
1212
#![no_core]

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//@ [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu
88
//@ [aarch64] needs-llvm-components: aarch64
99
//@ assembly-output: emit-asm
10-
//@ compile-flags: --crate-type=lib -O -C panic=abort
10+
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort
1111

1212
#![feature(no_core, lang_items, repr_simd, intrinsics)]
1313
#![no_core]

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq
77
//@ [x86-avx512] needs-llvm-components: x86
88
//@ assembly-output: emit-asm
9-
//@ compile-flags: --crate-type=lib -O -C panic=abort
9+
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort
1010

1111
#![feature(no_core, lang_items, repr_simd, intrinsics)]
1212
#![no_core]

tests/assembly/simd-intrinsic-scatter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq
44
//@ [x86-avx512] needs-llvm-components: x86
55
//@ assembly-output: emit-asm
6-
//@ compile-flags: --crate-type=lib -O -C panic=abort
6+
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort
77

88
#![feature(no_core, lang_items, repr_simd, intrinsics)]
99
#![no_core]

tests/assembly/simd-intrinsic-select.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//@ [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu
99
//@ [aarch64] needs-llvm-components: aarch64
1010
//@ assembly-output: emit-asm
11-
//@ compile-flags: --crate-type=lib -O -C panic=abort
11+
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort
1212

1313
#![feature(no_core, lang_items, repr_simd, intrinsics)]
1414
#![no_core]

tests/assembly/simd/reduce-fadd-unordered.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@ revisions: x86_64 aarch64
22
//@ assembly-output: emit-asm
3-
//@ compile-flags: --crate-type=lib -O
3+
//@ compile-flags: --crate-type=lib -Copt-level=3
4+
45
//@[aarch64] only-aarch64
56
//@[x86_64] only-x86_64
67
//@[x86_64] compile-flags: -Ctarget-feature=+sse3

tests/assembly/slice-is_ascii.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//@ [WIN] only-windows
33
//@ [LIN] only-linux
44
//@ assembly-output: emit-asm
5-
//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel
5+
//@ compile-flags: --crate-type=lib -Copt-level=3 -C llvm-args=-x86-asm-syntax=intel
66
//@ only-x86_64
77
//@ ignore-sgx
88

tests/assembly/x86-return-float.rs

+26-17
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
//@ assembly-output: emit-asm
2-
//@ only-x86
32
// FIXME(#114479): LLVM miscompiles loading and storing `f32` and `f64` when SSE is disabled.
43
// There's no compiletest directive to ignore a test on i586 only, so just always explicitly enable
54
// SSE2.
65
// Use the same target CPU as `i686` so that LLVM orders the instructions in the same order.
76
//@ compile-flags: -Ctarget-feature=+sse2 -Ctarget-cpu=pentium4
87
// Force frame pointers to make ASM more consistent between targets
9-
//@ compile-flags: -O -C force-frame-pointers
8+
//@ compile-flags: -C force-frame-pointers
9+
// At opt-level=3, LLVM can merge two movss into one movsd, and we aren't testing for that.
10+
//@ compile-flags: -Copt-level=2
1011
//@ filecheck-flags: --implicit-check-not fld --implicit-check-not fst
11-
//@ revisions: normal win
12-
//@[normal] ignore-windows
13-
//@[win] only-windows
12+
//@ revisions: linux win
13+
//@ add-core-stubs
14+
//@[linux] needs-llvm-components: x86
15+
//@[win] needs-llvm-components: x86
16+
//@[linux] compile-flags: --target i686-unknown-linux-gnu
17+
//@[win] compile-flags: --target i686-pc-windows-msvc
1418

1519
#![crate_type = "lib"]
1620
#![feature(f16, f128)]
21+
#![feature(no_core)]
22+
#![no_core]
23+
24+
extern crate minicore;
25+
use minicore::*;
1726

1827
// Tests that returning `f32` and `f64` with the "Rust" ABI on 32-bit x86 doesn't use the x87
1928
// floating point stack, as loading and storing `f32`s and `f64`s to and from the x87 stack quietens
@@ -190,8 +199,8 @@ pub unsafe fn call_f64_f64(x: &mut (f64, f64)) {
190199
}
191200
// CHECK: movl {{.*}}(%ebp), %[[PTR:.*]]
192201
// CHECK: calll {{()|_}}get_f64_f64
193-
// normal: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]]
194-
// normal-NEXT: movsd [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]]
202+
// linux: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]]
203+
// linux-NEXT: movsd [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]]
195204
// win: movsd (%esp), %[[VAL1:.*]]
196205
// win-NEXT: movsd 8(%esp), %[[VAL2:.*]]
197206
// CHECK-NEXT: movsd %[[VAL1]], (%[[PTR]])
@@ -207,12 +216,12 @@ pub unsafe fn call_f32_f64(x: &mut (f32, f64)) {
207216
}
208217
// CHECK: movl {{.*}}(%ebp), %[[PTR:.*]]
209218
// CHECK: calll {{()|_}}get_f32_f64
210-
// normal: movss [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]]
211-
// normal-NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL2:.*]]
219+
// linux: movss [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]]
220+
// linux-NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL2:.*]]
212221
// win: movss (%esp), %[[VAL1:.*]]
213222
// win-NEXT: movsd 8(%esp), %[[VAL2:.*]]
214223
// CHECK-NEXT: movss %[[VAL1]], (%[[PTR]])
215-
// normal-NEXT: movsd %[[VAL2]], 4(%[[PTR]])
224+
// linux-NEXT: movsd %[[VAL2]], 4(%[[PTR]])
216225
// win-NEXT: movsd %[[VAL2]], 8(%[[PTR]])
217226
*x = get_f32_f64();
218227
}
@@ -225,8 +234,8 @@ pub unsafe fn call_f64_f32(x: &mut (f64, f32)) {
225234
}
226235
// CHECK: movl {{.*}}(%ebp), %[[PTR:.*]]
227236
// CHECK: calll {{()|_}}get_f64_f32
228-
// normal: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]]
229-
// normal-NEXT: movss [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]]
237+
// linux: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]]
238+
// linux-NEXT: movss [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]]
230239
// win: movsd (%esp), %[[VAL1:.*]]
231240
// win-NEXT: movss 8(%esp), %[[VAL2:.*]]
232241
// CHECK-NEXT: movsd %[[VAL1]], (%[[PTR]])
@@ -257,8 +266,8 @@ pub unsafe fn call_f64_other(x: &mut (f64, usize)) {
257266
}
258267
// CHECK: movl {{.*}}(%ebp), %[[PTR:.*]]
259268
// CHECK: calll {{()|_}}get_f64_other
260-
// normal: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]]
261-
// normal-NEXT: movl [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]]
269+
// linux: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]]
270+
// linux-NEXT: movl [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]]
262271
// win: movsd (%esp), %[[VAL1:.*]]
263272
// win-NEXT: movl 8(%esp), %[[VAL2:.*]]
264273
// CHECK-NEXT: movsd %[[VAL1]], (%[[PTR]])
@@ -289,12 +298,12 @@ pub unsafe fn call_other_f64(x: &mut (usize, f64)) {
289298
}
290299
// CHECK: movl {{.*}}(%ebp), %[[PTR:.*]]
291300
// CHECK: calll {{()|_}}get_other_f64
292-
// normal: movl [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]]
293-
// normal-NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL2:.*]]
301+
// linux: movl [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]]
302+
// linux-NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL2:.*]]
294303
// win: movl (%esp), %[[VAL1:.*]]
295304
// win-NEXT: movsd 8(%esp), %[[VAL2:.*]]
296305
// CHECK-NEXT: movl %[[VAL1]], (%[[PTR]])
297-
// normal-NEXT: movsd %[[VAL2]], 4(%[[PTR]])
306+
// linux-NEXT: movsd %[[VAL2]], 4(%[[PTR]])
298307
// win-NEXT: movsd %[[VAL2]], 8(%[[PTR]])
299308
*x = get_other_f64();
300309
}

tests/assembly/x86_64-array-pair-load-store-merge.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ assembly-output: emit-asm
2-
//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel
2+
//@ compile-flags: --crate-type=lib -Copt-level=3 -C llvm-args=-x86-asm-syntax=intel
33
//@ only-x86_64
44
//@ ignore-sgx
55
//@ ignore-apple (manipulates rsp too)

tests/assembly/x86_64-bigint-helpers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ only-x86_64
22
//@ assembly-output: emit-asm
3-
//@ compile-flags: --crate-type=lib -O -C target-cpu=x86-64-v4
3+
//@ compile-flags: --crate-type=lib -Copt-level=3 -C target-cpu=x86-64-v4
44
//@ compile-flags: -C llvm-args=-x86-asm-syntax=intel
55
//@ revisions: llvm-pre-20 llvm-20
66
//@ [llvm-20] min-llvm-version: 20

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
//@ assembly-output: emit-asm
55
// Set the base cpu explicitly, in case the default has been changed.
6-
//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel -C target-cpu=x86-64
6+
//@ compile-flags: --crate-type=lib -Copt-level=3 -C llvm-args=-x86-asm-syntax=intel -C target-cpu=x86-64
77
//@ only-x86_64
88
//@ ignore-sgx
99

tests/assembly/x86_64-function-return.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
//@ revisions: unset keep thunk-extern keep-thunk-extern thunk-extern-keep
55
//@ assembly-output: emit-asm
6-
//@ compile-flags: -O
6+
//@ compile-flags: -Copt-level=3
77
//@ [keep] compile-flags: -Zfunction-return=keep
88
//@ [thunk-extern] compile-flags: -Zfunction-return=thunk-extern
99
//@ [keep-thunk-extern] compile-flags: -Zfunction-return=keep -Zfunction-return=thunk-extern

tests/assembly/x86_64-no-jump-tables.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
//@ revisions: unset set
55
//@ assembly-output: emit-asm
6-
//@ compile-flags: -O
6+
//@ compile-flags: -Copt-level=3
77
//@ [set] compile-flags: -Zno-jump-tables
88
//@ only-x86_64
99
//@ ignore-sgx

0 commit comments

Comments
 (0)