Skip to content

Commit 0b2f360

Browse files
committed
Update asm-may_unwind test to handle use of asm with outputs.
1 parent bf3ef0d commit 0b2f360

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/test/codegen/asm-may_unwind.rs

+15-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,23 @@ impl Drop for Foo {
1818
}
1919
}
2020

21-
// CHECK-LABEL: @may_unwind
21+
// CHECK-LABEL: @asm_may_unwind
2222
#[no_mangle]
23-
pub unsafe fn may_unwind() {
23+
pub unsafe fn asm_may_unwind() {
2424
let _m = Foo;
2525
// CHECK: invoke void asm sideeffect alignstack inteldialect unwind ""
2626
asm!("", options(may_unwind));
2727
}
28+
29+
// CHECK-LABEL: @asm_with_result_may_unwind
30+
#[no_mangle]
31+
pub unsafe fn asm_with_result_may_unwind() -> u64 {
32+
let _m = Foo;
33+
let res: u64;
34+
// CHECK: [[RES:%[0-9]+]] = invoke i64 asm sideeffect alignstack inteldialect unwind
35+
// CHECK-NEXT: to label %[[NORMALBB:[a-b0-9]+]]
36+
asm!("mov {}, 1", out(reg) res, options(may_unwind));
37+
// CHECK: [[NORMALBB]]:
38+
// CHECK: ret i64 [[RES:%[0-9]+]]
39+
res
40+
}

0 commit comments

Comments
 (0)