[PATCH] D108725: [AArch64][GlobalISel] Implement custom legalization for s32/s64 G_FCOPYSIGN
Jessica Paquette via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 25 17:16:19 PDT 2021
paquette added inline comments.
================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp:1393
+ auto Zero = MIRBuilder.buildConstant(DstTy, 0);
+ auto Ins1 = MIRBuilder.buildInsertVectorElement(
+ VecTy, Undef, MI.getOperand(1).getReg(), Zero);
----------------
aemerson wrote:
> What if we use G_MERGE instead? Do we get an INSERT_SUBREG?
Not quite.
We get the following for s32 with G_MERGE_VALUES:
```
legalize_s32:
adrp x8, .LCPI0_0
mov v0.s[1], v0.s[0]
mov v1.s[1], v0.s[0]
ldr q2, [x8, :lo12:.LCPI0_0]
mov v0.s[2], v0.s[0]
mov v0.s[3], v0.s[0]
mov v1.s[2], v0.s[0]
mov v1.s[3], v0.s[0]
bit v0.16b, v1.16b, v2.16b
ret
```
Meanwhile, with SDAG we get
```
movi v2.4s, #128, lsl #24 ; We should emit the constant like this, but we don't have that optimization
bit v0.16b, v1.16b, v2.16b
ret
```
We can probably change the selector code to recognize the pattern though. Using G_INSERT_VECTOR_ELT is only slightly better.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108725/new/
https://reviews.llvm.org/D108725
More information about the llvm-commits
mailing list