[PATCH] D22038: [X86] Transform zext+seteq+cmp into shr+lzcnt on btver2 architecture.

pierre gousseau via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 7 03:00:12 PDT 2016


pgousseau added a comment.

In http://reviews.llvm.org/D22038#475372, @spatel wrote:

> Did you look at doing this in DAGCombine with a TLI hook? PPC already has this or something very close in PPCTargetLowering::LowerSETCC(), so it seems like the code could simply be lifted up from there?
>
> Would x86 targets other than btver2 want to do this transform when optimizing for size?


I did not know there was a similar change in PPCTargetLowering, thanks for pointing it out, I will investigate this.
For the TLI hook I could add a method 'bool isCTLZFast()', which on X86, I suppose would be something like:
bool isCTLZFast() { return (hasLZCNT() && getCPU() == "btver2");}
It looks a bit less maintainable than the Target feature way though, what do you think?

Regarding the size, I have noticed that openssl does get smaller but I would need to do more testing to ensure this is always the case.


http://reviews.llvm.org/D22038





More information about the llvm-commits mailing list