Add OpFNegate
This commit is contained in:
parent
6742afd6dd
commit
27a0b4f17e
2 changed files with 12 additions and 0 deletions
|
@ -286,6 +286,9 @@ class Module {
|
||||||
|
|
||||||
// Arithmetic
|
// Arithmetic
|
||||||
|
|
||||||
|
/// Floating-point subtract of Operand from zero.
|
||||||
|
Id OpFNegate(Id result_type, Id operand);
|
||||||
|
|
||||||
/// Unsigned-integer division of Operand 1 divided by Operand 2.
|
/// Unsigned-integer division of Operand 1 divided by Operand 2.
|
||||||
Id OpUDiv(Id result_type, Id operand_1, Id operand_2);
|
Id OpUDiv(Id result_type, Id operand_1, Id operand_2);
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,13 @@
|
||||||
|
|
||||||
namespace Sirit {
|
namespace Sirit {
|
||||||
|
|
||||||
|
#define DEFINE_UNARY(funcname, opcode) \
|
||||||
|
Id Module::funcname(Id result_type, Id operand) { \
|
||||||
|
auto op{std::make_unique<Op>(opcode, bound++, result_type)}; \
|
||||||
|
op->Add(operand); \
|
||||||
|
return AddCode(std::move(op)); \
|
||||||
|
}
|
||||||
|
|
||||||
#define DEFINE_BINARY(funcname, opcode) \
|
#define DEFINE_BINARY(funcname, opcode) \
|
||||||
Id Module::funcname(Id result_type, Id operand_1, Id operand_2) { \
|
Id Module::funcname(Id result_type, Id operand_1, Id operand_2) { \
|
||||||
auto op{std::make_unique<Op>(opcode, bound++, result_type)}; \
|
auto op{std::make_unique<Op>(opcode, bound++, result_type)}; \
|
||||||
|
@ -19,6 +26,8 @@ namespace Sirit {
|
||||||
return AddCode(std::move(op)); \
|
return AddCode(std::move(op)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_UNARY(OpFNegate, spv::Op::OpFNegate);
|
||||||
|
|
||||||
DEFINE_BINARY(OpUDiv, spv::Op::OpUDiv)
|
DEFINE_BINARY(OpUDiv, spv::Op::OpUDiv)
|
||||||
DEFINE_BINARY(OpIAdd, spv::Op::OpIAdd)
|
DEFINE_BINARY(OpIAdd, spv::Op::OpIAdd)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue