[PATCH] D100177: [X86][BMI] Fold cmpeq(or(X,Y),X) --> cmpeq(and(~X,Y),0) (PR44136)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 9 04:26:24 PDT 2021


RKSimon created this revision.
RKSimon added reviewers: spatel, lebedev.ri, nikic.
Herald added subscribers: pengfei, hiraditya.
RKSimon requested review of this revision.
Herald added a project: LLVM.

I've initially just enabled this for BMI which has the ANDN instruction for i32/i64 - the i16/i8 cases give an idea of what'd we get if we enabled it in all cases.

Additionally, the i16/i8 cases could be freely promoted to i32 (as the args are already zeroext) and we could then make use of ANDN + the free cmp0 there as well - this has come up in PR48768 and PR49028 so I'm going to look at this soon.

https://alive2.llvm.org/ce/z/QVWHP_

Vector cases do not appear to benefit from this as we end up with having to generate the zero vector as well - this is one of the reasons I didn't try to tie this into hasAndNot/hasAndNotCompare.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100177

Files:
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/setcc-logic.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100177.336391.patch
Type: text/x-patch
Size: 4657 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210409/f01aed0a/attachment.bin>


More information about the llvm-commits mailing list