[llvm] [NVPTX] Propagate truncate to operands (PR #98666)
Artem Belevich via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 12 12:23:08 PDT 2024
================
@@ -5541,6 +5541,53 @@ static SDValue PerformREMCombine(SDNode *N,
return SDValue();
}
+// truncate (logic_op x, y) --> logic_op (truncate x), (truncate y)
+// This will reduce register pressure.
+static SDValue PerformTruncCombine(SDNode *N,
+ TargetLowering::DAGCombinerInfo &DCI) {
+ if (!DCI.isBeforeLegalizeOps())
+ return SDValue();
+
+ SDValue LogicalOp = N->getOperand(0);
+ switch (LogicalOp.getOpcode()) {
+ default:
+ break;
+ case ISD::ADD:
+ case ISD::SUB:
+ case ISD::MUL:
----------------
Artem-B wrote:
Nit. We could push the optimization for `mul` even further.
If the result is truncated to 32-bit, we could convert it to mul.wide of 16-bit operands. Not sure, though, if it's actually going to help on the SASS level, though. This is probably something that ptxas can deal with.
https://github.com/llvm/llvm-project/pull/98666
More information about the llvm-commits
mailing list