Issue 119963
Summary Clang doesn't accept udiv with 2 operands when assembling for Cortex-M3
Labels clang
Assignees
Reporter mateusz-banaszek
    When using clang to assemble for ARM Cortex-M3, it doesn't accept an `udiv` instruction with 2 operands, for example:

```asm
.syntax unified

udiv r10, r5
```

An attempt to assemble that using clang v19.1.5:

```
clang -nodefaultlibs -mcpu=cortex-m3 --target=armv7m-none-eabi ./example.s
```

results in an error:

```
./example.s:3:15: error: too few operands for instruction
udiv   r10, r5
              ^
```

However, *Arm v7-M Architecture Reference Manual* says that the assembler syntax is `UDIV<c><q> {<Rd>,} <Rn>, <Rm>` where *"`<Rd>` Specifies the destination register. If `<Rd>` is omitted, this register is the same as `<Rn>`."* As a result, I expect clang to assemble that into:
```
fbba faf5   udiv r10, r10, r5
```
GCC assembles it correctly: https://godbolt.org/z/oh8TnW99T.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to