From d938f77f3f2f353cbfb525ac23e63e880cd583df Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sat, 6 Apr 2024 01:47:19 +0900 Subject: [PATCH] x86_64: Work around cg_gcc bug https://github.com/rust-lang/rustc_codegen_gcc/issues/485 ``` libgccjit.so: error: invalid register name for 'output_register' error: could not copy "/app/output.example.fb61ce7e3f5ff483-cgu.0.rcgu.s" to "/app/output.s": No such file or directory (os error 2) ``` --- src/imp/atomic128/x86_64.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/imp/atomic128/x86_64.rs b/src/imp/atomic128/x86_64.rs index 991e3b3b..7bc6afc8 100644 --- a/src/imp/atomic128/x86_64.rs +++ b/src/imp/atomic128/x86_64.rs @@ -124,14 +124,14 @@ unsafe fn cmpxchg16b(dst: *mut u128, old: u128, new: u128) -> (u128, bool) { asm!( "xchg {rbx_tmp}, rbx", // save rbx which is reserved by LLVM concat!("lock cmpxchg16b xmmword ptr [", $rdi, "]"), - "sete r8b", + "sete cl", "mov rbx, {rbx_tmp}", // restore rbx rbx_tmp = inout(reg) new.pair.lo => _, in("rcx") new.pair.hi, inout("rax") old.pair.lo => prev_lo, inout("rdx") old.pair.hi => prev_hi, in($rdi) dst, - out("r8b") r, + lateout("cl") r, // Do not use `preserves_flags` because CMPXCHG16B modifies the ZF flag. options(nostack), )