@@ -22,13 +22,12 @@ use core::{intrinsics, mem};
2222#[ inline( always) ]
2323#[ cfg( target_feature = "ermsb" ) ]
2424pub unsafe fn copy_forward ( dest : * mut u8 , src : * const u8 , count : usize ) {
25- // FIXME: Use the Intel syntax once we drop LLVM 9 support on rust-lang/rust.
26- core:: arch:: asm!(
27- "repe movsb (%rsi), (%rdi)" ,
25+ asm ! (
26+ "repe movsb [rdi], [rsi]" ,
2827 inout( "rcx" ) count => _,
2928 inout( "rdi" ) dest => _,
3029 inout( "rsi" ) src => _,
31- options( att_syntax , nostack, preserves_flags)
30+ options( nostack, preserves_flags)
3231 ) ;
3332}
3433
@@ -42,21 +41,21 @@ pub unsafe fn copy_forward(mut dest: *mut u8, mut src: *const u8, count: usize)
4241 inout( "ecx" ) pre_byte_count => _,
4342 inout( "rdi" ) dest => dest,
4443 inout( "rsi" ) src => src,
45- options( att_syntax , nostack, preserves_flags)
44+ options( nostack, preserves_flags)
4645 ) ;
4746 asm ! (
4847 "rep movsq" ,
4948 inout( "rcx" ) qword_count => _,
5049 inout( "rdi" ) dest => dest,
5150 inout( "rsi" ) src => src,
52- options( att_syntax , nostack, preserves_flags)
51+ options( nostack, preserves_flags)
5352 ) ;
5453 asm ! (
5554 "rep movsb" ,
5655 inout( "ecx" ) byte_count => _,
5756 inout( "rdi" ) dest => _,
5857 inout( "rsi" ) src => _,
59- options( att_syntax , nostack, preserves_flags)
58+ options( nostack, preserves_flags)
6059 ) ;
6160}
6261
@@ -67,14 +66,14 @@ pub unsafe fn copy_backward(dest: *mut u8, src: *const u8, count: usize) {
6766 asm ! (
6867 "std" ,
6968 "rep movsb" ,
70- "sub $7, %rsi " ,
71- "sub $7, %rdi " ,
72- "mov {qword_count}, %rcx " ,
69+ "sub rsi, 7 " ,
70+ "sub rdi, 7 " ,
71+ "mov rcx, {qword_count}" ,
7372 "rep movsq" ,
7473 "test {pre_byte_count:e}, {pre_byte_count:e}" ,
75- "add $7, %rsi " ,
76- "add $7, %rdi " ,
77- "mov {pre_byte_count:e}, %ecx " ,
74+ "add rsi, 7 " ,
75+ "add rdi, 7 " ,
76+ "mov ecx, {pre_byte_count:e}" ,
7877 "rep movsb" ,
7978 "cld" ,
8079 pre_byte_count = in( reg) pre_byte_count,
@@ -83,20 +82,19 @@ pub unsafe fn copy_backward(dest: *mut u8, src: *const u8, count: usize) {
8382 inout( "rdi" ) dest. add( count - 1 ) => _,
8483 inout( "rsi" ) src. add( count - 1 ) => _,
8584 // We modify flags, but we restore it afterwards
86- options( att_syntax , nostack, preserves_flags)
85+ options( nostack, preserves_flags)
8786 ) ;
8887}
8988
9089#[ inline( always) ]
9190#[ cfg( target_feature = "ermsb" ) ]
9291pub unsafe fn set_bytes ( dest : * mut u8 , c : u8 , count : usize ) {
93- // FIXME: Use the Intel syntax once we drop LLVM 9 support on rust-lang/rust.
94- core:: arch:: asm!(
95- "repe stosb %al, (%rdi)" ,
92+ asm ! (
93+ "repe stosb [rdi], al" ,
9694 inout( "rcx" ) count => _,
9795 inout( "rdi" ) dest => _,
9896 inout( "al" ) c => _,
99- options( att_syntax , nostack, preserves_flags)
97+ options( nostack, preserves_flags)
10098 )
10199}
102100
@@ -111,21 +109,21 @@ pub unsafe fn set_bytes(mut dest: *mut u8, c: u8, count: usize) {
111109 inout( "ecx" ) pre_byte_count => _,
112110 inout( "rdi" ) dest => dest,
113111 in( "rax" ) c,
114- options( att_syntax , nostack, preserves_flags)
112+ options( nostack, preserves_flags)
115113 ) ;
116114 asm ! (
117115 "rep stosq" ,
118116 inout( "rcx" ) qword_count => _,
119117 inout( "rdi" ) dest => dest,
120118 in( "rax" ) c,
121- options( att_syntax , nostack, preserves_flags)
119+ options( nostack, preserves_flags)
122120 ) ;
123121 asm ! (
124122 "rep stosb" ,
125123 inout( "ecx" ) byte_count => _,
126124 inout( "rdi" ) dest => _,
127125 in( "rax" ) c,
128- options( att_syntax , nostack, preserves_flags)
126+ options( nostack, preserves_flags)
129127 ) ;
130128}
131129
@@ -212,10 +210,10 @@ pub unsafe fn c_string_length(mut s: *const core::ffi::c_char) -> usize {
212210 let x = {
213211 let r;
214212 asm ! (
215- "movdqa ({addr}), {dest} " ,
213+ "movdqa {dest}, [{addr}] " ,
216214 addr = in( reg) s,
217215 dest = out( xmm_reg) r,
218- options( att_syntax , nostack ) ,
216+ options( nostack , preserves_flags ) ,
219217 ) ;
220218 r
221219 } ;
@@ -232,10 +230,10 @@ pub unsafe fn c_string_length(mut s: *const core::ffi::c_char) -> usize {
232230 let x = {
233231 let r;
234232 asm ! (
235- "movdqa ({addr}), {dest} " ,
233+ "movdqa {dest}, [{addr}] " ,
236234 addr = in( reg) s,
237235 dest = out( xmm_reg) r,
238- options( att_syntax , nostack ) ,
236+ options( nostack , preserves_flags ) ,
239237 ) ;
240238 r
241239 } ;
@@ -277,10 +275,10 @@ pub unsafe fn c_string_length(mut s: *const core::ffi::c_char) -> usize {
277275 let mut cs = {
278276 let r: u64 ;
279277 asm ! (
280- "mov ({addr}), {dest} " ,
278+ "mov {dest}, [{addr}] " ,
281279 addr = in( reg) s,
282280 dest = out( reg) r,
283- options( att_syntax , nostack ) ,
281+ options( nostack , preserves_flags ) ,
284282 ) ;
285283 r
286284 } ;
0 commit comments