[PATCH] D116765: [x86] make select lowering using SBB hack more flexible

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 6 12:37:38 PST 2022


spatel created this revision.
spatel added reviewers: pengfei, RKSimon, lebedev.ri, craig.topper.
Herald added subscribers: hiraditya, kristof.beyls, mcrosier.
spatel requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

select (X != 0), -1, Y --> 0 - X; or (sbb), Y
select (X != 0), Y, -1 --> X - 1; or (sbb), Y

We already had these x86 carry-flag transforms, but one was over-specified to handle a "0" select arm. That's just a special-case of the more general pattern (the 'or' will be deleted if Y is zero).

This is part of solving #53006, but it misses that example because some other combine has already converted that exact pattern into math ops.


https://reviews.llvm.org/D116765

Files:
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/sdiv_fix_sat.ll
  llvm/test/CodeGen/X86/select.ll
  llvm/test/CodeGen/X86/umul_fix_sat.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116765.397959.patch
Type: text/x-patch
Size: 19296 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220106/8a36f7bd/attachment.bin>


More information about the llvm-commits mailing list