aboutsummaryrefslogtreecommitdiff
path: root/externals/sirit/src/instructions/conversion.cpp
blob: 0b4e2c8a3f5703269bbca7c8bc5c5224af6baaec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* This file is part of the sirit project.
 * Copyright (c) 2019 sirit
 * This software may be used and distributed according to the terms of the
 * 3-Clause BSD License
 */

#include "sirit/sirit.h"

#include "stream.h"

namespace Sirit {

#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{};                  \
    }

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