diff options
author | Leonard Chan <leonardchan@google.com> | 2019-05-21 19:17:19 +0000 |
---|---|---|
committer | Leonard Chan <leonardchan@google.com> | 2019-05-21 19:17:19 +0000 |
commit | 0bada7ce6c12d904495bf504c9f56aa6583186e6 (patch) | |
tree | 2fa73c1df5121f70491f578d3003ea9e68385e1b /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | |
parent | ed6df47bae6267adbf460848c2261a52de494fbf (diff) | |
download | llvm-0bada7ce6c12d904495bf504c9f56aa6583186e6.zip llvm-0bada7ce6c12d904495bf504c9f56aa6583186e6.tar.gz llvm-0bada7ce6c12d904495bf504c9f56aa6583186e6.tar.bz2 |
[Intrinsic] Signed Fixed Point Saturation Multiplication Intrinsic
Add an intrinsic that takes 2 signed integers with the scale of them provided
as the third argument and performs fixed point multiplication on them. The
result is saturated and clamped between the largest and smallest representable
values of the first 2 operands.
This is a part of implementing fixed point arithmetic in clang where some of
the more complex operations will be implemented as intrinsics.
Differential Revision: https://reviews.llvm.org/D55720
llvm-svn: 361289
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 31410f2..5ac9d79 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -6298,6 +6298,14 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, Op1.getValueType(), Op1, Op2, Op3)); return; } + case Intrinsic::smul_fix_sat: { + SDValue Op1 = getValue(I.getArgOperand(0)); + SDValue Op2 = getValue(I.getArgOperand(1)); + SDValue Op3 = getValue(I.getArgOperand(2)); + setValue(&I, DAG.getNode(ISD::SMULFIXSAT, sdl, Op1.getValueType(), Op1, Op2, + Op3)); + return; + } case Intrinsic::stacksave: { SDValue Op = getRoot(); Res = DAG.getNode( |