[PATCH] D74024: [X86] Remove SETB_C8r/SETB_C16r pseudo instructions. Use SETB_C32r and EXTRACT_SUBREG instead.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 5 00:50:35 PST 2020


craig.topper created this revision.
craig.topper added reviewers: RKSimon, spatel, andreadb.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

Only 32 and 64 bit SBB are dependency breaking instructons on some
CPUs. The 8 and 16 bit forms have to preserve upper bits of the GPR.

This patch removes the smaller forms and selects the wider form
instead. I had to do this with custom code as the tblgen generated
code glued the eflags copytoreg to the extract_subreg instead of
to the SETB pseudo.

Longer term I think we can remove X86ISD::SETCC_CARRY and use
(X86ISD::SBB zero, zero). We'll want to keep the pseudo and select
(X86ISD::SBB zero, zero) to either a MOV32r0+SBB for targets where
there is no dependency break and SETB_C32/SETB_C64 for targets
that have a dependency break. May want some way to avoid the MOV32r0
if the instruction that produced the carry flag happened to def a
register that we can use for the dependency.

I think the flag copy lowering should be using NEG instead of SUB to
handle SETB. That would avoid the MOV32r0 there. Or maybe it should
use a ADC with -1 to recreate the carry flag and keep the SETB?
That would avoid a MOVZX on the input of the SUB.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74024

Files:
  llvm/lib/Target/X86/X86FlagsCopyLowering.cpp
  llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
  llvm/lib/Target/X86/X86InstrCompiler.td
  llvm/lib/Target/X86/X86InstrInfo.cpp
  llvm/test/CodeGen/X86/2010-08-04-MaskedSignedCompare.ll
  llvm/test/CodeGen/X86/flags-copy-lowering.mir
  llvm/test/CodeGen/X86/sbb.ll
  llvm/test/CodeGen/X86/vector-compare-any_of.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74024.242523.patch
Type: text/x-patch
Size: 12097 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200205/7f5abd54/attachment.bin>


More information about the llvm-commits mailing list