[PATCH] D130862: [LegalizeTypes] Improve splitting for urem/udiv by constant for some constants.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 12 09:22:28 PDT 2022
craig.topper added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:7237-7242
+ if (getBooleanContents(HiLoVT) ==
+ TargetLoweringBase::ZeroOrOneBooleanContent)
+ Carry = DAG.getZExtOrTrunc(Carry, dl, HiLoVT);
+ else
+ Carry = DAG.getSelect(dl, HiLoVT, Carry, DAG.getConstant(1, dl, HiLoVT),
+ DAG.getConstant(0, dl, HiLoVT));
----------------
arsenm wrote:
> Can't you just unconditionally use getZExtOrTrunc? the booleancontents would just apply the optimization fold later
I wrote it like this because that's what was done for ISD::SUB at the end of ExpandIntRes_ADDSUB. ISD::ADD in that function seemed more complicated that it needs to be.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130862/new/
https://reviews.llvm.org/D130862
More information about the llvm-commits
mailing list