[llvm] [AArch64][GlobalISel] Expand abs.v4i8 to v4i16 and abs.v2s16 to v2s32 (PR #81231)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 8 22:29:22 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-aarch64
Author: Dhruv Chawla (work) (dc03-work)
<details>
<summary>Changes</summary>
GISel was currently falling back to SDAG for these functions, and this matches the way SDAG currently generates code for these functions.
---
Full diff: https://github.com/llvm/llvm-project/pull/81231.diff
2 Files Affected:
- (modified) llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp (+6)
- (modified) llvm/test/CodeGen/AArch64/abs.ll (-3)
``````````diff
diff --git a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
index cbf5655706e694..5dc3ebf09d17e5 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
@@ -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); })
.clampNumElements(0, v8s8, v16s8)
.clampNumElements(0, v4s16, v8s16)
.clampNumElements(0, v2s32, v4s32)
diff --git a/llvm/test/CodeGen/AArch64/abs.ll b/llvm/test/CodeGen/AArch64/abs.ll
index 934aae9ec74c03..260631c414eddc 100644
--- a/llvm/test/CodeGen/AArch64/abs.ll
+++ b/llvm/test/CodeGen/AArch64/abs.ll
@@ -2,9 +2,6 @@
; RUN: llc -mtriple=aarch64-none-linux-gnu %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-SD
; RUN: llc -mtriple=aarch64-none-linux-gnu -global-isel -global-isel-abort=2 %s -o - 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-GI
-; CHECK-GI: warning: Instruction selection used fallback path for abs_v4i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for abs_v2i16
-
; ===== Legal Scalars =====
define i8 @abs_i8(i8 %a){
``````````
</details>
https://github.com/llvm/llvm-project/pull/81231
More information about the llvm-commits
mailing list