summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
authorLeonard Chan <leonardchan@google.com>2019-05-21 19:17:19 +0000
committerLeonard Chan <leonardchan@google.com>2019-05-21 19:17:19 +0000
commit0bada7ce6c12d904495bf504c9f56aa6583186e6 (patch)
tree2fa73c1df5121f70491f578d3003ea9e68385e1b /llvm/lib/IR/Verifier.cpp
parented6df47bae6267adbf460848c2261a52de494fbf (diff)
downloadbcm5719-llvm-0bada7ce6c12d904495bf504c9f56aa6583186e6.tar.gz
bcm5719-llvm-0bada7ce6c12d904495bf504c9f56aa6583186e6.zip
[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/IR/Verifier.cpp')
-rw-r--r--llvm/lib/IR/Verifier.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 67d43ce7740..fc8d210e67a 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -4595,27 +4595,28 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
break;
}
case Intrinsic::smul_fix:
+ case Intrinsic::smul_fix_sat:
case Intrinsic::umul_fix: {
Value *Op1 = Call.getArgOperand(0);
Value *Op2 = Call.getArgOperand(1);
Assert(Op1->getType()->isIntOrIntVectorTy(),
- "first operand of [us]mul_fix must be an int type or vector "
+ "first operand of [us]mul_fix[_sat] must be an int type or vector "
"of ints");
Assert(Op2->getType()->isIntOrIntVectorTy(),
- "second operand of [us]mul_fix must be an int type or vector "
+ "second operand of [us]mul_fix_[sat] must be an int type or vector "
"of ints");
auto *Op3 = cast<ConstantInt>(Call.getArgOperand(2));
Assert(Op3->getType()->getBitWidth() <= 32,
- "third argument of [us]mul_fix must fit within 32 bits");
+ "third argument of [us]mul_fix[_sat] must fit within 32 bits");
- if (ID == Intrinsic::smul_fix) {
+ if (ID == Intrinsic::smul_fix || ID == Intrinsic::smul_fix_sat) {
Assert(
Op3->getZExtValue() < Op1->getType()->getScalarSizeInBits(),
- "the scale of smul_fix must be less than the width of the operands");
+ "the scale of smul_fix[_sat] must be less than the width of the operands");
} else {
Assert(Op3->getZExtValue() <= Op1->getType()->getScalarSizeInBits(),
- "the scale of umul_fix must be less than or equal to the width of "
+ "the scale of umul_fix[_sat] must be less than or equal to the width of "
"the operands");
}
break;
OpenPOWER on IntegriCloud