Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libgccjit.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d98bd412c7fb6bf8f2258e75f2e2b42f56a06bc1
2f06e64df0dc15f861f77595b77bfc2ba5deb59d
6 changes: 6 additions & 0 deletions src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,12 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
self.llbb().add_eval(None, self.context.new_call(None, builtin_unreachable, &[]));
}

if !options.contains(InlineAsmOptions::NORETURN)
&& let Some(dest) = dest
{
self.switch_to_block(dest);
}

// Write results to outputs.
//
// We need to do this because:
Expand Down
18 changes: 18 additions & 0 deletions tests/run/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// Run-time:
// status: 0

#![feature(asm_goto_with_outputs)]

#[cfg(target_arch = "x86_64")]
use std::arch::{asm, global_asm};

Expand Down Expand Up @@ -32,6 +34,20 @@ pub unsafe fn mem_cpy(dst: *mut u8, src: *const u8, len: usize) {
);
}

#[cfg(target_arch = "x86_64")]
#[unsafe(no_mangle)]
pub fn asm_goto_test(mut a: i16) -> i16 {
unsafe {
std::arch::asm!(
"jmp {op}",
inout("eax") a,
op = label { a = 7; },
options(nostack,nomem)
);
a
}
}

#[cfg(target_arch = "x86_64")]
fn asm() {
unsafe {
Expand Down Expand Up @@ -235,6 +251,8 @@ fn asm() {
out("r15b") _,
);
}

asm_goto_test(0);
}

#[cfg(not(target_arch = "x86_64"))]
Expand Down
Loading