@@ -22,13 +22,12 @@ use core::{intrinsics, mem};
22
22
#[ inline( always) ]
23
23
#[ cfg( target_feature = "ermsb" ) ]
24
24
pub 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]" ,
28
27
inout( "rcx" ) count => _,
29
28
inout( "rdi" ) dest => _,
30
29
inout( "rsi" ) src => _,
31
- options( att_syntax , nostack, preserves_flags)
30
+ options( nostack, preserves_flags)
32
31
) ;
33
32
}
34
33
@@ -42,21 +41,21 @@ pub unsafe fn copy_forward(mut dest: *mut u8, mut src: *const u8, count: usize)
42
41
inout( "ecx" ) pre_byte_count => _,
43
42
inout( "rdi" ) dest => dest,
44
43
inout( "rsi" ) src => src,
45
- options( att_syntax , nostack, preserves_flags)
44
+ options( nostack, preserves_flags)
46
45
) ;
47
46
asm ! (
48
47
"rep movsq" ,
49
48
inout( "rcx" ) qword_count => _,
50
49
inout( "rdi" ) dest => dest,
51
50
inout( "rsi" ) src => src,
52
- options( att_syntax , nostack, preserves_flags)
51
+ options( nostack, preserves_flags)
53
52
) ;
54
53
asm ! (
55
54
"rep movsb" ,
56
55
inout( "ecx" ) byte_count => _,
57
56
inout( "rdi" ) dest => _,
58
57
inout( "rsi" ) src => _,
59
- options( att_syntax , nostack, preserves_flags)
58
+ options( nostack, preserves_flags)
60
59
) ;
61
60
}
62
61
@@ -67,14 +66,14 @@ pub unsafe fn copy_backward(dest: *mut u8, src: *const u8, count: usize) {
67
66
asm ! (
68
67
"std" ,
69
68
"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}" ,
73
72
"rep movsq" ,
74
73
"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}" ,
78
77
"rep movsb" ,
79
78
"cld" ,
80
79
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) {
83
82
inout( "rdi" ) dest. add( count - 1 ) => _,
84
83
inout( "rsi" ) src. add( count - 1 ) => _,
85
84
// We modify flags, but we restore it afterwards
86
- options( att_syntax , nostack, preserves_flags)
85
+ options( nostack, preserves_flags)
87
86
) ;
88
87
}
89
88
90
89
#[ inline( always) ]
91
90
#[ cfg( target_feature = "ermsb" ) ]
92
91
pub 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" ,
96
94
inout( "rcx" ) count => _,
97
95
inout( "rdi" ) dest => _,
98
96
inout( "al" ) c => _,
99
- options( att_syntax , nostack, preserves_flags)
97
+ options( nostack, preserves_flags)
100
98
)
101
99
}
102
100
@@ -111,21 +109,21 @@ pub unsafe fn set_bytes(mut dest: *mut u8, c: u8, count: usize) {
111
109
inout( "ecx" ) pre_byte_count => _,
112
110
inout( "rdi" ) dest => dest,
113
111
in( "rax" ) c,
114
- options( att_syntax , nostack, preserves_flags)
112
+ options( nostack, preserves_flags)
115
113
) ;
116
114
asm ! (
117
115
"rep stosq" ,
118
116
inout( "rcx" ) qword_count => _,
119
117
inout( "rdi" ) dest => dest,
120
118
in( "rax" ) c,
121
- options( att_syntax , nostack, preserves_flags)
119
+ options( nostack, preserves_flags)
122
120
) ;
123
121
asm ! (
124
122
"rep stosb" ,
125
123
inout( "ecx" ) byte_count => _,
126
124
inout( "rdi" ) dest => _,
127
125
in( "rax" ) c,
128
- options( att_syntax , nostack, preserves_flags)
126
+ options( nostack, preserves_flags)
129
127
) ;
130
128
}
131
129
@@ -212,10 +210,10 @@ pub unsafe fn c_string_length(mut s: *const core::ffi::c_char) -> usize {
212
210
let x = {
213
211
let r;
214
212
asm ! (
215
- "movdqa ({addr}), {dest} " ,
213
+ "movdqa {dest}, [{addr}] " ,
216
214
addr = in( reg) s,
217
215
dest = out( xmm_reg) r,
218
- options( att_syntax , nostack ) ,
216
+ options( nostack , preserves_flags ) ,
219
217
) ;
220
218
r
221
219
} ;
@@ -232,10 +230,10 @@ pub unsafe fn c_string_length(mut s: *const core::ffi::c_char) -> usize {
232
230
let x = {
233
231
let r;
234
232
asm ! (
235
- "movdqa ({addr}), {dest} " ,
233
+ "movdqa {dest}, [{addr}] " ,
236
234
addr = in( reg) s,
237
235
dest = out( xmm_reg) r,
238
- options( att_syntax , nostack ) ,
236
+ options( nostack , preserves_flags ) ,
239
237
) ;
240
238
r
241
239
} ;
@@ -277,10 +275,10 @@ pub unsafe fn c_string_length(mut s: *const core::ffi::c_char) -> usize {
277
275
let mut cs = {
278
276
let r: u64 ;
279
277
asm ! (
280
- "mov ({addr}), {dest} " ,
278
+ "mov {dest}, [{addr}] " ,
281
279
addr = in( reg) s,
282
280
dest = out( reg) r,
283
- options( att_syntax , nostack ) ,
281
+ options( nostack , preserves_flags ) ,
284
282
) ;
285
283
r
286
284
} ;
0 commit comments