[m68k] ABCD and SBCD instructions not recognized
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
When trying to compile code for the `m68k` platform that uses the `abcd` and `sbcd` instructions:
```c
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));
| ^
: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));
| ^
: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 ` and the reductions made by `bugpoint`: [llvm-m68k-abcd-sbcd-bug.zip](https://github.com/user-attachments/files/24417469/llvm-m68k-abcd-sbcd-bug.zip)
Contributor guide
Assessment
This issue has not been assessed yet.