[PATCH] D25221: [PPC][DAGCombine] Convert SETCC to subtract when the result is zero extended

Ehsan Amiri via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 3 20:03:43 PDT 2016


amehsan created this revision.
amehsan added reviewers: hfinkel, kbarton, nemanjai.
amehsan added a subscriber: llvm-commits.

The code here can be extended. I post this patch right now, to get some feedback before adding those extensions.

When we see a SETCC whose only users are zero extend operations, we can replace it with a subtraction. This results in doing all calculation in GPRs and avoids CR use.

Extensions that I plan to look into:

1- Check if this works for any_extend/sign extend
2- Implement similar change for signed condition codes.
3- Look into handling equal and not equal cases, using cntlz
4- More tests should be added

Please let me know if there are other ways for extending this.


https://reviews.llvm.org/D25221

Files:
  lib/Target/PowerPC/PPCISelLowering.cpp
  lib/Target/PowerPC/PPCISelLowering.h
  test/CodeGen/PowerPC/setcc-to-sub.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25221.73390.patch
Type: text/x-patch
Size: 5387 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161004/1ef13b87/attachment.bin>


More information about the llvm-commits mailing list