Skip to content

Commit 889d3f6

Browse files
committed
compiler-builtins: Specify :r registers for usize
On the ILP32 `x86_64-unknown-linux-gnux32` target, `usize` is 32 bits so there is a sub-register alignment warning. Specify the 64-bit `r` registers, which matches the current default as well as the size of the other operands in the routines.
1 parent 974d437 commit 889d3f6

File tree

1 file changed

+3
-3
lines changed
  • library/compiler-builtins/compiler-builtins/src/mem

1 file changed

+3
-3
lines changed

library/compiler-builtins/compiler-builtins/src/mem/x86_64.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub unsafe fn copy_backward(dest: *mut u8, src: *const u8, count: usize) {
6969
"rep movsb",
7070
"sub $7, %rsi",
7171
"sub $7, %rdi",
72-
"mov {qword_count}, %rcx",
72+
"mov {qword_count:r}, %rcx",
7373
"rep movsq",
7474
"test {pre_byte_count:e}, {pre_byte_count:e}",
7575
"add $7, %rsi",
@@ -212,7 +212,7 @@ pub unsafe fn c_string_length(mut s: *const core::ffi::c_char) -> usize {
212212
let x = {
213213
let r;
214214
asm!(
215-
"movdqa ({addr}), {dest}",
215+
"movdqa ({addr:r}), {dest}",
216216
addr = in(reg) s,
217217
dest = out(xmm_reg) r,
218218
options(att_syntax, nostack),
@@ -232,7 +232,7 @@ pub unsafe fn c_string_length(mut s: *const core::ffi::c_char) -> usize {
232232
let x = {
233233
let r;
234234
asm!(
235-
"movdqa ({addr}), {dest}",
235+
"movdqa ({addr:r}), {dest}",
236236
addr = in(reg) s,
237237
dest = out(xmm_reg) r,
238238
options(att_syntax, nostack),

0 commit comments

Comments
 (0)