[PATCH] D36613: [PowerPC] Eliminate compares - add i32 sext/zext handling for SETLT/SETGT

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 11 06:58:28 PDT 2017


nemanjai created this revision.

This patch adds the two `setcc` patterns for both `zext` and `sext`.
Doing so uncovered a bug in some of the initial implementation. Namely some code sequences for 32-bit comparisons actually require the upper 32 bits of the register to be correctly defined. We solved this by adding the correct extension when needed. However, the code still pretended that the intermediate values are `i32`. This generally worked just fine but fails to work correctly if a register is spilled somewhere within the sequence - after the spill/reload, the value in the register will always be zero-extended, so if it was sign-extended before the spill, we have a problem.

This patch adds the pattern and fixes the bug.


Repository:
  rL LLVM

https://reviews.llvm.org/D36613

Files:
  lib/Target/PowerPC/PPCISelDAGToDAG.cpp
  test/CodeGen/PowerPC/memCmpUsedInZeroEqualityComparison.ll
  test/CodeGen/PowerPC/no-pref-jumps.ll
  test/CodeGen/PowerPC/testComparesieqsc.ll
  test/CodeGen/PowerPC/testComparesieqsi.ll
  test/CodeGen/PowerPC/testComparesieqss.ll
  test/CodeGen/PowerPC/testComparesiequc.ll
  test/CodeGen/PowerPC/testComparesiequi.ll
  test/CodeGen/PowerPC/testComparesiequs.ll
  test/CodeGen/PowerPC/testComparesigesc.ll
  test/CodeGen/PowerPC/testComparesigesi.ll
  test/CodeGen/PowerPC/testComparesigess.ll
  test/CodeGen/PowerPC/testComparesigtsc.ll
  test/CodeGen/PowerPC/testComparesigtsi.ll
  test/CodeGen/PowerPC/testComparesigtss.ll
  test/CodeGen/PowerPC/testComparesilesc.ll
  test/CodeGen/PowerPC/testComparesilesi.ll
  test/CodeGen/PowerPC/testComparesiless.ll
  test/CodeGen/PowerPC/testComparesiltsc.ll
  test/CodeGen/PowerPC/testComparesiltsi.ll
  test/CodeGen/PowerPC/testComparesiltss.ll
  test/CodeGen/PowerPC/testCompareslleqsc.ll
  test/CodeGen/PowerPC/testCompareslleqsi.ll
  test/CodeGen/PowerPC/testCompareslleqss.ll
  test/CodeGen/PowerPC/testComparesllequc.ll
  test/CodeGen/PowerPC/testComparesllequi.ll
  test/CodeGen/PowerPC/testComparesllequs.ll
  test/CodeGen/PowerPC/testComparesllgesc.ll
  test/CodeGen/PowerPC/testComparesllgesi.ll
  test/CodeGen/PowerPC/testComparesllgess.ll
  test/CodeGen/PowerPC/testCompareslllesc.ll
  test/CodeGen/PowerPC/testCompareslllesi.ll
  test/CodeGen/PowerPC/testComparesllless.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36613.110718.patch
Type: text/x-patch
Size: 72064 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170811/3e01d64f/attachment-0001.bin>


More information about the llvm-commits mailing list