| Issue |
238926
|
| Summary |
[AArch64] Inline asm "r" operand of type i128 is given 32-bit registers, losing the high 64 bits
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
Joel-Wwalker
|
On AArch64, an `i128` (`__int128`) inline asm operand with the `r` constraint is given two 32-bit registers, so the upper 64 bits of the value are dropped. This happens with SelectionDAG at every optimization level.
```llvm
define i128 @f(i128 %x) {
%r = call i128 asm sideeffect "", "=&r,0"(i128 %x)
ret i128 %r
}
```
`llc -mtriple=aarch64-linux-gnu -O2`:
```
f:
lsr x8, x0, #32
//APP
//NO_APP
mov w9, w0
orr x0, x9, x8, lsl #32
ret
```
`x1`, the high half of the result, is never written, so `f` does not return its argument. After instruction selection the asm is `INLINEASM &"", sideeffect attdialect, regdef-ec:GPR32common, def early-clobber %2, def early-clobber %3, reguse tiedto:$0, %4(tied-def 3), %5(tied-def 4)`, and only `$x0` is live-in. An untied `"=&r,r"` operand gets `GPR32common` too.
`AArch64TargetLowering::getRegForInlineAsmConstraint` returns `GPR64common` for `r` only when the type is exactly 64 bits wide, and `GPR32common` for every other size, including 128.
Assisted by Claude (Anthropic).
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs