[llvm] 6d8f889 - [GlobalIsel][X86] Move G_SHL/G_LSHR/G_ASHR legalization before legacy handling and merge 32-bit/64-bit handling
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 2 08:08:02 PDT 2023
Author: Simon Pilgrim
Date: 2023-06-02T16:07:48+01:00
New Revision: 6d8f889b734ad68c2f6229a51d0e4dd502740d78
URL: https://github.com/llvm/llvm-project/commit/6d8f889b734ad68c2f6229a51d0e4dd502740d78
DIFF: https://github.com/llvm/llvm-project/commit/6d8f889b734ad68c2f6229a51d0e4dd502740d78.diff
LOG: [GlobalIsel][X86] Move G_SHL/G_LSHR/G_ASHR legalization before legacy handling and merge 32-bit/64-bit handling
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 92e2d56cc354..4fbcd00e7cef 100644
--- a/llvm/lib/Target/X86/X86LegalizerInfo.cpp
+++ b/llvm/lib/Target/X86/X86LegalizerInfo.cpp
@@ -125,6 +125,15 @@ X86LegalizerInfo::X86LegalizerInfo(const X86Subtarget &STI,
})
.clampScalar(0, s8, sMaxScalar);
+ // integer shifts
+ getActionDefinitionsBuilder({G_SHL, G_LSHR, G_ASHR})
+ .legalIf([=](const LegalityQuery &Query) -> bool {
+ return typePairInSet(0, 1, {{s8, s8}, {s16, s8}, {s32, s8}})(Query) ||
+ (Is64Bit && typePairInSet(0, 1, {{s64, s8}})(Query));
+ })
+ .clampScalar(0, s8, sMaxScalar)
+ .clampScalar(1, s8, s8);
+
// bswap
getActionDefinitionsBuilder(G_BSWAP)
.legalIf([=](const LegalityQuery &Query) {
@@ -245,13 +254,6 @@ void X86LegalizerInfo::setLegalizerInfo32bit() {
.widenScalarToNextPow2(0, /*Min*/ 8);
getActionDefinitionsBuilder(G_INTTOPTR).legalFor({{p0, s32}});
- // Shifts
- getActionDefinitionsBuilder(
- {G_SHL, G_LSHR, G_ASHR})
- .legalFor({{s8, s8}, {s16, s8}, {s32, s8}})
- .clampScalar(0, s8, s32)
- .clampScalar(1, s8, s8);
-
// Comparison
getActionDefinitionsBuilder(G_ICMP)
.legalForCartesianProduct({s8}, {s8, s16, s32, p0})
@@ -357,13 +359,6 @@ void X86LegalizerInfo::setLegalizerInfo64bit() {
.clampScalar(1, s32, s64)
.widenScalarToNextPow2(1);
- // Shifts
- getActionDefinitionsBuilder(
- {G_SHL, G_LSHR, G_ASHR})
- .legalFor({{s8, s8}, {s16, s8}, {s32, s8}, {s64, s8}})
- .clampScalar(0, s8, s64)
- .clampScalar(1, s8, s8);
-
// Merge/Unmerge
LegacyInfo.setAction({G_MERGE_VALUES, s128}, LegacyLegalizeActions::Legal);
LegacyInfo.setAction({G_UNMERGE_VALUES, 1, s128},
More information about the llvm-commits
mailing list