[PATCH] D52286: [Intrinsic] Signed Saturation Intirnsic

Leonard Chan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 19 17:28:56 PDT 2018


leonardchan created this revision.
leonardchan added a reviewer: ebevhan.
Herald added a subscriber: mgorny.

Add a new intrinsic that saturates a signed integer. If a value X provided is larger than the maximum value that can be represented by the provided bit width W, the this intrinsic returns that maximum value. If the X is smaller than the minimum value that can be represented in W bits, the intrinsic returns that minimum value. Otherwise, X is returned.

This is a part of implementing fixed point arithmetic in clang where some of the more complex operations will be implemented as intrinsics.


Repository:
  rL LLVM

https://reviews.llvm.org/D52286

Files:
  include/llvm/CodeGen/ISDOpcodes.h
  include/llvm/IR/Intrinsics.td
  lib/CodeGen/IntrinsicLowering.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
  lib/Transforms/CMakeLists.txt
  lib/Transforms/FixedPoint/CMakeLists.txt
  lib/Transforms/FixedPoint/SaturationPass.cpp
  test/Transforms/FixedPoint/saturation.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52286.166200.patch
Type: text/x-patch
Size: 9197 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180920/32576226/attachment.bin>


More information about the llvm-commits mailing list