Skip to content

Commit

Permalink
Add Binary Intrinsic ops to TIR Ops in C++ (apache#5900)
Browse files Browse the repository at this point in the history
* Add Binary Intrinsic ops to TIR Ops in C++

* clang-format
  • Loading branch information
Matthew Brookhart authored and zhiics committed Jul 2, 2020
1 parent bae43a6 commit 30e8995
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/tvm/tir/op.h
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,18 @@ TVM_DECLARE_INTRIN_UNARY(acosh);
TVM_DECLARE_INTRIN_UNARY(asinh);
TVM_DECLARE_INTRIN_UNARY(atanh);

#define TVM_DECLARE_INTRIN_BINARY(OpName) \
inline PrimExpr OpName(PrimExpr x, PrimExpr y) { \
static const Op& op = Op::Get("tir." #OpName); \
return tir::Call(x.dtype(), op, {x, y}, tir::CallNode::PureIntrinsic); \
}

TVM_DECLARE_INTRIN_BINARY(atan2);
TVM_DECLARE_INTRIN_BINARY(nextafter);
TVM_DECLARE_INTRIN_BINARY(copysign);
TVM_DECLARE_INTRIN_BINARY(hypot);
TVM_DECLARE_INTRIN_BINARY(ldexp);

namespace tir {
/*!
* \brief Make a const value with certain data type.
Expand Down

0 comments on commit 30e8995

Please sign in to comment.