From 5932b2fe9cd9735749ef3b141f3782edc815f4e6 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Sat, 8 Feb 2025 18:56:25 -0800 Subject: [PATCH 1/5] tests/assembly: make windows ABI test cross-compile --- tests/assembly/x86_64-windows-float-abi.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/assembly/x86_64-windows-float-abi.rs b/tests/assembly/x86_64-windows-float-abi.rs index 1381d492fa593..e8900be1aaee3 100644 --- a/tests/assembly/x86_64-windows-float-abi.rs +++ b/tests/assembly/x86_64-windows-float-abi.rs @@ -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 From b3464fa65ff4486b20589e0e7486657ba0ea533d Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Sat, 8 Feb 2025 19:00:27 -0800 Subject: [PATCH 2/5] tests/assembly: make typed-swap test much less fragile --- tests/assembly/x86_64-typed-swap.rs | 40 ++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/assembly/x86_64-typed-swap.rs b/tests/assembly/x86_64-typed-swap.rs index 95e87519e6c4b..dfd6ee565bccb 100644 --- a/tests/assembly/x86_64-typed-swap.rs +++ b/tests/assembly/x86_64-typed-swap.rs @@ -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; @@ -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) } From ee111b24e35c32b251a0879e590af3da8d5015b0 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Sat, 8 Feb 2025 18:56:57 -0800 Subject: [PATCH 3/5] tests/assembly: use -Copt-level=3 instead of -O --- tests/assembly/asm/aarch64-modifiers.rs | 4 ++-- tests/assembly/asm/aarch64-outline-atomics.rs | 2 +- tests/assembly/asm/arm-modifiers.rs | 4 ++-- tests/assembly/asm/x86-modifiers.rs | 4 ++-- tests/assembly/libs/issue-115339-zip-arrays.rs | 2 +- tests/assembly/manual-eq-efficient.rs | 2 +- tests/assembly/panic-no-unwind-no-uwtable.rs | 2 +- tests/assembly/powerpc64-struct-abi.rs | 2 +- tests/assembly/s390x-backchain-toggle.rs | 2 +- tests/assembly/s390x-vector-abi.rs | 2 +- tests/assembly/simd-bitmask.rs | 2 +- tests/assembly/simd-intrinsic-gather.rs | 2 +- tests/assembly/simd-intrinsic-mask-load.rs | 2 +- tests/assembly/simd-intrinsic-mask-reduce.rs | 2 +- tests/assembly/simd-intrinsic-mask-store.rs | 2 +- tests/assembly/simd-intrinsic-scatter.rs | 2 +- tests/assembly/simd-intrinsic-select.rs | 2 +- tests/assembly/simd/reduce-fadd-unordered.rs | 3 ++- tests/assembly/slice-is_ascii.rs | 2 +- tests/assembly/x86-return-float.rs | 2 +- tests/assembly/x86_64-array-pair-load-store-merge.rs | 2 +- tests/assembly/x86_64-bigint-helpers.rs | 2 +- tests/assembly/x86_64-floating-point-clamp.rs | 2 +- tests/assembly/x86_64-function-return.rs | 2 +- tests/assembly/x86_64-no-jump-tables.rs | 2 +- 25 files changed, 29 insertions(+), 28 deletions(-) diff --git a/tests/assembly/asm/aarch64-modifiers.rs b/tests/assembly/asm/aarch64-modifiers.rs index a3956d21a0677..58f7c114d3a60 100644 --- a/tests/assembly/asm/aarch64-modifiers.rs +++ b/tests/assembly/asm/aarch64-modifiers.rs @@ -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 @@ -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; diff --git a/tests/assembly/asm/aarch64-outline-atomics.rs b/tests/assembly/asm/aarch64-outline-atomics.rs index 46586f0f31c01..5990fb8494214 100644 --- a/tests/assembly/asm/aarch64-outline-atomics.rs +++ b/tests/assembly/asm/aarch64-outline-atomics.rs @@ -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 diff --git a/tests/assembly/asm/arm-modifiers.rs b/tests/assembly/asm/arm-modifiers.rs index 562b6bed74c35..32a368404924a 100644 --- a/tests/assembly/asm/arm-modifiers.rs +++ b/tests/assembly/asm/arm-modifiers.rs @@ -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 @@ -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; diff --git a/tests/assembly/asm/x86-modifiers.rs b/tests/assembly/asm/x86-modifiers.rs index 53e4b92f84acb..5f68e5c7317f3 100644 --- a/tests/assembly/asm/x86-modifiers.rs +++ b/tests/assembly/asm/x86-modifiers.rs @@ -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 @@ -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; diff --git a/tests/assembly/libs/issue-115339-zip-arrays.rs b/tests/assembly/libs/issue-115339-zip-arrays.rs index 956459b2c7731..098382502e8a0 100644 --- a/tests/assembly/libs/issue-115339-zip-arrays.rs +++ b/tests/assembly/libs/issue-115339-zip-arrays.rs @@ -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 diff --git a/tests/assembly/manual-eq-efficient.rs b/tests/assembly/manual-eq-efficient.rs index 817ce94f476a3..8dafed354bebe 100644 --- a/tests/assembly/manual-eq-efficient.rs +++ b/tests/assembly/manual-eq-efficient.rs @@ -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 diff --git a/tests/assembly/panic-no-unwind-no-uwtable.rs b/tests/assembly/panic-no-unwind-no-uwtable.rs index 24626280155a2..b51b173e9616e 100644 --- a/tests/assembly/panic-no-unwind-no-uwtable.rs +++ b/tests/assembly/panic-no-unwind-no-uwtable.rs @@ -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"] diff --git a/tests/assembly/powerpc64-struct-abi.rs b/tests/assembly/powerpc64-struct-abi.rs index db08a5148196d..0332eb94d8a76 100644 --- a/tests/assembly/powerpc64-struct-abi.rs +++ b/tests/assembly/powerpc64-struct-abi.rs @@ -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 diff --git a/tests/assembly/s390x-backchain-toggle.rs b/tests/assembly/s390x-backchain-toggle.rs index 8b6d0cf212320..7ef0292d911e0 100644 --- a/tests/assembly/s390x-backchain-toggle.rs +++ b/tests/assembly/s390x-backchain-toggle.rs @@ -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 diff --git a/tests/assembly/s390x-vector-abi.rs b/tests/assembly/s390x-vector-abi.rs index c1935582561f3..7d86559c0026d 100644 --- a/tests/assembly/s390x-vector-abi.rs +++ b/tests/assembly/s390x-vector-abi.rs @@ -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 diff --git a/tests/assembly/simd-bitmask.rs b/tests/assembly/simd-bitmask.rs index 9a355cc162f67..4a829c4dd98b2 100644 --- a/tests/assembly/simd-bitmask.rs +++ b/tests/assembly/simd-bitmask.rs @@ -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] diff --git a/tests/assembly/simd-intrinsic-gather.rs b/tests/assembly/simd-intrinsic-gather.rs index 29b0df6406556..3152de35f295e 100644 --- a/tests/assembly/simd-intrinsic-gather.rs +++ b/tests/assembly/simd-intrinsic-gather.rs @@ -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] diff --git a/tests/assembly/simd-intrinsic-mask-load.rs b/tests/assembly/simd-intrinsic-mask-load.rs index 89b35ed7734ed..efe3e3752fabe 100644 --- a/tests/assembly/simd-intrinsic-mask-load.rs +++ b/tests/assembly/simd-intrinsic-mask-load.rs @@ -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] diff --git a/tests/assembly/simd-intrinsic-mask-reduce.rs b/tests/assembly/simd-intrinsic-mask-reduce.rs index 8ac55990c7348..4d4adda6c24f9 100644 --- a/tests/assembly/simd-intrinsic-mask-reduce.rs +++ b/tests/assembly/simd-intrinsic-mask-reduce.rs @@ -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] diff --git a/tests/assembly/simd-intrinsic-mask-store.rs b/tests/assembly/simd-intrinsic-mask-store.rs index 1686fd5dd8833..f5d924f24a764 100644 --- a/tests/assembly/simd-intrinsic-mask-store.rs +++ b/tests/assembly/simd-intrinsic-mask-store.rs @@ -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] diff --git a/tests/assembly/simd-intrinsic-scatter.rs b/tests/assembly/simd-intrinsic-scatter.rs index 3f4d7569c59f4..5f52ababd19c0 100644 --- a/tests/assembly/simd-intrinsic-scatter.rs +++ b/tests/assembly/simd-intrinsic-scatter.rs @@ -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] diff --git a/tests/assembly/simd-intrinsic-select.rs b/tests/assembly/simd-intrinsic-select.rs index 803abf2eeb306..74784a772133d 100644 --- a/tests/assembly/simd-intrinsic-select.rs +++ b/tests/assembly/simd-intrinsic-select.rs @@ -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] diff --git a/tests/assembly/simd/reduce-fadd-unordered.rs b/tests/assembly/simd/reduce-fadd-unordered.rs index ade60ba184c57..e872826f6ef79 100644 --- a/tests/assembly/simd/reduce-fadd-unordered.rs +++ b/tests/assembly/simd/reduce-fadd-unordered.rs @@ -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 diff --git a/tests/assembly/slice-is_ascii.rs b/tests/assembly/slice-is_ascii.rs index 3a050347d8981..e53cd5160cf56 100644 --- a/tests/assembly/slice-is_ascii.rs +++ b/tests/assembly/slice-is_ascii.rs @@ -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 diff --git a/tests/assembly/x86-return-float.rs b/tests/assembly/x86-return-float.rs index acd1af8d38af1..423263c967321 100644 --- a/tests/assembly/x86-return-float.rs +++ b/tests/assembly/x86-return-float.rs @@ -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 diff --git a/tests/assembly/x86_64-array-pair-load-store-merge.rs b/tests/assembly/x86_64-array-pair-load-store-merge.rs index 849f34e72e51e..56a1a9e82062e 100644 --- a/tests/assembly/x86_64-array-pair-load-store-merge.rs +++ b/tests/assembly/x86_64-array-pair-load-store-merge.rs @@ -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) diff --git a/tests/assembly/x86_64-bigint-helpers.rs b/tests/assembly/x86_64-bigint-helpers.rs index 3ad253a2bd0fe..58785932bc2f9 100644 --- a/tests/assembly/x86_64-bigint-helpers.rs +++ b/tests/assembly/x86_64-bigint-helpers.rs @@ -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 diff --git a/tests/assembly/x86_64-floating-point-clamp.rs b/tests/assembly/x86_64-floating-point-clamp.rs index c05afadff645c..6b0c29c5f2148 100644 --- a/tests/assembly/x86_64-floating-point-clamp.rs +++ b/tests/assembly/x86_64-floating-point-clamp.rs @@ -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 diff --git a/tests/assembly/x86_64-function-return.rs b/tests/assembly/x86_64-function-return.rs index 7cfdf5bce0c1e..7fd57200a9eef 100644 --- a/tests/assembly/x86_64-function-return.rs +++ b/tests/assembly/x86_64-function-return.rs @@ -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 diff --git a/tests/assembly/x86_64-no-jump-tables.rs b/tests/assembly/x86_64-no-jump-tables.rs index 9b7812262326d..bb10042d8f629 100644 --- a/tests/assembly/x86_64-no-jump-tables.rs +++ b/tests/assembly/x86_64-no-jump-tables.rs @@ -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 From a7c7f39cf229ffb93d4a671b09e35c27cdec762c Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Sat, 8 Feb 2025 21:16:31 -0800 Subject: [PATCH 4/5] tests/assembly: cross-compile x86-return-float We choose to test for Linux and Windows instead of random other targets. --- tests/assembly/x86-return-float.rs | 42 ++++++++++++++++++------------ 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/tests/assembly/x86-return-float.rs b/tests/assembly/x86-return-float.rs index 423263c967321..35b9e2d18d392 100644 --- a/tests/assembly/x86-return-float.rs +++ b/tests/assembly/x86-return-float.rs @@ -1,19 +1,27 @@ //@ assembly-output: emit-asm -//@ only-x86 // FIXME(#114479): LLVM miscompiles loading and storing `f32` and `f64` when SSE is disabled. // There's no compiletest directive to ignore a test on i586 only, so just always explicitly enable // SSE2. // 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: -Copt-level=3 -C force-frame-pointers +//@ compile-flags: -C force-frame-pointers +// At opt-level=3, LLVM can merge two movss into one movsd, and we aren't testing for that. +//@ compile-flags: -Copt-level=2 //@ filecheck-flags: --implicit-check-not fld --implicit-check-not fst -//@ revisions: normal win -//@[normal] ignore-windows -//@[win] only-windows +//@ revisions: linux win +//@ add-core-stubs +//@ needs-llvm-components: x86 +//@[linux] compile-flags: --target i686-unknown-linux-gnu +//@[win] compile-flags: --target i686-pc-windows-msvc #![crate_type = "lib"] #![feature(f16, f128)] +#![feature(no_core)] +#![no_core] + +extern crate minicore; +use minicore::*; // Tests that returning `f32` and `f64` with the "Rust" ABI on 32-bit x86 doesn't use the x87 // floating point stack, as loading and storing `f32`s and `f64`s to and from the x87 stack quietens @@ -190,8 +198,8 @@ pub unsafe fn call_f64_f64(x: &mut (f64, f64)) { } // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]] // CHECK: calll {{()|_}}get_f64_f64 - // normal: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] - // normal-NEXT: movsd [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]] + // linux: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] + // linux-NEXT: movsd [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]] // win: movsd (%esp), %[[VAL1:.*]] // win-NEXT: movsd 8(%esp), %[[VAL2:.*]] // CHECK-NEXT: movsd %[[VAL1]], (%[[PTR]]) @@ -207,12 +215,12 @@ pub unsafe fn call_f32_f64(x: &mut (f32, f64)) { } // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]] // CHECK: calll {{()|_}}get_f32_f64 - // normal: movss [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] - // normal-NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL2:.*]] + // linux: movss [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] + // linux-NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL2:.*]] // win: movss (%esp), %[[VAL1:.*]] // win-NEXT: movsd 8(%esp), %[[VAL2:.*]] // CHECK-NEXT: movss %[[VAL1]], (%[[PTR]]) - // normal-NEXT: movsd %[[VAL2]], 4(%[[PTR]]) + // linux-NEXT: movsd %[[VAL2]], 4(%[[PTR]]) // win-NEXT: movsd %[[VAL2]], 8(%[[PTR]]) *x = get_f32_f64(); } @@ -225,8 +233,8 @@ pub unsafe fn call_f64_f32(x: &mut (f64, f32)) { } // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]] // CHECK: calll {{()|_}}get_f64_f32 - // normal: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] - // normal-NEXT: movss [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]] + // linux: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] + // linux-NEXT: movss [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]] // win: movsd (%esp), %[[VAL1:.*]] // win-NEXT: movss 8(%esp), %[[VAL2:.*]] // CHECK-NEXT: movsd %[[VAL1]], (%[[PTR]]) @@ -257,8 +265,8 @@ pub unsafe fn call_f64_other(x: &mut (f64, usize)) { } // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]] // CHECK: calll {{()|_}}get_f64_other - // normal: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] - // normal-NEXT: movl [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]] + // linux: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] + // linux-NEXT: movl [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]] // win: movsd (%esp), %[[VAL1:.*]] // win-NEXT: movl 8(%esp), %[[VAL2:.*]] // CHECK-NEXT: movsd %[[VAL1]], (%[[PTR]]) @@ -289,12 +297,12 @@ pub unsafe fn call_other_f64(x: &mut (usize, f64)) { } // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]] // CHECK: calll {{()|_}}get_other_f64 - // normal: movl [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] - // normal-NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL2:.*]] + // linux: movl [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] + // linux-NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL2:.*]] // win: movl (%esp), %[[VAL1:.*]] // win-NEXT: movsd 8(%esp), %[[VAL2:.*]] // CHECK-NEXT: movl %[[VAL1]], (%[[PTR]]) - // normal-NEXT: movsd %[[VAL2]], 4(%[[PTR]]) + // linux-NEXT: movsd %[[VAL2]], 4(%[[PTR]]) // win-NEXT: movsd %[[VAL2]], 8(%[[PTR]]) *x = get_other_f64(); } From 984605d668c78fa6aa755740b3af2d90d9bc3615 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Sat, 8 Feb 2025 21:46:06 -0800 Subject: [PATCH 5/5] mutter mumbleg --- tests/assembly/x86-return-float.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/assembly/x86-return-float.rs b/tests/assembly/x86-return-float.rs index 35b9e2d18d392..ad760627b3a36 100644 --- a/tests/assembly/x86-return-float.rs +++ b/tests/assembly/x86-return-float.rs @@ -11,7 +11,8 @@ //@ filecheck-flags: --implicit-check-not fld --implicit-check-not fst //@ revisions: linux win //@ add-core-stubs -//@ needs-llvm-components: x86 +//@[linux] needs-llvm-components: x86 +//@[win] needs-llvm-components: x86 //@[linux] compile-flags: --target i686-unknown-linux-gnu //@[win] compile-flags: --target i686-pc-windows-msvc