about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorLuqman Aden <me@luqman.ca>2022-04-09 15:16:38 -0700
committerLuqman Aden <me@luqman.ca>2022-04-09 15:16:38 -0700
commit0b2f3604fd733db5ad9498eaf129655879c242b3 (patch)
tree1c5b57326664c6b9e28ce340c0cdfe57564c83cd /src/test/codegen
parentbf3ef0da0c630ab239e4f26e86602eabe585e74f (diff)
downloadrust-0b2f3604fd733db5ad9498eaf129655879c242b3.tar.gz
rust-0b2f3604fd733db5ad9498eaf129655879c242b3.zip
Update asm-may_unwind test to handle use of asm with outputs.
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/asm-may_unwind.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/test/codegen/asm-may_unwind.rs b/src/test/codegen/asm-may_unwind.rs
index 3b34d79c3a9..bf4202764a7 100644
--- a/src/test/codegen/asm-may_unwind.rs
+++ b/src/test/codegen/asm-may_unwind.rs
@@ -18,10 +18,23 @@ impl Drop for Foo {
     }
 }
 
-// CHECK-LABEL: @may_unwind
+// CHECK-LABEL: @asm_may_unwind
 #[no_mangle]
-pub unsafe fn may_unwind() {
+pub unsafe fn asm_may_unwind() {
     let _m = Foo;
     // CHECK: invoke void asm sideeffect alignstack inteldialect unwind ""
     asm!("", options(may_unwind));
 }
+
+// CHECK-LABEL: @asm_with_result_may_unwind
+#[no_mangle]
+pub unsafe fn asm_with_result_may_unwind() -> u64 {
+    let _m = Foo;
+    let res: u64;
+    // CHECK: [[RES:%[0-9]+]] = invoke i64 asm sideeffect alignstack inteldialect unwind
+    // CHECK-NEXT: to label %[[NORMALBB:[a-b0-9]+]]
+    asm!("mov {}, 1", out(reg) res, options(may_unwind));
+    // CHECK: [[NORMALBB]]:
+    // CHECK: ret i64 [[RES:%[0-9]+]]
+    res
+}