Skip to content

Commit

Permalink
check that assembler mode restored
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertdev committed Sep 5, 2024
1 parent 58e2ccb commit c22bd19
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/mir/naked_asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ fn prefix_and_suffix<'tcx>(
true => ".thumb\n.thumb_func",
false => ".arm",
},
Some(InstructionSetAttr::ArmA32) => ".arm",
Some(InstructionSetAttr::ArmT32) => ".thumb\n.thumb_func",
Some(InstructionSetAttr::ArmA32) => ".arm",
},
match is_thumb {
true => ".thumb",
Expand Down
10 changes: 8 additions & 2 deletions tests/codegen/naked-fn/instruction-set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,35 @@ trait Sized {}
#[lang = "copy"]
trait Copy {}

// CHECK: .arm
// CHECK-LABEL: test_unspecified:
// CHECK: bx lr
// CHECK: .arm
#[no_mangle]
#[naked]
unsafe extern "C" fn test_unspecified() {
asm!("bx lr", options(noreturn));
}

// CHECK-LABEL: test_thumb:
// CHECK: .thumb
// CHECK: .thumb_func
// CHECK-LABEL: test_thumb:
// CHECK: bx lr
// CHECK: .arm
#[no_mangle]
#[naked]
#[instruction_set(arm::t32)]
unsafe extern "C" fn test_thumb() {
asm!("bx lr", options(noreturn));
}

// CHECK: .arm
// CHECK-LABEL: test_arm:
// CHECK: bx lr
// CHECK: .arm
#[no_mangle]
#[naked]
#[instruction_set(arm::t32)]
#[instruction_set(arm::a32)]
unsafe extern "C" fn test_arm() {
asm!("bx lr", options(noreturn));
}

0 comments on commit c22bd19

Please sign in to comment.