Issue |
134550
|
Summary |
asm constraint
|
Labels |
new issue
|
Assignees |
|
Reporter |
ordinary-github-user
|
https://godbolt.org/z/3ffqeEvjP
```c++
#include <cstdint>
using u64 = std::uint64_t;
void test(u64 arg0, u64 arg1)
{
//u64 a,b;
asm volatile
(
"movb (%[a0]), %%al\n"
"movb (%[a1]), %%bl"
: //"=a"(a), "=b"(b) //tell compiler rax, and rbx are modified
: [a0]"abcdDS" (arg0), //use rax or rbx or rcx or rdx or rsi or rdi
[a1]"abcdDS" (arg1) //use rax or rbx or rcx or rdx or rsi or rdi
: "memory"
);
}
```
clang x86-64: -std=c++26 -O3 -Wall -fno-exceptions
```asm
test(unsigned long, unsigned long):
mov rax, rsi
mov al, byte ptr [rax]
mov bl, byte ptr [rax]
ret
```
gcc x86-64: -std=c++26 -O3 -Wall -fno-exceptions
```asm
test(unsigned long, unsigned long):
movb (rdi), %al
movb (rsi), %bl
ret
```
reason i use "abcdDS" instead of "r" is to use exclusively rax or rbx or rcx or rdx or rsi or rdi, not r8,r9...
gcc seems to understand what i want
clang on the other hand is treating "abcdDS" like just "a", and its not even using arg0 from rdi
also, sorry for bad title. cant think of anything more descriptive
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs