[PATCH] D89952: [SelectionDAG] Fine tune CTPOP optimizations
David Zarzycki via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 22 10:49:32 PDT 2020
davezarzycki added inline comments.
================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:5340
+
+ // Horizontal add makes this easy.
+ if (Subtarget.hasBITALG())
----------------
craig.topper wrote:
> What do you mean by horizontal add here?
I was being imprecise. I meant VPSADBW(zero, VPOPCNTB(x)), which for CTPOP emulation is purposes is a horizontal add of the byte-wise CTPOP.
================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:5344
+ if (Subtarget.hasVPOPCNTDQ())
+ return Subtarget.hasBWI() ? 4 : 1;
+
----------------
craig.topper wrote:
> Why does having BWI increase the number? And why is element size not factored in here?
Please ignore that for now. I'm refining these heuristics. It's complicated by the fact that the vector CTPOP emulation on x86 doesn't always behave like I'd expect, so I need to go case by case. I'll upload the current heuristics that I'm working with before I stop working for the day.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89952/new/
https://reviews.llvm.org/D89952
More information about the llvm-commits
mailing list