summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorLeonard Chan <leonardchan@google.com>2018-12-12 06:29:14 +0000
committerLeonard Chan <leonardchan@google.com>2018-12-12 06:29:14 +0000
commit118e53fd6370c165dcd297c5a16ef3b8fd3b469f (patch)
tree06c2d1e0142fa8210dc785f688e47cdc0b479b96 /llvm/lib/IR
parent2000170e279d77a3771c2572b368a0c37677f37f (diff)
downloadbcm5719-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/IR')
-rw-r--r--llvm/lib/IR/Verifier.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 40f73c9f1a4..a31f7cddf6e 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -4541,6 +4541,24 @@ void Verifier::visitIntrinsicCallSite(Intrinsic::ID ID, CallSite CS) {
"of ints");
break;
}
+ case Intrinsic::smul_fix: {
+ Value *Op1 = CS.getArgOperand(0);
+ Value *Op2 = CS.getArgOperand(1);
+ Assert(Op1->getType()->isIntOrIntVectorTy(),
+ "first operand of smul_fix must be an int type or vector "
+ "of ints");
+ Assert(Op2->getType()->isIntOrIntVectorTy(),
+ "second operand of smul_fix must be an int type or vector "
+ "of ints");
+
+ auto *Op3 = dyn_cast<ConstantInt>(CS.getArgOperand(2));
+ Assert(Op3, "third argument of smul_fix must be a constant integer");
+ Assert(Op3->getType()->getBitWidth() <= 32,
+ "third argument of smul_fix must fit within 32 bits");
+ Assert(Op3->getZExtValue() < Op1->getType()->getScalarSizeInBits(),
+ "the scale of smul_fix must be less than the width of the operands");
+ break;
+ }
};
}
OpenPOWER on IntegriCloud