[PATCH] D30611: [x86] don't blindly transform SETB into SBB

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 4 13:35:45 PST 2017


spatel created this revision.
Herald added a subscriber: mcrosier.

I noticed unnecessary 'sbb' instructions in https://reviews.llvm.org/D30472 and while looking at 'ptest' codegen recently. This happens because we were transforming any 'setb' - even when we only wanted a single-bit result.

This patch moves those transforms under visitAdd/visitSub, so we we're only creating sbb/adc when it is a win. I don't know why we need a SETCC_CARRY node type, but I'm not proposing to change that existing behavior in this patch.

[Also, I'm skeptical that sbb/adc are a win for all micro-arches, but I'm not volunteering to perf test a single-cycle difference for adds either!]

The test changes here are all cases where we no longer produce sbb/adc, except for the fake diffs in add-of-carry.ll and peep-setb.ll. I made those changes so we'd have a record of where the moved transforms are still firing (and supposedly doing good).


https://reviews.llvm.org/D30611

Files:
  lib/Target/X86/X86ISelLowering.cpp
  test/CodeGen/X86/add-of-carry.ll
  test/CodeGen/X86/avx-intrinsics-fast-isel.ll
  test/CodeGen/X86/avx-intrinsics-x86.ll
  test/CodeGen/X86/avx512-insert-extract.ll
  test/CodeGen/X86/avx512-intrinsics.ll
  test/CodeGen/X86/ctpop-combine.ll
  test/CodeGen/X86/fast-isel-cmp.ll
  test/CodeGen/X86/peep-setb.ll
  test/CodeGen/X86/pr26350.ll
  test/CodeGen/X86/setcc.ll
  test/CodeGen/X86/sse41-intrinsics-fast-isel.ll
  test/CodeGen/X86/sse41-intrinsics-x86.ll
  test/CodeGen/X86/sse41.ll
  test/CodeGen/X86/sse42-intrinsics-fast-isel.ll
  test/CodeGen/X86/sse42-intrinsics-x86.ll
  test/CodeGen/X86/xaluo.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30611.90590.patch
Type: text/x-patch
Size: 36936 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170304/717ad282/attachment.bin>


More information about the llvm-commits mailing list