1919#[ inline( always) ]
2020#[ cfg( target_feature = "ermsb" ) ]
2121pub unsafe fn copy_forward ( dest : * mut u8 , src : * const u8 , count : usize ) {
22+ // FIXME: Use the Intel syntax once we drop LLVM 9 support on rust-lang/rust.
2223 asm ! (
23- "rep movsb [rdi], [rsi] " ,
24+ "repe movsb (%rsi), (%rdi) " ,
2425 inout( "rcx" ) count => _,
2526 inout( "rdi" ) dest => _,
2627 inout( "rsi" ) src => _,
27- options( nostack, preserves_flags)
28+ options( att_syntax , nostack, preserves_flags)
2829 ) ;
2930}
3031
@@ -33,47 +34,50 @@ pub unsafe fn copy_forward(dest: *mut u8, src: *const u8, count: usize) {
3334pub unsafe fn copy_forward ( dest : * mut u8 , src : * const u8 , count : usize ) {
3435 let qword_count = count >> 3 ;
3536 let byte_count = count & 0b111 ;
37+ // FIXME: Use the Intel syntax once we drop LLVM 9 support on rust-lang/rust.
3638 asm ! (
37- "rep movsq [rdi], [rsi] " ,
38- "mov ecx, {byte_count:e}" ,
39- "rep movsb [rdi], [rsi] " ,
39+ "repe movsq (%rsi), (%rdi) " ,
40+ "mov {byte_count:e}, %ecx " ,
41+ "repe movsb (%rsi), (%rdi) " ,
4042 byte_count = in( reg) byte_count,
4143 inout( "rcx" ) qword_count => _,
4244 inout( "rdi" ) dest => _,
4345 inout( "rsi" ) src => _,
44- options( nostack, preserves_flags)
46+ options( att_syntax , nostack, preserves_flags)
4547 ) ;
4648}
4749
4850#[ inline( always) ]
4951pub unsafe fn copy_backward ( dest : * mut u8 , src : * const u8 , count : usize ) {
5052 let qword_count = count >> 3 ;
5153 let byte_count = count & 0b111 ;
54+ // FIXME: Use the Intel syntax once we drop LLVM 9 support on rust-lang/rust.
5255 asm ! (
5356 "std" ,
54- "rep movsq [rdi], [rsi] " ,
55- "mov ecx, {byte_count:e}" ,
56- "add rdi, 7 " ,
57- "add rsi, 7 " ,
58- "rep movsb [rdi], [rsi] " ,
57+ "repe movsq (%rsi), (%rdi) " ,
58+ "movl {byte_count:e}, %ecx " ,
59+ "addq $7, %rdi " ,
60+ "addq $7, %rsi " ,
61+ "repe movsb (%rsi), (%rdi) " ,
5962 "cld" ,
6063 byte_count = in( reg) byte_count,
6164 inout( "rcx" ) qword_count => _,
6265 inout( "rdi" ) dest. add( count) . wrapping_sub( 8 ) => _,
6366 inout( "rsi" ) src. add( count) . wrapping_sub( 8 ) => _,
64- options( nostack)
67+ options( att_syntax , nostack)
6568 ) ;
6669}
6770
6871#[ inline( always) ]
6972#[ cfg( target_feature = "ermsb" ) ]
7073pub unsafe fn set_bytes ( dest : * mut u8 , c : u8 , count : usize ) {
74+ // FIXME: Use the Intel syntax once we drop LLVM 9 support on rust-lang/rust.
7175 asm ! (
72- "rep stosb [rdi], al " ,
76+ "repe stosb %al, (%rdi) " ,
7377 inout( "rcx" ) count => _,
7478 inout( "rdi" ) dest => _,
7579 inout( "al" ) c => _,
76- options( nostack, preserves_flags)
80+ options( att_syntax , nostack, preserves_flags)
7781 )
7882}
7983
@@ -82,14 +86,15 @@ pub unsafe fn set_bytes(dest: *mut u8, c: u8, count: usize) {
8286pub unsafe fn set_bytes ( dest : * mut u8 , c : u8 , count : usize ) {
8387 let qword_count = count >> 3 ;
8488 let byte_count = count & 0b111 ;
89+ // FIXME: Use the Intel syntax once we drop LLVM 9 support on rust-lang/rust.
8590 asm ! (
86- "rep stosq [rdi], rax " ,
87- "mov ecx, {byte_count:e}" ,
88- "rep stosb [rdi], al " ,
91+ "repe stosq %rax, (%rdi) " ,
92+ "mov {byte_count:e}, %ecx " ,
93+ "repe stosb %al, (%rdi) " ,
8994 byte_count = in( reg) byte_count,
9095 inout( "rcx" ) qword_count => _,
9196 inout( "rdi" ) dest => _,
9297 in( "rax" ) ( c as u64 ) * 0x0101010101010101 ,
93- options( nostack, preserves_flags)
98+ options( att_syntax , nostack, preserves_flags)
9499 ) ;
95100}
0 commit comments