[PATCH] D64160: [ARM] Favour PL/MI over GE/LT when possible

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 13:48:13 PDT 2019


dmgreen created this revision.
dmgreen added reviewers: t.p.northover, efriedma, ostannard, SjoerdMeijer.
Herald added subscribers: hiraditya, kristof.beyls, javed.absar.
Herald added a project: LLVM.

The arm condition codes for GE is N==V (and for LT is N!=V). If the source of flags cannot set V (overflow), such as a cmp against #0, then we can use the simpler PL and MI conditions that only check N. As these PL/MI conditions are simpler than GE/LT, other passes like the peephole optimiser can have a better time optimising away the redundant CMPs.

The exception is the VSEL instruction, which cannot take these codes, so there the transform favours GE. I have added some extra tests to codegen/arm/vsel.ll to check against 0 (which are not shown here because they do not change). Some of the other tests here have been updated, for which I am showing the difference.


https://reviews.llvm.org/D64160

Files:
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/test/CodeGen/ARM/code-placement.ll
  llvm/test/CodeGen/ARM/hoist-and-by-const-from-lshr-in-eqcmp-zero.ll
  llvm/test/CodeGen/ARM/hoist-and-by-const-from-shl-in-eqcmp-zero.ll
  llvm/test/CodeGen/ARM/long_shift.ll
  llvm/test/CodeGen/ARM/sat-to-bitop.ll
  llvm/test/CodeGen/ARM/select.ll
  llvm/test/CodeGen/ARM/shift-i64.ll
  llvm/test/CodeGen/Thumb/select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64160.207881.patch
Type: text/x-patch
Size: 28520 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190703/98bf7ca9/attachment.bin>


More information about the llvm-commits mailing list