Skip to content

Commit

Permalink
Auto merge of rust-lang#136758 - workingjubilee:specify-opt-level-for…
Browse files Browse the repository at this point in the history
…-tests, r=<try>

tests: Specify `-Copt-level=3` instead of `-O` in tests

An effective blocker for rust-lang#135439

r? `@ghost`

try-job: test-various
try-job: aarch64-gnu
try-job: aarch64-gnu-debug
try-job: i686-gnu-1
try-job: i686-gnu-2
try-job: i686-mingw
try-job: i686-msvc-1
try-job: i686-msvc-2
try-job: x86_64-msvc-1
try-job: x86_64-msvc-2
  • Loading branch information
bors committed Feb 9, 2025
2 parents 43ca9d1 + ee111b2 commit c912816
Show file tree
Hide file tree
Showing 27 changed files with 58 additions and 51 deletions.
4 changes: 2 additions & 2 deletions tests/assembly/asm/aarch64-modifiers.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@ add-core-stubs
//@ assembly-output: emit-asm
//@ compile-flags: -O -C panic=abort
//@ compile-flags: -Copt-level=3 -C panic=abort
//@ compile-flags: --target aarch64-unknown-linux-gnu
//@ compile-flags: -Zmerge-functions=disabled
//@ needs-llvm-components: aarch64
Expand All @@ -15,7 +15,7 @@ use minicore::*;

macro_rules! check {
($func:ident $reg:ident $code:literal) => {
// -O and extern "C" guarantee that the selected register is always r0/s0/d0/q0
// -Copt-level=3 and extern "C" guarantee that the selected register is always r0/s0/d0/q0
#[no_mangle]
pub unsafe extern "C" fn $func() -> i32 {
let y;
Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/asm/aarch64-outline-atomics.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ assembly-output: emit-asm
//@ compile-flags: -O
//@ compile-flags: -Copt-level=3
//@ compile-flags: --target aarch64-unknown-linux-gnu
//@ needs-llvm-components: aarch64
//@ only-aarch64
Expand Down
4 changes: 2 additions & 2 deletions tests/assembly/asm/arm-modifiers.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@ add-core-stubs
//@ assembly-output: emit-asm
//@ compile-flags: -O -C panic=abort
//@ compile-flags: -Copt-level=3 -C panic=abort
//@ compile-flags: --target armv7-unknown-linux-gnueabihf
//@ compile-flags: -C target-feature=+neon
//@ compile-flags: -Zmerge-functions=disabled
Expand All @@ -21,7 +21,7 @@ impl Copy for f32x4 {}

macro_rules! check {
($func:ident $modifier:literal $reg:ident $ty:ident $mov:literal) => {
// -O and extern "C" guarantee that the selected register is always r0/s0/d0/q0
// -Copt-level=3 and extern "C" guarantee that the selected register is always r0/s0/d0/q0
#[no_mangle]
pub unsafe extern "C" fn $func() -> $ty {
let y;
Expand Down
4 changes: 2 additions & 2 deletions tests/assembly/asm/x86-modifiers.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//@ add-core-stubs
//@ revisions: x86_64 i686
//@ assembly-output: emit-asm
//@ compile-flags: -O -C panic=abort
//@ compile-flags: -Copt-level=3 -C panic=abort
//@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu
//@[x86_64] needs-llvm-components: x86
//@[i686] compile-flags: --target i686-unknown-linux-gnu
Expand All @@ -20,7 +20,7 @@ use minicore::*;

macro_rules! check {
($func:ident $modifier:literal $reg:ident $mov:literal) => {
// -O and extern "C" guarantee that the selected register is always ax/xmm0
// -Copt-level=3 and extern "C" guarantee that the selected register is always ax/xmm0
#[no_mangle]
pub unsafe extern "C" fn $func() -> i32 {
let y;
Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/libs/issue-115339-zip-arrays.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@ assembly-output: emit-asm
// # zen3 previously exhibited odd vectorization
//@ compile-flags: --crate-type=lib -Ctarget-cpu=znver3 -O
//@ compile-flags: --crate-type=lib -Ctarget-cpu=znver3 -Copt-level=3
//@ only-x86_64
//@ ignore-sgx

Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/manual-eq-efficient.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Regression test for #106269
//@ assembly-output: emit-asm
//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel
//@ compile-flags: --crate-type=lib -Copt-level=3 -C llvm-args=-x86-asm-syntax=intel
//@ only-x86_64
//@ ignore-sgx

Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/panic-no-unwind-no-uwtable.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@ assembly-output: emit-asm
//@ only-x86_64-unknown-linux-gnu
//@ compile-flags: -C panic=unwind -C force-unwind-tables=n -O
//@ compile-flags: -C panic=unwind -C force-unwind-tables=n -Copt-level=3

#![crate_type = "lib"]

Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/powerpc64-struct-abi.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@ revisions: elfv1-be elfv2-be elfv2-le aix
//@ assembly-output: emit-asm
//@ compile-flags: -O
//@ compile-flags: -Copt-level=3
//@[elfv1-be] compile-flags: --target powerpc64-unknown-linux-gnu
//@[elfv1-be] needs-llvm-components: powerpc
//@[elfv2-be] compile-flags: --target powerpc64-unknown-linux-musl
Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/s390x-backchain-toggle.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@ revisions: enable-backchain disable-backchain
//@ assembly-output: emit-asm
//@ compile-flags: -O --crate-type=lib --target=s390x-unknown-linux-gnu
//@ compile-flags: -Copt-level=3 --crate-type=lib --target=s390x-unknown-linux-gnu
//@ needs-llvm-components: systemz
//@[enable-backchain] compile-flags: -Ctarget-feature=+backchain
//@[disable-backchain] compile-flags: -Ctarget-feature=-backchain
Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/s390x-vector-abi.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//@ revisions: z10 z10_vector z13 z13_no_vector
// ignore-tidy-linelength
//@ assembly-output: emit-asm
//@ compile-flags: -O -Z merge-functions=disabled
//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
//@[z10] compile-flags: --target s390x-unknown-linux-gnu --cfg no_vector
//@[z10] needs-llvm-components: systemz
//@[z10_vector] compile-flags: --target s390x-unknown-linux-gnu -C target-feature=+vector
Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/simd-bitmask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//@ [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu
//@ [aarch64] needs-llvm-components: aarch64
//@ assembly-output: emit-asm
//@ compile-flags: --crate-type=lib -O -C panic=abort
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort

#![feature(no_core, lang_items, repr_simd, intrinsics)]
#![no_core]
Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/simd-intrinsic-gather.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq
//@ [x86-avx512] needs-llvm-components: x86
//@ assembly-output: emit-asm
//@ compile-flags: --crate-type=lib -O -C panic=abort
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort

#![feature(no_core, lang_items, repr_simd, intrinsics)]
#![no_core]
Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/simd-intrinsic-mask-load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq
//@ [x86-avx512] needs-llvm-components: x86
//@ assembly-output: emit-asm
//@ compile-flags: --crate-type=lib -O -C panic=abort
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort

#![feature(no_core, lang_items, repr_simd, intrinsics)]
#![no_core]
Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/simd-intrinsic-mask-reduce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//@ [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu
//@ [aarch64] needs-llvm-components: aarch64
//@ assembly-output: emit-asm
//@ compile-flags: --crate-type=lib -O -C panic=abort
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort

#![feature(no_core, lang_items, repr_simd, intrinsics)]
#![no_core]
Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/simd-intrinsic-mask-store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq
//@ [x86-avx512] needs-llvm-components: x86
//@ assembly-output: emit-asm
//@ compile-flags: --crate-type=lib -O -C panic=abort
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort

#![feature(no_core, lang_items, repr_simd, intrinsics)]
#![no_core]
Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/simd-intrinsic-scatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq
//@ [x86-avx512] needs-llvm-components: x86
//@ assembly-output: emit-asm
//@ compile-flags: --crate-type=lib -O -C panic=abort
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort

#![feature(no_core, lang_items, repr_simd, intrinsics)]
#![no_core]
Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/simd-intrinsic-select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//@ [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu
//@ [aarch64] needs-llvm-components: aarch64
//@ assembly-output: emit-asm
//@ compile-flags: --crate-type=lib -O -C panic=abort
//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort

#![feature(no_core, lang_items, repr_simd, intrinsics)]
#![no_core]
Expand Down
3 changes: 2 additions & 1 deletion tests/assembly/simd/reduce-fadd-unordered.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ revisions: x86_64 aarch64
//@ assembly-output: emit-asm
//@ compile-flags: --crate-type=lib -O
//@ compile-flags: --crate-type=lib -Copt-level=3

//@[aarch64] only-aarch64
//@[x86_64] only-x86_64
//@[x86_64] compile-flags: -Ctarget-feature=+sse3
Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/slice-is_ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//@ [WIN] only-windows
//@ [LIN] only-linux
//@ assembly-output: emit-asm
//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel
//@ compile-flags: --crate-type=lib -Copt-level=3 -C llvm-args=-x86-asm-syntax=intel
//@ only-x86_64
//@ ignore-sgx

Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/x86-return-float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Use the same target CPU as `i686` so that LLVM orders the instructions in the same order.
//@ compile-flags: -Ctarget-feature=+sse2 -Ctarget-cpu=pentium4
// Force frame pointers to make ASM more consistent between targets
//@ compile-flags: -O -C force-frame-pointers
//@ compile-flags: -Copt-level=3 -C force-frame-pointers
//@ filecheck-flags: --implicit-check-not fld --implicit-check-not fst
//@ revisions: normal win
//@[normal] ignore-windows
Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/x86_64-array-pair-load-store-merge.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ assembly-output: emit-asm
//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel
//@ compile-flags: --crate-type=lib -Copt-level=3 -C llvm-args=-x86-asm-syntax=intel
//@ only-x86_64
//@ ignore-sgx
//@ ignore-apple (manipulates rsp too)
Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/x86_64-bigint-helpers.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@ only-x86_64
//@ assembly-output: emit-asm
//@ compile-flags: --crate-type=lib -O -C target-cpu=x86-64-v4
//@ compile-flags: --crate-type=lib -Copt-level=3 -C target-cpu=x86-64-v4
//@ compile-flags: -C llvm-args=-x86-asm-syntax=intel
//@ revisions: llvm-pre-20 llvm-20
//@ [llvm-20] min-llvm-version: 20
Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/x86_64-floating-point-clamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

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

Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/x86_64-function-return.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

//@ revisions: unset keep thunk-extern keep-thunk-extern thunk-extern-keep
//@ assembly-output: emit-asm
//@ compile-flags: -O
//@ compile-flags: -Copt-level=3
//@ [keep] compile-flags: -Zfunction-return=keep
//@ [thunk-extern] compile-flags: -Zfunction-return=thunk-extern
//@ [keep-thunk-extern] compile-flags: -Zfunction-return=keep -Zfunction-return=thunk-extern
Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/x86_64-no-jump-tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

//@ revisions: unset set
//@ assembly-output: emit-asm
//@ compile-flags: -O
//@ compile-flags: -Copt-level=3
//@ [set] compile-flags: -Zno-jump-tables
//@ only-x86_64
//@ ignore-sgx
Expand Down
40 changes: 20 additions & 20 deletions tests/assembly/x86_64-typed-swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//@ [LIN] only-linux
//@ only-x86_64
//@ assembly-output: emit-asm
//@ compile-flags: --crate-type=lib -O
//@ compile-flags: --crate-type=lib -Copt-level=3

use std::arch::x86_64::__m128;
use std::mem::swap;
Expand All @@ -12,42 +12,42 @@ use std::mem::swap;
#[no_mangle]
pub fn swap_i32(x: &mut i32, y: &mut i32) {
// CHECK: movl (%[[ARG1:.+]]), %[[T1:.+]]
// CHECK: movl (%[[ARG2:.+]]), %[[T2:.+]]
// CHECK: movl %[[T2]], (%[[ARG1]])
// CHECK: movl %[[T1]], (%[[ARG2]])
// CHECK: retq
// CHECK-NEXT: movl (%[[ARG2:.+]]), %[[T2:.+]]
// CHECK-DAG: movl %[[T2]], (%[[ARG1]])
// CHECK-DAG: movl %[[T1]], (%[[ARG2]])
// CHECK-NEXT: retq
swap(x, y)
}

// CHECK-LABEL: swap_pair:
#[no_mangle]
pub fn swap_pair(x: &mut (i32, u32), y: &mut (i32, u32)) {
// CHECK: movq (%[[ARG1]]), %[[T1:.+]]
// CHECK: movq (%[[ARG2]]), %[[T2:.+]]
// CHECK: movq %[[T2]], (%[[ARG1]])
// CHECK: movq %[[T1]], (%[[ARG2]])
// CHECK: retq
// CHECK: movq (%[[ARG1:r..?]]), %[[T1:.+]]
// CHECK-NEXT: movq (%[[ARG2:r..?]]), %[[T2:.+]]
// CHECK-DAG: movq %[[T2]], (%[[ARG1]])
// CHECK-DAG: movq %[[T1]], (%[[ARG2]])
// CHECK-NEXT: retq
swap(x, y)
}

// CHECK-LABEL: swap_str:
#[no_mangle]
pub fn swap_str<'a>(x: &mut &'a str, y: &mut &'a str) {
// CHECK: movups (%[[ARG1]]), %[[T1:xmm.]]
// CHECK: movups (%[[ARG2]]), %[[T2:xmm.]]
// CHECK: movups %[[T2]], (%[[ARG1]])
// CHECK: movups %[[T1]], (%[[ARG2]])
// CHECK: retq
// CHECK: movups (%[[ARG1:r..?]]), %[[T1:xmm.]]
// CHECK-NEXT: movups (%[[ARG2:r..?]]), %[[T2:xmm.]]
// CHECK-DAG: movups %[[T2]], (%[[ARG1]])
// CHECK-DAG: movups %[[T1]], (%[[ARG2]])
// CHECK-NEXT: retq
swap(x, y)
}

// CHECK-LABEL: swap_simd:
#[no_mangle]
pub fn swap_simd(x: &mut __m128, y: &mut __m128) {
// CHECK: movaps (%[[ARG1]]), %[[T1:xmm.]]
// CHECK: movaps (%[[ARG2]]), %[[T2:xmm.]]
// CHECK: movaps %[[T2]], (%[[ARG1]])
// CHECK: movaps %[[T1]], (%[[ARG2]])
// CHECK: retq
// CHECK: movaps (%[[ARG1:r..?]]), %[[T1:xmm.]]
// CHECK-NEXT: movaps (%[[ARG2:r..?]]), %[[T2:xmm.]]
// CHECK-DAG: movaps %[[T2]], (%[[ARG1]])
// CHECK-DAG: movaps %[[T1]], (%[[ARG2]])
// CHECK-NEXT: retq
swap(x, y)
}
12 changes: 9 additions & 3 deletions tests/assembly/x86_64-windows-float-abi.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
//@ assembly-output: emit-asm
//@ compile-flags: -O
//@ only-windows
//@ only-x86_64
//@ compile-flags: -Copt-level=3
//@ compile-flags: --target x86_64-pc-windows-msvc
//@ needs-llvm-components: x86
//@ add-core-stubs

#![feature(f16, f128)]
#![feature(no_core)]
#![no_core]
#![crate_type = "lib"]

extern crate minicore;
use minicore::*;

// CHECK-LABEL: second_f16
// CHECK: movaps %xmm1, %xmm0
// CHECK-NEXT: retq
Expand Down

0 comments on commit c912816

Please sign in to comment.