<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/57486>57486</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
llvm does not actually support armv2 or armv3
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
easyaspi314
</td>
</tr>
</table>
<pre>
llvm accepts the options for `-march=armv2` and `-march=armv3` without properly supporting the architecture.
Notably, it will use `umull`, `smull`, `ldr(s)h`, and `strh` which do not exist.
```llvm
define i32 @ldrh(i16 *%ptr) {
%val = load i16, i16 *%ptr, align 2
%zex = zext i16 %val to i32
ret i32 %zex
}
define void @strh(i16 *%ptr, i16 %val) {
store i16 %val, i16 * %ptr, align 2
ret void
}
define i64 @umull(i32 %x, i32 %y) {
%x64 = zext i32 %x to i64
%y64 = zext i32 %y to i64
%prod = mul nuw i64 %x64, %y64
ret i64 %prod
}
```
`clang --target=armv2-none-eabi -march=armv2 -O2 -S`
```asm
ldrh:
ldrh r0, [r0] // invalid
mov pc, lr
strh:
strh r1, [r0] // invalid
mov pc, lr
umull:
umull r2, r3, r1, r0 // invalid
mov r0, r2
mov r1, r3
mov pc, lr
```
This should be something like this:
```asm
ldrh:
ldrb r1, [r0, #1]
ldrb r0, [r0]
orr r0, r0, r1, lsl #8
mov pc, lr
strh:
lsr r2, r1, #8
strb r1, [r0]
strb r2, [r0, #1]
mov pc, lr
umull:
mov r2, r1
mov r1, #0
mov r3, #0
b __aeabi_lmul // tail call
```
Either these targets should be removed or these should be fixed.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydVcmSmzAQ_Rq4dNkFYjEcOEwyyTE5JPcpAW2jREaUJBw7X5-WhNeZLJUqbC3dev16UatV_amR8rAH3nU4WQN2QFCTFWo0sFUaojJZ7bnuhih75np_YLQBfOxfCTIn-CHsoGYLk1YTankCM0-T0laMO4_s9IX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