19
19
#[ inline( always) ]
20
20
#[ cfg( target_feature = "ermsb" ) ]
21
21
pub 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.
22
23
asm ! (
23
- "rep movsb [rdi], [rsi] " ,
24
+ "repe movsb (%rsi), (%rdi) " ,
24
25
inout( "rcx" ) count => _,
25
26
inout( "rdi" ) dest => _,
26
27
inout( "rsi" ) src => _,
27
- options( nostack, preserves_flags)
28
+ options( att_syntax , nostack, preserves_flags)
28
29
) ;
29
30
}
30
31
@@ -33,47 +34,50 @@ pub unsafe fn copy_forward(dest: *mut u8, src: *const u8, count: usize) {
33
34
pub unsafe fn copy_forward ( dest : * mut u8 , src : * const u8 , count : usize ) {
34
35
let qword_count = count >> 3 ;
35
36
let byte_count = count & 0b111 ;
37
+ // FIXME: Use the Intel syntax once we drop LLVM 9 support on rust-lang/rust.
36
38
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) " ,
40
42
byte_count = in( reg) byte_count,
41
43
inout( "rcx" ) qword_count => _,
42
44
inout( "rdi" ) dest => _,
43
45
inout( "rsi" ) src => _,
44
- options( nostack, preserves_flags)
46
+ options( att_syntax , nostack, preserves_flags)
45
47
) ;
46
48
}
47
49
48
50
#[ inline( always) ]
49
51
pub unsafe fn copy_backward ( dest : * mut u8 , src : * const u8 , count : usize ) {
50
52
let qword_count = count >> 3 ;
51
53
let byte_count = count & 0b111 ;
54
+ // FIXME: Use the Intel syntax once we drop LLVM 9 support on rust-lang/rust.
52
55
asm ! (
53
56
"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) " ,
59
62
"cld" ,
60
63
byte_count = in( reg) byte_count,
61
64
inout( "rcx" ) qword_count => _,
62
65
inout( "rdi" ) dest. add( count) . wrapping_sub( 8 ) => _,
63
66
inout( "rsi" ) src. add( count) . wrapping_sub( 8 ) => _,
64
- options( nostack)
67
+ options( att_syntax , nostack)
65
68
) ;
66
69
}
67
70
68
71
#[ inline( always) ]
69
72
#[ cfg( target_feature = "ermsb" ) ]
70
73
pub 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.
71
75
asm ! (
72
- "rep stosb [rdi], al " ,
76
+ "repe stosb %al, (%rdi) " ,
73
77
inout( "rcx" ) count => _,
74
78
inout( "rdi" ) dest => _,
75
79
inout( "al" ) c => _,
76
- options( nostack, preserves_flags)
80
+ options( att_syntax , nostack, preserves_flags)
77
81
)
78
82
}
79
83
@@ -82,14 +86,15 @@ pub unsafe fn set_bytes(dest: *mut u8, c: u8, count: usize) {
82
86
pub unsafe fn set_bytes ( dest : * mut u8 , c : u8 , count : usize ) {
83
87
let qword_count = count >> 3 ;
84
88
let byte_count = count & 0b111 ;
89
+ // FIXME: Use the Intel syntax once we drop LLVM 9 support on rust-lang/rust.
85
90
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) " ,
89
94
byte_count = in( reg) byte_count,
90
95
inout( "rcx" ) qword_count => _,
91
96
inout( "rdi" ) dest => _,
92
97
in( "rax" ) ( c as u64 ) * 0x0101010101010101 ,
93
- options( nostack, preserves_flags)
98
+ options( att_syntax , nostack, preserves_flags)
94
99
) ;
95
100
}
0 commit comments