Skip to content

Commit 2aa89ff

Browse files
quaternictgross35
authored andcommitted
remove incorrectly placed preserves_flags, and other inline asm fixes
1 parent 23f6f33 commit 2aa89ff

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

compiler-builtins/src/mem/x86_64.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use core::{intrinsics, mem};
2323
#[cfg(target_feature = "ermsb")]
2424
pub unsafe fn copy_forward(dest: *mut u8, src: *const u8, count: usize) {
2525
asm!(
26-
"repe movsb [rdi], [rsi]",
26+
"rep movsb [rdi], [rsi]",
2727
inout("rcx") count => _,
2828
inout("rdi") dest => _,
2929
inout("rsi") src => _,
@@ -70,7 +70,6 @@ pub unsafe fn copy_backward(dest: *mut u8, src: *const u8, count: usize) {
7070
"sub rdi, 7",
7171
"mov rcx, {qword_count:r}",
7272
"rep movsq",
73-
"test {pre_byte_count:e}, {pre_byte_count:e}",
7473
"add rsi, 7",
7574
"add rdi, 7",
7675
"mov ecx, {pre_byte_count:e}",
@@ -81,16 +80,15 @@ pub unsafe fn copy_backward(dest: *mut u8, src: *const u8, count: usize) {
8180
inout("ecx") byte_count => _,
8281
inout("rdi") dest.add(count - 1) => _,
8382
inout("rsi") src.add(count - 1) => _,
84-
// We modify flags, but we restore it afterwards
85-
options(nostack, preserves_flags)
83+
options(nostack)
8684
);
8785
}
8886

8987
#[inline(always)]
9088
#[cfg(target_feature = "ermsb")]
9189
pub unsafe fn set_bytes(dest: *mut u8, c: u8, count: usize) {
9290
asm!(
93-
"repe stosb [rdi], al",
91+
"rep stosb [rdi], al",
9492
inout("rcx") count => _,
9593
inout("rdi") dest => _,
9694
inout("al") c => _,

0 commit comments

Comments
 (0)