[llvm] ca0aa44 - [GlobalIsel][X86] Update legalization of G_UADDE
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 14 07:35:30 PDT 2023
Author: Simon Pilgrim
Date: 2023-06-14T15:34:12+01:00
New Revision: ca0aa4490f0b6fb8b4e5b9aa3bbf22226ae43807
URL: https://github.com/llvm/llvm-project/commit/ca0aa4490f0b6fb8b4e5b9aa3bbf22226ae43807
DIFF: https://github.com/llvm/llvm-project/commit/ca0aa4490f0b6fb8b4e5b9aa3bbf22226ae43807.diff
LOG: [GlobalIsel][X86] Update legalization of G_UADDE
Replace the legacy legalizer versions - still WIP but matches existing s32 handling, we should be able to add full scalar support for G_UADDO/G_USUBE/G_USUBO as well very easily
Added:
Modified:
llvm/lib/Target/X86/X86LegalizerInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86LegalizerInfo.cpp b/llvm/lib/Target/X86/X86LegalizerInfo.cpp
index cda79422daddd..d7114791e01ac 100644
--- a/llvm/lib/Target/X86/X86LegalizerInfo.cpp
+++ b/llvm/lib/Target/X86/X86LegalizerInfo.cpp
@@ -110,6 +110,14 @@ X86LegalizerInfo::X86LegalizerInfo(const X86Subtarget &STI,
.clampScalar(0, s8, sMaxScalar)
.scalarize(0);
+ // TODO: Add all legal scalar types.
+ // TODO: Add G_UADDO/G_USUBO/G_USUBE handling
+ getActionDefinitionsBuilder(G_UADDE)
+ .legalFor({{s32, s1}})
+ .widenScalarToNextPow2(0, /*Min=*/32)
+ .clampScalar(0, s32, s32)
+ .scalarize(0);
+
// integer multiply
getActionDefinitionsBuilder(G_MUL)
.legalIf([=](const LegalityQuery &Query) -> bool {
@@ -409,7 +417,6 @@ bool X86LegalizerInfo::legalizeIntrinsic(LegalizerHelper &Helper,
void X86LegalizerInfo::setLegalizerInfo32bit() {
const LLT p0 = LLT::pointer(0, TM.getPointerSizeInBits(0));
- const LLT s1 = LLT::scalar(1);
const LLT s8 = LLT::scalar(8);
const LLT s16 = LLT::scalar(16);
const LLT s32 = LLT::scalar(32);
@@ -417,11 +424,6 @@ void X86LegalizerInfo::setLegalizerInfo32bit() {
auto &LegacyInfo = getLegacyLegalizerInfo();
- for (unsigned Op : {G_UADDE}) {
- LegacyInfo.setAction({Op, s32}, LegacyLegalizeActions::Legal);
- LegacyInfo.setAction({Op, 1, s1}, LegacyLegalizeActions::Legal);
- }
-
for (unsigned MemOp : {G_LOAD, G_STORE}) {
for (auto Ty : {s8, s16, s32, p0})
LegacyInfo.setAction({MemOp, Ty}, LegacyLegalizeActions::Legal);
More information about the llvm-commits
mailing list