diff options
author | Leonard Chan <leonardchan@google.com> | 2018-12-12 06:29:14 +0000 |
---|---|---|
committer | Leonard Chan <leonardchan@google.com> | 2018-12-12 06:29:14 +0000 |
commit | 118e53fd6370c165dcd297c5a16ef3b8fd3b469f (patch) | |
tree | 06c2d1e0142fa8210dc785f688e47cdc0b479b96 /llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | |
parent | 2000170e279d77a3771c2572b368a0c37677f37f (diff) | |
download | bcm5719-llvm-118e53fd6370c165dcd297c5a16ef3b8fd3b469f.tar.gz bcm5719-llvm-118e53fd6370c165dcd297c5a16ef3b8fd3b469f.zip |
[Intrinsic] Signed Fixed Point 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.
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/D54719
llvm-svn: 348912
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 2f4a5451a61..f1c6d63982e 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -1128,6 +1128,12 @@ void SelectionDAGLegalize::LegalizeOp(SDNode *Node) { Action = TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0)); break; } + case ISD::SMULFIX: { + unsigned Scale = Node->getConstantOperandVal(2); + Action = TLI.getFixedPointOperationAction(Node->getOpcode(), + Node->getValueType(0), Scale); + break; + } case ISD::MSCATTER: Action = TLI.getOperationAction(Node->getOpcode(), cast<MaskedScatterSDNode>(Node)->getValue().getValueType()); @@ -3276,6 +3282,10 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) { Results.push_back(TLI.getExpandedSaturationAdditionSubtraction(Node, DAG)); break; } + case ISD::SMULFIX: { + Results.push_back(TLI.getExpandedFixedPointMultiplication(Node, DAG)); + break; + } case ISD::SADDO: case ISD::SSUBO: { SDValue LHS = Node->getOperand(0); |