[llvm] 0e48992 - GlobalISel: Handle widening addo/subo booleans
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 12 13:54:13 PDT 2022
Author: Matt Arsenault
Date: 2022-04-12T16:54:03-04:00
New Revision: 0e489926be00326b09fb4dd51d76c758056d358c
URL: https://github.com/llvm/llvm-project/commit/0e489926be00326b09fb4dd51d76c758056d358c
DIFF: https://github.com/llvm/llvm-project/commit/0e489926be00326b09fb4dd51d76c758056d358c.diff
LOG: GlobalISel: Handle widening addo/subo booleans
This will be tested in a future patch
Added:
Modified:
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
index deba716ee1d87..370a13e599e96 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
@@ -1870,9 +1870,6 @@ LegalizerHelper::widenScalarInsert(MachineInstr &MI, unsigned TypeIdx,
LegalizerHelper::LegalizeResult
LegalizerHelper::widenScalarAddSubOverflow(MachineInstr &MI, unsigned TypeIdx,
LLT WideTy) {
- if (TypeIdx == 1)
- return UnableToLegalize; // TODO
-
unsigned Opcode;
unsigned ExtOpcode;
Optional<Register> CarryIn = None;
@@ -1917,6 +1914,18 @@ LegalizerHelper::widenScalarAddSubOverflow(MachineInstr &MI, unsigned TypeIdx,
break;
}
+ if (TypeIdx == 1) {
+ unsigned BoolExtOp = MIRBuilder.getBoolExtOp(WideTy.isVector(), false);
+
+ Observer.changingInstr(MI);
+ widenScalarDst(MI, WideTy, 1);
+ if (CarryIn)
+ widenScalarSrc(MI, WideTy, 4, BoolExtOp);
+
+ Observer.changedInstr(MI);
+ return Legalized;
+ }
+
auto LHSExt = MIRBuilder.buildInstr(ExtOpcode, {WideTy}, {MI.getOperand(2)});
auto RHSExt = MIRBuilder.buildInstr(ExtOpcode, {WideTy}, {MI.getOperand(3)});
// Do the arithmetic in the larger type.
More information about the llvm-commits
mailing list