[PATCH] D48529: [DAGCombiner][X86][PowerPC][ARM][AMDGPU][Sparc] Replace (sub C, X) with (xor X, C) if there is no chance of a borrow during the subtraction.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 24 14:59:48 PDT 2018


craig.topper created this revision.
craig.topper added reviewers: spatel, RKSimon.
Herald added subscribers: chrib, jrtc27, fedor.sergeev, kristof.beyls, t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng, nemanjai, kzhuravl, jyknight.
Herald added a reviewer: javed.absar.
Herald added subscribers: chrib, jrtc27, fedor.sergeev, kristof.beyls, t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng, nemanjai, kzhuravl, jyknight.
Herald added a reviewer: javed.absar.

This is definitely helpful on X86 where there is no subtract from an immediate instruction. So turning it into xor allows the immediate to fold.

Some of the PowerPC changes are regressions, but we may be able to fix them with other folds.


Repository:
  rL LLVM

https://reviews.llvm.org/D48529

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/AMDGPU/ds-sub-offset.ll
  test/CodeGen/ARM/intrinsics-overflow.ll
  test/CodeGen/PowerPC/bool-math.ll
  test/CodeGen/PowerPC/select_const.ll
  test/CodeGen/SPARC/64bit.ll
  test/CodeGen/X86/bool-math.ll
  test/CodeGen/X86/dagcombine-select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48529.152618.patch
Type: text/x-patch
Size: 12016 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180624/25b41912/attachment.bin>


More information about the llvm-commits mailing list