[PATCH] D109201: [AMDGPU] Process any power of 2 in optimizeCompareInstr
Stanislav Mekhanoshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 3 03:31:16 PDT 2021
rampitec added inline comments.
================
Comment at: llvm/lib/Target/AMDGPU/SIInstrInfo.cpp:8036
+ //
+ // Signed ge/gt are not used for the sign bit.
//
----------------
foad wrote:
> Yeah that is an ugly special case. Do we really need to handle ge/gt here at all? Can't we rely on something else canonicalizing them all to eq/ne comparisons?
It must be even uglier since llvm tends to change "a >= i" to "a > i - 1". So in practice it is canonicacalized to be not a power of 2 often. That is really so much interlinked...
In addition it tends to kill any known power of 2 by replacing it with a shift and comparing a low bit. I feel somewhat lost trying to deoptimize.
================
Comment at: llvm/lib/Target/AMDGPU/SIInstrInfo.cpp:8119
.add(*SrcOp)
- .addImm(0);
+ .addImm(Log2_64(Mask));
Def->eraseFromParent();
----------------
foad wrote:
> Isn't this just `BitNo`?
Yes, silly. Too much changes and copy-paste.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109201/new/
https://reviews.llvm.org/D109201
More information about the llvm-commits
mailing list