[llvm] [AArch64][GlobalISel] Expand abs.v4i8 to v4i16 and abs.v2s16 to v2s32 (PR #81231)
Dhruv Chawla via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 8 23:35:06 PST 2024
================
@@ -993,6 +993,12 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST)
ABSActions
.legalFor({s32, s64});
ABSActions.legalFor(PackedVectorAllTypeList)
+ .widenScalarIf(
+ [=](const LegalityQuery &Query) { return Query.Types[0] == v4s8; },
+ [=](const LegalityQuery &Query) { return std::make_pair(0, v4s16); })
+ .widenScalarIf(
+ [=](const LegalityQuery &Query) { return Query.Types[0] == v2s16; },
+ [=](const LegalityQuery &Query) { return std::make_pair(0, v2s32); })
----------------
dc03-work wrote:
Causes a crash:
```
Assertion failed: (mutationIsSane(Rule, Query, Mutation) && "legality mutation invalid for match"), function apply, file LegalizerInfo.cpp, line 200.
```
```diff
diff --git a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
index 5dc3ebf09d17..3c84302ff84a 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
@@ -993,12 +993,7 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST)
ABSActions
.legalFor({s32, s64});
ABSActions.legalFor(PackedVectorAllTypeList)
- .widenScalarIf(
- [=](const LegalityQuery &Query) { return Query.Types[0] == v4s8; },
- [=](const LegalityQuery &Query) { return std::make_pair(0, v4s16); })
- .widenScalarIf(
- [=](const LegalityQuery &Query) { return Query.Types[0] == v2s16; },
- [=](const LegalityQuery &Query) { return std::make_pair(0, v2s32); })
+ .widenVectorEltsToVectorMinSize(0, 64)
.clampNumElements(0, v8s8, v16s8)
.clampNumElements(0, v4s16, v8s16)
.clampNumElements(0, v2s32, v4s32)
```
https://github.com/llvm/llvm-project/pull/81231
More information about the llvm-commits
mailing list