[llvm] [AArch64][GlobalISel] Select UMULL instruction (PR #65469)
Amara Emerson via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 7 01:30:11 PDT 2023
https://github.com/aemerson requested changes to this pull request.
GlobalISel's custom legalization action doesn't work in the way that most would expect. When a custom legalization rule runs, the legalizer expects the result to be now fully legalized. Therefore you must completely handle every possible situation, since the legalizer will not re-add the instruction onto the worklist.
In this case, the legalization of `<2 x s64>` G_MUL for a specific pattern can fail and as a result illegal `<2 x s64>` G_MULs will escape. E.g the following:
```
---
name: long_mul
legalized: true
liveins:
- { reg: '$x0' }
- { reg: '$x1' }
body: |
bb.1:
liveins: $x0, $x1
%0:_(s64) = COPY $x0
%1:_(s64) = COPY $x1
%bv1:_(<2 x s64>) = G_BUILD_VECTOR %0, %0
%bv2:_(<2 x s64>) = G_BUILD_VECTOR %1, %1
%mul:_(<2 x s64>) = G_MUL %bv1, %bv2
$q0 = COPY %mul(<2 x s64>)
RET_ReallyLR implicit $q0
...
```
will not scalarize the G_MUL. I think you can fix this by directly calling the `LegalizerHelper::fewerElementsVector()` helper with a scalar type.
https://github.com/llvm/llvm-project/pull/65469
More information about the llvm-commits
mailing list