sirit/src/instructions/conversion.cpp

30 lines
915 B
C++
Raw Normal View History

2018-11-03 02:24:10 +00:00
/* This file is part of the sirit project.
2019-07-14 21:48:59 +00:00
* Copyright (c) 2019 sirit
* This software may be used and distributed according to the terms of the
* 3-Clause BSD License
2018-11-03 02:24:10 +00:00
*/
#include "sirit/sirit.h"
#include "stream.h"
2018-11-03 02:24:10 +00:00
namespace Sirit {
2019-03-11 06:26:21 +00:00
#define DEFINE_UNARY(opcode) \
Id Module::opcode(Id result_type, Id operand) { \
code->Reserve(4); \
return *code << OpId{spv::Op::opcode, result_type} << operand << EndOp{}; \
2018-11-12 18:33:28 +00:00
}
2018-11-12 18:33:28 +00:00
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)
2018-11-03 02:24:10 +00:00
2018-11-12 18:33:28 +00:00
} // namespace Sirit