-
Notifications
You must be signed in to change notification settings - Fork 232
Remove remaining traces of AT&T assembly syntax #911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
compiler-builtins/src/mem/x86_64.rs
Outdated
core::arch::asm!( | ||
"repe movsb (%rsi), (%rdi)", | ||
asm!( | ||
"repe movsb [rdi], rsi", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the original asm both rsi and rdi are dereferenced, here it’s only rdi. Is this still equivalent for some reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is. I fixed this.
core::arch::asm!( | ||
"repe movsb (%rsi), (%rdi)", | ||
asm!( | ||
"repe movsb [rdi], [rsi]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"repe movsb [rdi], [rsi]", | |
"rep movsb [rdi], [rsi]", |
The repe
mnemonic is for "repeat while equal" and only makes sense for the string comparison operations
https://www.felixcloutier.com/x86/rep:repe:repz:repne:repnz
(but the encoding is the same so I guess assemblers don't care)
core::arch::asm!( | ||
"repe stosb %al, (%rdi)", | ||
asm!( | ||
"repe stosb [rdi], al", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"repe stosb [rdi], al", | |
"rep stosb [rdi], al", |
// We modify flags, but we restore it afterwards | ||
options(att_syntax, nostack, preserves_flags) | ||
options(nostack, preserves_flags) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definitely shouldn't have preserves_flags
. Flags are modified by each of add
,sub
,test
. The comment refers to how std
/cld
are used to set/clear the direction flag, but that's separate since it must be cleared before exiting the inline assembly.
Actually, what is the point of the test
instruction here? It only affects flags, and none of the subsequent instructions depend on any flags.
The current minimum LLVM version seems to be 18, way larger than required for resolving this FIXME.