Skip to content

Commit

Permalink
Rollup merge of rust-lang#134562 - taiki-e:codegen-asm-minicore, r=ji…
Browse files Browse the repository at this point in the history
…eyouxu

tests/codegen/asm: Remove uses of rustc_attrs and lang_items features by using minicore

Similar to rust-lang#134385 (for tests/ui/asm) and rust-lang#134436 (for tests/assembly/asm), but for tests/codegen/asm.

r? jieyouxu
  • Loading branch information
matthiaskrgr authored Dec 20, 2024
2 parents 4a792fd + 96edf41 commit 17f6690
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 74 deletions.
12 changes: 4 additions & 8 deletions tests/codegen/asm/aarch64-clobbers.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: aarch64 aarch64_fixed_x18 aarch64_no_x18 aarch64_reserve_x18 arm64ec
//@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu
//@[aarch64] needs-llvm-components: aarch64
Expand All @@ -14,16 +15,11 @@
// ignore-tidy-linelength

#![crate_type = "rlib"]
#![feature(no_core, rustc_attrs, lang_items)]
#![feature(no_core)]
#![no_core]

#[lang = "sized"]
trait Sized {}

#[rustc_builtin_macro]
macro_rules! asm {
() => {};
}
extern crate minicore;
use minicore::*;

// CHECK-LABEL: @cc_clobber
// CHECK: call void asm sideeffect "", "~{cc}"()
Expand Down
12 changes: 4 additions & 8 deletions tests/codegen/asm/avr-clobbers.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
//@ add-core-stubs
//@ assembly-output: emit-asm
//@ compile-flags: --target avr-unknown-gnu-atmega328
//@ needs-llvm-components: avr

#![crate_type = "rlib"]
#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)]
#![feature(no_core, asm_experimental_arch)]
#![no_core]

#[lang = "sized"]
trait Sized {}

#[rustc_builtin_macro]
macro_rules! asm {
() => {};
}
extern crate minicore;
use minicore::*;

// CHECK-LABEL: @sreg_is_clobbered
// CHECK: void asm sideeffect "", "~{sreg}"()
Expand Down
12 changes: 4 additions & 8 deletions tests/codegen/asm/hexagon-clobbers.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
//@ add-core-stubs
//@ revisions: hexagon
//@[hexagon] compile-flags: --target hexagon-unknown-linux-musl
//@[hexagon] needs-llvm-components: hexagon
//@ compile-flags: -Zmerge-functions=disabled

#![crate_type = "rlib"]
#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)]
#![feature(no_core, asm_experimental_arch)]
#![no_core]

#[lang = "sized"]
trait Sized {}

#[rustc_builtin_macro]
macro_rules! asm {
() => {};
}
extern crate minicore;
use minicore::*;

// CHECK-LABEL: @flags_clobber
// CHECK: call void asm sideeffect "", ""()
Expand Down
12 changes: 4 additions & 8 deletions tests/codegen/asm/msp430-clobbers.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
//@ add-core-stubs
//@ assembly-output: emit-asm
//@ compile-flags: --target msp430-none-elf
//@ needs-llvm-components: msp430

#![crate_type = "rlib"]
#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)]
#![feature(no_core, asm_experimental_arch)]
#![no_core]

#[lang = "sized"]
trait Sized {}

#[rustc_builtin_macro]
macro_rules! asm {
() => {};
}
extern crate minicore;
use minicore::*;

// CHECK-LABEL: @sr_clobber
// CHECK: call void asm sideeffect "", "~{sr}"()
Expand Down
12 changes: 4 additions & 8 deletions tests/codegen/asm/powerpc-clobbers.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: powerpc powerpc64 powerpc64le aix64
//@[powerpc] compile-flags: --target powerpc-unknown-linux-gnu
//@[powerpc] needs-llvm-components: powerpc
Expand All @@ -10,16 +11,11 @@
// ignore-tidy-linelength

#![crate_type = "rlib"]
#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)]
#![feature(no_core, asm_experimental_arch)]
#![no_core]

#[lang = "sized"]
trait Sized {}

#[rustc_builtin_macro]
macro_rules! asm {
() => {};
}
extern crate minicore;
use minicore::*;

// CHECK-LABEL: @cr_clobber
// CHECK: call void asm sideeffect "", "~{cr}"()
Expand Down
12 changes: 4 additions & 8 deletions tests/codegen/asm/riscv-clobbers.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ add-core-stubs
//@ assembly-output: emit-asm
//@ revisions: rv32i rv64i rv32e
//@[rv32i] compile-flags: --target riscv32i-unknown-none-elf
Expand All @@ -9,16 +10,11 @@
// ignore-tidy-linelength

#![crate_type = "rlib"]
#![feature(no_core, rustc_attrs, lang_items)]
#![feature(no_core)]
#![no_core]

#[lang = "sized"]
trait Sized {}

#[rustc_builtin_macro]
macro_rules! asm {
() => {};
}
extern crate minicore;
use minicore::*;

// CHECK-LABEL: @flags_clobber
// CHECK: call void asm sideeffect "", "~{vtype},~{vl},~{vxsat},~{vxrm}"()
Expand Down
12 changes: 4 additions & 8 deletions tests/codegen/asm/s390x-clobbers.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
//@ add-core-stubs
//@ revisions: s390x
//@[s390x] compile-flags: --target s390x-unknown-linux-gnu
//@[s390x] needs-llvm-components: systemz

#![crate_type = "rlib"]
#![feature(no_core, rustc_attrs, lang_items)]
#![feature(no_core)]
#![no_core]

#[lang = "sized"]
trait Sized {}

#[rustc_builtin_macro]
macro_rules! asm {
() => {};
}
extern crate minicore;
use minicore::*;

// CHECK-LABEL: @cc_clobber
// CHECK: call void asm sideeffect "", "~{cc}"()
Expand Down
14 changes: 4 additions & 10 deletions tests/codegen/asm/sanitize-llvm.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
//@ add-core-stubs
// FIXME(nagisa): remove the flags below once all targets support `asm!`.
//@ compile-flags: --target x86_64-unknown-linux-gnu -Copt-level=0
//@ needs-llvm-components: x86

// Verify we sanitize the special tokens for the LLVM inline-assembly, ensuring people won't
// inadvertently rely on the LLVM-specific syntax and features.
#![no_core]
#![feature(no_core, lang_items, rustc_attrs)]
#![feature(no_core)]
#![crate_type = "rlib"]
#![allow(named_asm_labels)]

#[rustc_builtin_macro]
macro_rules! asm {
() => {};
}

#[lang = "sized"]
trait Sized {}
#[lang = "copy"]
trait Copy {}
extern crate minicore;
use minicore::*;

pub unsafe fn we_escape_dollar_signs() {
// CHECK: call void asm sideeffect alignstack inteldialect "banana$$:"
Expand Down
12 changes: 4 additions & 8 deletions tests/codegen/asm/sparc-clobbers.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: sparc sparcv8plus sparc64
//@[sparc] compile-flags: --target sparc-unknown-none-elf
//@[sparc] needs-llvm-components: sparc
Expand All @@ -7,16 +8,11 @@
//@[sparc64] needs-llvm-components: sparc

#![crate_type = "rlib"]
#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)]
#![feature(no_core, asm_experimental_arch)]
#![no_core]

#[lang = "sized"]
trait Sized {}

#[rustc_builtin_macro]
macro_rules! asm {
() => {};
}
extern crate minicore;
use minicore::*;

// CHECK-LABEL: @cc_clobber
// CHECK: call void asm sideeffect "", "~{icc},~{fcc0},~{fcc1},~{fcc2},~{fcc3}"()
Expand Down

0 comments on commit 17f6690

Please sign in to comment.