[PATCH] D159278: [AArch64] Improve vector multiply by constant
Priyanshi Agarwal via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 31 05:54:14 PDT 2023
ipriyanshi1708 created this revision.
Herald added subscribers: sunshaoce, hiraditya, kristof.beyls.
Herald added a project: All.
ipriyanshi1708 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Issue: https://github.com/llvm/llvm-project/issues/54651
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D159278
Files:
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.h
Index: llvm/lib/Target/AArch64/AArch64ISelLowering.h
===================================================================
--- llvm/lib/Target/AArch64/AArch64ISelLowering.h
+++ llvm/lib/Target/AArch64/AArch64ISelLowering.h
@@ -1201,7 +1201,8 @@
unsigned Depth) const override;
bool isTargetCanonicalConstantNode(SDValue Op) const override;
-
+ bool decomposeMulByConstant(LLVMContext &Context, EVT VT,
+ SDValue C) const override;
// With the exception of data-predicate transitions, no instructions are
// required to cast between legal scalable vector types. However:
// 1. Packed and unpacked types have different bit lengths, meaning BITCAST
Index: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -24327,6 +24327,19 @@
return Ty1 == Ty2 && (Ty1 == LLT::scalar(32) || Ty1 == LLT::scalar(64));
}
+bool AArch64TargetLowering::decomposeMulByConstant(LLVMContext &Context, EVT VT,
+ SDValue C) const {
+ if (VT == MVT::v2i64)
+ return true;
+
+ APInt MulC;
+ if (!ISD::isConstantSplatVector(C.getNode(), MulC))
+ return false;
+
+ return (MulC + 1).isPowerOf2() || (MulC - 1).isPowerOf2() ||
+ (1 - MulC).isPowerOf2() || (-(MulC + 1)).isPowerOf2();
+}
+
bool AArch64TargetLowering::isComplexDeinterleavingSupported() const {
return Subtarget->hasComplxNum();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159278.555005.patch
Type: text/x-patch
Size: 1593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230831/8461806c/attachment.bin>
More information about the llvm-commits
mailing list