mirror of
https://git.suyu.dev/suyu/sirit.git
synced 2025-12-25 08:46:02 +01:00
Implement main conversion instructions
This commit is contained in:
parent
8747340c44
commit
a6c435dcb7
2 changed files with 32 additions and 6 deletions
|
|
@ -11,10 +11,20 @@
|
|||
|
||||
namespace Sirit {
|
||||
|
||||
Id Module::OpBitcast(Id result_type, Id operand) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpBitcast, bound++, result_type)};
|
||||
op->Add(operand);
|
||||
return AddCode(std::move(op));
|
||||
}
|
||||
#define DEFINE_UNARY(opcode) \
|
||||
Id Module::opcode(Id result_type, Id operand) { \
|
||||
auto op{std::make_unique<Op>(spv::Op::opcode, bound++, result_type)}; \
|
||||
op->Add(operand); \
|
||||
return AddCode(std::move(op)); \
|
||||
}
|
||||
DEFINE_UNARY(OpConvertFToU)
|
||||
DEFINE_UNARY(OpConvertFToS)
|
||||
DEFINE_UNARY(OpConvertSToF)
|
||||
DEFINE_UNARY(OpConvertUToF)
|
||||
DEFINE_UNARY(OpUConvert)
|
||||
DEFINE_UNARY(OpSConvert)
|
||||
DEFINE_UNARY(OpFConvert)
|
||||
DEFINE_UNARY(OpQuantizeToF16)
|
||||
DEFINE_UNARY(OpBitcast)
|
||||
|
||||
} // namespace Sirit
|
||||
} // namespace Sirit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue