mirror of
https://github.com/yuzu-emu/sirit.git
synced 2024-11-28 23:14:14 +01:00
Implement main conversion instructions
This commit is contained in:
parent
8747340c44
commit
a6c435dcb7
@ -321,6 +321,22 @@ class Module {
|
|||||||
|
|
||||||
// Conversion
|
// Conversion
|
||||||
|
|
||||||
|
Id OpConvertFToU(Id result_type, Id operand);
|
||||||
|
|
||||||
|
Id OpConvertFToS(Id result_type, Id operand);
|
||||||
|
|
||||||
|
Id OpConvertSToF(Id result_type, Id operand);
|
||||||
|
|
||||||
|
Id OpConvertUToF(Id result_type, Id operand);
|
||||||
|
|
||||||
|
Id OpUConvert(Id result_type, Id operand);
|
||||||
|
|
||||||
|
Id OpSConvert(Id result_type, Id operand);
|
||||||
|
|
||||||
|
Id OpFConvert(Id result_type, Id operand);
|
||||||
|
|
||||||
|
Id OpQuantizeToF16(Id result_type, Id operand);
|
||||||
|
|
||||||
/// Bit pattern-preserving type conversion.
|
/// Bit pattern-preserving type conversion.
|
||||||
Id OpBitcast(Id result_type, Id operand);
|
Id OpBitcast(Id result_type, Id operand);
|
||||||
|
|
||||||
|
@ -11,10 +11,20 @@
|
|||||||
|
|
||||||
namespace Sirit {
|
namespace Sirit {
|
||||||
|
|
||||||
Id Module::OpBitcast(Id result_type, Id operand) {
|
#define DEFINE_UNARY(opcode) \
|
||||||
auto op{std::make_unique<Op>(spv::Op::OpBitcast, bound++, result_type)};
|
Id Module::opcode(Id result_type, Id operand) { \
|
||||||
op->Add(operand);
|
auto op{std::make_unique<Op>(spv::Op::opcode, bound++, result_type)}; \
|
||||||
return AddCode(std::move(op));
|
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…
Reference in New Issue
Block a user