Skip to content

Commit

Permalink
[testsuite][cleanup] Remove all usages of dont_merge hack to avoid …
Browse files Browse the repository at this point in the history
…function merging

Resolves #129438

The `-Zmerge-functions=disabled` compile flag exists for this purpose.
  • Loading branch information
Rajveer100 committed Aug 23, 2024
1 parent c8b14ba commit ca502db
Show file tree
Hide file tree
Showing 12 changed files with 0 additions and 126 deletions.
6 changes: 0 additions & 6 deletions tests/assembly/asm/aarch64-modifiers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ macro_rules! check {
// -O and extern "C" guarantee that the selected register is always r0/s0/d0/q0
#[no_mangle]
pub unsafe extern "C" fn $func() -> i32 {
// Hack to avoid function merging
extern "Rust" {
fn dont_merge(s: &str);
}
dont_merge(stringify!($func));

let y;
asm!($code, out($reg) y);
y
Expand Down
12 changes: 0 additions & 12 deletions tests/assembly/asm/aarch64-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,6 @@ macro_rules! check {
($func:ident $ty:ident $class:ident $mov:literal $modifier:literal) => {
#[no_mangle]
pub unsafe fn $func(x: $ty) -> $ty {
// Hack to avoid function merging
extern "Rust" {
fn dont_merge(s: &str);
}
dont_merge(stringify!($func));

let y;
asm!(
concat!($mov, " {:", $modifier, "}, {:", $modifier, "}"),
Expand All @@ -134,12 +128,6 @@ macro_rules! check_reg {
($func:ident $ty:ident $reg:tt $mov:literal) => {
#[no_mangle]
pub unsafe fn $func(x: $ty) -> $ty {
// Hack to avoid function merging
extern "Rust" {
fn dont_merge(s: &str);
}
dont_merge(stringify!($func));

let y;
asm!(concat!($mov, " ", $reg, ", ", $reg), lateout($reg) y, in($reg) x);
y
Expand Down
6 changes: 0 additions & 6 deletions tests/assembly/asm/arm-modifiers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ macro_rules! check {
// -O and extern "C" guarantee that the selected register is always r0/s0/d0/q0
#[no_mangle]
pub unsafe extern "C" fn $func() -> $ty {
// Hack to avoid function merging
extern "Rust" {
fn dont_merge(s: &str);
}
dont_merge(stringify!($func));

let y;
asm!(concat!($mov, " {0:", $modifier, "}, {0:", $modifier, "}"), out($reg) y);
y
Expand Down
12 changes: 0 additions & 12 deletions tests/assembly/asm/arm-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,6 @@ macro_rules! check {
($func:ident $ty:ident $class:ident $mov:literal) => {
#[no_mangle]
pub unsafe fn $func(x: $ty) -> $ty {
// Hack to avoid function merging
extern "Rust" {
fn dont_merge(s: &str);
}
dont_merge(stringify!($func));

let y;
asm!(concat!($mov, " {}, {}"), out($class) y, in($class) x);
y
Expand All @@ -131,12 +125,6 @@ macro_rules! check_reg {
($func:ident $ty:ident $reg:tt $mov:literal) => {
#[no_mangle]
pub unsafe fn $func(x: $ty) -> $ty {
// Hack to avoid function merging
extern "Rust" {
fn dont_merge(s: &str);
}
dont_merge(stringify!($func));

let y;
asm!(concat!($mov, " ", $reg, ", ", $reg), lateout($reg) y, in($reg) x);
y
Expand Down
24 changes: 0 additions & 24 deletions tests/assembly/asm/hexagon-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ macro_rules! check {
($func:ident $ty:ident $class:ident) => {
#[no_mangle]
pub unsafe fn $func(x: $ty) -> $ty {
// Hack to avoid function merging
extern "Rust" {
fn dont_merge(s: &str);
}
dont_merge(stringify!($func));

let y;
asm!("{} = {}", out($class) y, in($class) x);
y
Expand All @@ -58,12 +52,6 @@ macro_rules! check_reg {
($func:ident $ty:ident $reg:tt) => {
#[no_mangle]
pub unsafe fn $func(x: $ty) -> $ty {
// Hack to avoid function merging
extern "Rust" {
fn dont_merge(s: &str);
}
dont_merge(stringify!($func));

let y;
asm!(concat!($reg, " = ", $reg), lateout($reg) y, in($reg) x);
y
Expand All @@ -77,12 +65,6 @@ macro_rules! check_reg {
// CHECK: InlineAsm End
#[no_mangle]
pub unsafe fn sym_static() {
// Hack to avoid function merging
extern "Rust" {
fn dont_merge(s: &str);
}
dont_merge(stringify!($func));

asm!("r0 = #{}", sym extern_static);
}

Expand All @@ -92,12 +74,6 @@ pub unsafe fn sym_static() {
// CHECK: InlineAsm End
#[no_mangle]
pub unsafe fn sym_fn() {
// Hack to avoid function merging
extern "Rust" {
fn dont_merge(s: &str);
}
dont_merge(stringify!($func));

asm!("r0 = #{}", sym extern_func);
}

Expand Down
9 changes: 0 additions & 9 deletions tests/assembly/asm/loongarch-type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ extern "C" {
static extern_static: u8;
}

// Hack to avoid function merging
extern "Rust" {
fn dont_merge(s: &str);
}

// CHECK-LABEL: sym_fn:
// CHECK: #APP
// CHECK: pcalau12i $t0, %got_pc_hi20(extern_func)
Expand All @@ -67,8 +62,6 @@ pub unsafe fn sym_static() {
macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => {
#[no_mangle]
pub unsafe fn $func(x: $ty) -> $ty {
dont_merge(stringify!($func));

let y;
asm!(concat!($mov," {}, {}"), out($class) y, in($class) x);
y
Expand All @@ -78,8 +71,6 @@ macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => {
macro_rules! check_reg { ($func:ident, $ty:ty, $reg:tt, $mov:literal) => {
#[no_mangle]
pub unsafe fn $func(x: $ty) -> $ty {
dont_merge(stringify!($func));

let y;
asm!(concat!($mov, " ", $reg, ", ", $reg), lateout($reg) y, in($reg) x);
y
Expand Down
9 changes: 0 additions & 9 deletions tests/assembly/asm/mips-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,9 @@ extern "C" {
static extern_static: u8;
}

// Hack to avoid function merging
extern "Rust" {
fn dont_merge(s: &str);
}

macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => {
#[no_mangle]
pub unsafe fn $func(x: $ty) -> $ty {
dont_merge(stringify!($func));

let y;
asm!(concat!($mov," {}, {}"), out($class) y, in($class) x);
y
Expand All @@ -62,8 +55,6 @@ macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => {
macro_rules! check_reg { ($func:ident, $ty:ty, $reg:tt, $mov:literal) => {
#[no_mangle]
pub unsafe fn $func(x: $ty) -> $ty {
dont_merge(stringify!($func));

let y;
asm!(concat!($mov, " ", $reg, ", ", $reg), lateout($reg) y, in($reg) x);
y
Expand Down
9 changes: 0 additions & 9 deletions tests/assembly/asm/powerpc-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,9 @@ extern "C" {
static extern_static: u8;
}

// Hack to avoid function merging
extern "Rust" {
fn dont_merge(s: &str);
}

macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => {
#[no_mangle]
pub unsafe fn $func(x: $ty) -> $ty {
dont_merge(stringify!($func));

let y;
asm!(concat!($mov," {}, {}"), out($class) y, in($class) x);
y
Expand All @@ -62,8 +55,6 @@ macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => {
macro_rules! check_reg { ($func:ident, $ty:ty, $rego:tt, $regc:tt, $mov:literal) => {
#[no_mangle]
pub unsafe fn $func(x: $ty) -> $ty {
dont_merge(stringify!($func));

let y;
asm!(concat!($mov, " ", $rego, ", ", $rego), lateout($regc) y, in($regc) x);
y
Expand Down
12 changes: 0 additions & 12 deletions tests/assembly/asm/riscv-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,6 @@ macro_rules! check {
($func:ident $ty:ident $class:ident $mov:literal) => {
#[no_mangle]
pub unsafe fn $func(x: $ty) -> $ty {
// Hack to avoid function merging
extern "Rust" {
fn dont_merge(s: &str);
}
dont_merge(stringify!($func));

let y;
asm!(concat!($mov, " {}, {}"), out($class) y, in($class) x);
y
Expand All @@ -107,12 +101,6 @@ macro_rules! check_reg {
($func:ident $ty:ident $reg:tt $mov:literal) => {
#[no_mangle]
pub unsafe fn $func(x: $ty) -> $ty {
// Hack to avoid function merging
extern "Rust" {
fn dont_merge(s: &str);
}
dont_merge(stringify!($func));

let y;
asm!(concat!($mov, " ", $reg, ", ", $reg), lateout($reg) y, in($reg) x);
y
Expand Down
9 changes: 0 additions & 9 deletions tests/assembly/asm/s390x-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,9 @@ extern "C" {
static extern_static: u8;
}

// Hack to avoid function merging
extern "Rust" {
fn dont_merge(s: &str);
}

macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => {
#[no_mangle]
pub unsafe fn $func(x: $ty) -> $ty {
dont_merge(stringify!($func));

let y;
asm!(concat!($mov," {}, {}"), out($class) y, in($class) x);
y
Expand All @@ -61,8 +54,6 @@ macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => {
macro_rules! check_reg { ($func:ident, $ty:ty, $reg:tt, $mov:literal) => {
#[no_mangle]
pub unsafe fn $func(x: $ty) -> $ty {
dont_merge(stringify!($func));

let y;
asm!(concat!($mov, " %", $reg, ", %", $reg), lateout($reg) y, in($reg) x);
y
Expand Down
6 changes: 0 additions & 6 deletions tests/assembly/asm/x86-modifiers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ macro_rules! check {
// -O and extern "C" guarantee that the selected register is always ax/xmm0
#[no_mangle]
pub unsafe extern "C" fn $func() -> i32 {
// Hack to avoid function merging
extern "Rust" {
fn dont_merge(s: &str);
}
dont_merge(stringify!($func));

let y;
asm!(concat!($mov, " {0:", $modifier, "}, {0:", $modifier, "}"), out($reg) y);
y
Expand Down
12 changes: 0 additions & 12 deletions tests/assembly/asm/x86-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,6 @@ macro_rules! check {
($func:ident $ty:ident $class:ident $mov:literal) => {
#[no_mangle]
pub unsafe fn $func(x: $ty) -> $ty {
// Hack to avoid function merging
extern "Rust" {
fn dont_merge(s: &str);
}
dont_merge(stringify!($func));

let y;
asm!(concat!($mov, " {}, {}"), lateout($class) y, in($class) x);
y
Expand All @@ -300,12 +294,6 @@ macro_rules! check_reg {
($func:ident $ty:ident $reg:tt $mov:literal) => {
#[no_mangle]
pub unsafe fn $func(x: $ty) -> $ty {
// Hack to avoid function merging
extern "Rust" {
fn dont_merge(s: &str);
}
dont_merge(stringify!($func));

let y;
asm!(concat!($mov, " ", $reg, ", ", $reg), lateout($reg) y, in($reg) x);
y
Expand Down

0 comments on commit ca502db

Please sign in to comment.