Skip to content

Commit

Permalink
x86_64: Work around cg_gcc bug
Browse files Browse the repository at this point in the history
rust-lang/rustc_codegen_gcc#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)
```
  • Loading branch information
taiki-e committed Apr 5, 2024
1 parent f97604a commit d938f77
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/imp/atomic128/x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
Expand Down

0 comments on commit d938f77

Please sign in to comment.