-
Notifications
You must be signed in to change notification settings - Fork 15.7k
Open
Labels
Description
When trying to compile code for the m68k platform that uses the abcd and sbcd instructions:
int abcd(unsigned char a, unsigned char b)
{
asm("abcd %1, %0" : "+r"(a) : "r"(b));
return a;
}
int sbcd(unsigned char a, unsigned char b)
{
asm("sbcd %1, %0" : "+r"(a) : "r"(b));
return a;
}clang fails with the following error:
abcd-sbcd.c:3:9: error: unexpected token parsing operands
3 | asm("abcd %1, %0" : "+r"(a) : "r"(b));
| ^
<inline asm>:1:7: note: instantiated into assembly here
1 | abcd %d0, %d1
| ^
abcd-sbcd.c:9:9: error: unexpected token parsing operands
9 | asm("sbcd %1, %0" : "+r"(a) : "r"(b));
| ^
<inline asm>:1:7: note: instantiated into assembly here
1 | sbcd %d0, %d1
| ^
2 errors generated.
This is a code generator problem, since LLVM is correctly emitted, and the error also appears on Rust. I am attaching a .zip file containing the .c file I tried to compile, the .bc file generated by clang -Wall -O3 -target=m68k --emit-llvm -c -o <file> and the reductions made by bugpoint: llvm-m68k-abcd-sbcd-bug.zip