[PATCH] D42574: [ARM] Lower lower saturate to 0 and lower saturate to -1 using bit-operations

Marten Svanfeldt via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 26 04:37:06 PST 2018


thebolt created this revision.
Herald added subscribers: kristof.beyls, javed.absar, aemerson.

Expressions of the form x < 0 ? 0 :  x; and x < -1 ? -1 : x can be lowered using bit-operations instead of branching or conditional moves

In thumb-mode this results in a two-instruction sequence, a shift followed by a bic or or while in ARM/thumb2 mode that has flexible second operand the shift can be folded into a single bic/or instructions. In most cases this results in smaller code and possibly less branches, and in no case larger than before.


Repository:
  rL LLVM

https://reviews.llvm.org/D42574

Files:
  lib/Target/ARM/ARMISelLowering.cpp
  test/CodeGen/ARM/atomic-op.ll
  test/CodeGen/ARM/sat-to-bitop.ll
  test/CodeGen/ARM/select.ll
  test/CodeGen/Thumb/select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42574.131572.patch
Type: text/x-patch
Size: 7068 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180126/f3f99ab3/attachment.bin>


More information about the llvm-commits mailing list