[all-commits] [llvm/llvm-project] 68defc: [x86] make select lowering using SBB hack more fle...

Sanjay Patel via All-commits all-commits at lists.llvm.org
Fri Jan 7 10:25:03 PST 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 68defc013444f21a46757b64e9144bb218c9e7eb
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-01-07 (Fri, 07 Jan 2022)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/test/CodeGen/X86/sdiv_fix_sat.ll
    M llvm/test/CodeGen/X86/select.ll
    M llvm/test/CodeGen/X86/umul_fix_sat.ll

  Log Message:
  [x86] make select lowering using SBB hack more flexible

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 only. 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.

Differential Revision: https://reviews.llvm.org/D116765

More information about the All-commits mailing list