summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glasm
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/backend/glasm')
-rw-r--r--src/shader_recompiler/backend/glasm/emit_context.h8
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm.cpp95
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_composite.cpp225
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp53
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_floating_point.cpp299
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_instructions.h844
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp216
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_memory.cpp77
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp515
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_select.cpp46
-rw-r--r--src/shader_recompiler/backend/glasm/reg_alloc.cpp62
-rw-r--r--src/shader_recompiler/backend/glasm/reg_alloc.h184
12 files changed, 1380 insertions, 1244 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_context.h b/src/shader_recompiler/backend/glasm/emit_context.h
index 4f98a9816..a59acbf6c 100644
--- a/src/shader_recompiler/backend/glasm/emit_context.h
+++ b/src/shader_recompiler/backend/glasm/emit_context.h
@@ -23,15 +23,15 @@ public:
23 explicit EmitContext(IR::Program& program); 23 explicit EmitContext(IR::Program& program);
24 24
25 template <typename... Args> 25 template <typename... Args>
26 void Add(const char* fmt, IR::Inst& inst, Args&&... args) { 26 void Add(const char* format_str, IR::Inst& inst, Args&&... args) {
27 code += fmt::format(fmt, reg_alloc.Define(inst), std::forward<Args>(args)...); 27 code += fmt::format(format_str, reg_alloc.Define(inst), std::forward<Args>(args)...);
28 // TODO: Remove this 28 // TODO: Remove this
29 code += '\n'; 29 code += '\n';
30 } 30 }
31 31
32 template <typename... Args> 32 template <typename... Args>
33 void Add(const char* fmt, Args&&... args) { 33 void Add(const char* format_str, Args&&... args) {
34 code += fmt::format(fmt, std::forward<Args>(args)...); 34 code += fmt::format(format_str, std::forward<Args>(args)...);
35 // TODO: Remove this 35 // TODO: Remove this
36 code += '\n'; 36 code += '\n';
37 } 37 }
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm.cpp b/src/shader_recompiler/backend/glasm/emit_glasm.cpp
index 7ec880c81..8981cf300 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm.cpp
@@ -27,22 +27,80 @@ struct FuncTraits<ReturnType_ (*)(Args...)> {
27 using ArgType = std::tuple_element_t<I, std::tuple<Args...>>; 27 using ArgType = std::tuple_element_t<I, std::tuple<Args...>>;
28}; 28};
29 29
30template <typename T>
31struct Identity {
32 Identity(const T& data_) : data{data_} {}
33
34 const T& Extract() {
35 return data;
36 }
37
38 T data;
39};
40
41template <bool scalar>
42struct RegWrapper {
43 RegWrapper(EmitContext& ctx, Value value)
44 : reg_alloc{ctx.reg_alloc}, allocated{value.type != Type::Register} {
45 reg = allocated ? reg_alloc.AllocReg() : Register{value};
46 switch (value.type) {
47 case Type::Register:
48 break;
49 case Type::U32:
50 ctx.Add("MOV.U {}.x,{};", reg, value.imm_u32);
51 break;
52 case Type::S32:
53 ctx.Add("MOV.S {}.x,{};", reg, value.imm_s32);
54 break;
55 case Type::F32:
56 ctx.Add("MOV.F {}.x,{};", reg, value.imm_f32);
57 break;
58 }
59 }
60 ~RegWrapper() {
61 if (allocated) {
62 reg_alloc.FreeReg(reg);
63 }
64 }
65
66 auto Extract() {
67 return std::conditional_t<scalar, ScalarRegister, Register>{Value{reg}};
68 }
69
70 RegAlloc& reg_alloc;
71 Register reg{};
72 bool allocated{};
73};
74
30template <typename ArgType> 75template <typename ArgType>
31auto Arg(EmitContext& ctx, const IR::Value& arg) { 76auto Arg(EmitContext& ctx, const IR::Value& arg) {
32 if constexpr (std::is_same_v<ArgType, std::string_view>) { 77 if constexpr (std::is_same_v<ArgType, Register>) {
33 return ctx.reg_alloc.Consume(arg); 78 return RegWrapper<false>{ctx, ctx.reg_alloc.Consume(arg)};
79 } else if constexpr (std::is_same_v<ArgType, ScalarRegister>) {
80 return RegWrapper<true>{ctx, ctx.reg_alloc.Consume(arg)};
81 } else if constexpr (std::is_base_of_v<Value, ArgType>) {
82 return Identity{ArgType{ctx.reg_alloc.Consume(arg)}};
34 } else if constexpr (std::is_same_v<ArgType, const IR::Value&>) { 83 } else if constexpr (std::is_same_v<ArgType, const IR::Value&>) {
35 return arg; 84 return Identity{arg};
36 } else if constexpr (std::is_same_v<ArgType, u32>) { 85 } else if constexpr (std::is_same_v<ArgType, u32>) {
37 return arg.U32(); 86 return Identity{arg.U32()};
38 } else if constexpr (std::is_same_v<ArgType, IR::Block*>) { 87 } else if constexpr (std::is_same_v<ArgType, IR::Block*>) {
39 return arg.Label(); 88 return Identity{arg.Label()};
40 } else if constexpr (std::is_same_v<ArgType, IR::Attribute>) { 89 } else if constexpr (std::is_same_v<ArgType, IR::Attribute>) {
41 return arg.Attribute(); 90 return Identity{arg.Attribute()};
42 } else if constexpr (std::is_same_v<ArgType, IR::Patch>) { 91 } else if constexpr (std::is_same_v<ArgType, IR::Patch>) {
43 return arg.Patch(); 92 return Identity{arg.Patch()};
44 } else if constexpr (std::is_same_v<ArgType, IR::Reg>) { 93 } else if constexpr (std::is_same_v<ArgType, IR::Reg>) {
45 return arg.Reg(); 94 return Identity{arg.Reg()};
95 }
96}
97
98template <auto func, bool is_first_arg_inst, typename... Args>
99void InvokeCall(EmitContext& ctx, IR::Inst* inst, Args&&... args) {
100 if constexpr (is_first_arg_inst) {
101 func(ctx, *inst, std::forward<Args>(args.Extract())...);
102 } else {
103 func(ctx, std::forward<Args>(args.Extract())...);
46 } 104 }
47} 105}
48 106
@@ -50,9 +108,10 @@ template <auto func, bool is_first_arg_inst, size_t... I>
50void Invoke(EmitContext& ctx, IR::Inst* inst, std::index_sequence<I...>) { 108void Invoke(EmitContext& ctx, IR::Inst* inst, std::index_sequence<I...>) {
51 using Traits = FuncTraits<decltype(func)>; 109 using Traits = FuncTraits<decltype(func)>;
52 if constexpr (is_first_arg_inst) { 110 if constexpr (is_first_arg_inst) {
53 func(ctx, *inst, Arg<typename Traits::template ArgType<I + 2>>(ctx, inst->Arg(I))...); 111 func(ctx, *inst,
112 Arg<typename Traits::template ArgType<I + 2>>(ctx, inst->Arg(I)).Extract()...);
54 } else { 113 } else {
55 func(ctx, Arg<typename Traits::template ArgType<I + 1>>(ctx, inst->Arg(I))...); 114 func(ctx, Arg<typename Traits::template ArgType<I + 1>>(ctx, inst->Arg(I)).Extract()...);
56 } 115 }
57} 116}
58 117
@@ -81,7 +140,7 @@ void EmitInst(EmitContext& ctx, IR::Inst* inst) {
81 throw LogicError("Invalid opcode {}", inst->GetOpcode()); 140 throw LogicError("Invalid opcode {}", inst->GetOpcode());
82} 141}
83 142
84void Identity(IR::Inst& inst, const IR::Value& value) { 143void Alias(IR::Inst& inst, const IR::Value& value) {
85 if (value.IsImmediate()) { 144 if (value.IsImmediate()) {
86 return; 145 return;
87 } 146 }
@@ -125,31 +184,31 @@ std::string EmitGLASM(const Profile&, IR::Program& program, Bindings&) {
125} 184}
126 185
127void EmitIdentity(EmitContext&, IR::Inst& inst, const IR::Value& value) { 186void EmitIdentity(EmitContext&, IR::Inst& inst, const IR::Value& value) {
128 Identity(inst, value); 187 Alias(inst, value);
129} 188}
130 189
131void EmitBitCastU16F16(EmitContext&, IR::Inst& inst, const IR::Value& value) { 190void EmitBitCastU16F16(EmitContext&, IR::Inst& inst, const IR::Value& value) {
132 Identity(inst, value); 191 Alias(inst, value);
133} 192}
134 193
135void EmitBitCastU32F32(EmitContext&, IR::Inst& inst, const IR::Value& value) { 194void EmitBitCastU32F32(EmitContext&, IR::Inst& inst, const IR::Value& value) {
136 Identity(inst, value); 195 Alias(inst, value);
137} 196}
138 197
139void EmitBitCastU64F64(EmitContext&, IR::Inst& inst, const IR::Value& value) { 198void EmitBitCastU64F64(EmitContext&, IR::Inst& inst, const IR::Value& value) {
140 Identity(inst, value); 199 Alias(inst, value);
141} 200}
142 201
143void EmitBitCastF16U16(EmitContext&, IR::Inst& inst, const IR::Value& value) { 202void EmitBitCastF16U16(EmitContext&, IR::Inst& inst, const IR::Value& value) {
144 Identity(inst, value); 203 Alias(inst, value);
145} 204}
146 205
147void EmitBitCastF32U32(EmitContext&, IR::Inst& inst, const IR::Value& value) { 206void EmitBitCastF32U32(EmitContext&, IR::Inst& inst, const IR::Value& value) {
148 Identity(inst, value); 207 Alias(inst, value);
149} 208}
150 209
151void EmitBitCastF64U64(EmitContext&, IR::Inst& inst, const IR::Value& value) { 210void EmitBitCastF64U64(EmitContext&, IR::Inst& inst, const IR::Value& value) {
152 Identity(inst, value); 211 Alias(inst, value);
153} 212}
154 213
155} // namespace Shader::Backend::GLASM 214} // namespace Shader::Backend::GLASM
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_composite.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_composite.cpp
index e69de29bb..063dcaf13 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_composite.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_composite.cpp
@@ -0,0 +1,225 @@
1// Copyright 2021 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "shader_recompiler/backend/glasm/emit_context.h"
6#include "shader_recompiler/backend/glasm/emit_glasm_instructions.h"
7#include "shader_recompiler/frontend/ir/value.h"
8
9namespace Shader::Backend::GLASM {
10namespace {
11template <typename... Values>
12void CompositeConstructU32(EmitContext& ctx, IR::Inst& inst, Values&&... elements) {
13 const Register ret{ctx.reg_alloc.Define(inst)};
14 if (std::ranges::any_of(std::array{elements...},
15 [](const IR::Value& value) { return value.IsImmediate(); })) {
16 const std::array<u32, 4> values{(elements.IsImmediate() ? elements.U32() : 0)...};
17 ctx.Add("MOV.U {},{{{},{},{},{}}};", ret, fmt::to_string(values[0]),
18 fmt::to_string(values[1]), fmt::to_string(values[2]), fmt::to_string(values[3]));
19 }
20 size_t index{};
21 for (const IR::Value& element : {elements...}) {
22 if (!element.IsImmediate()) {
23 const ScalarU32 value{ctx.reg_alloc.Consume(element)};
24 ctx.Add("MOV.U {}.{},{};", ret, "xyzw"[index], value);
25 }
26 ++index;
27 }
28}
29
30void CompositeExtractU32(EmitContext& ctx, IR::Inst& inst, Register composite, u32 index) {
31 const Register ret{ctx.reg_alloc.Define(inst)};
32 if (ret == composite && index == 0) {
33 // No need to do anything here, the source and destination are the same register
34 return;
35 }
36 ctx.Add("MOV.U {}.x,{}.{};", ret, composite, "xyzw"[index]);
37}
38} // Anonymous namespace
39
40void EmitCompositeConstructU32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& e1,
41 const IR::Value& e2) {
42 CompositeConstructU32(ctx, inst, e1, e2);
43}
44
45void EmitCompositeConstructU32x3(EmitContext& ctx, IR::Inst& inst, const IR::Value& e1,
46 const IR::Value& e2, const IR::Value& e3) {
47 CompositeConstructU32(ctx, inst, e1, e2, e3);
48}
49
50void EmitCompositeConstructU32x4(EmitContext& ctx, IR::Inst& inst, const IR::Value& e1,
51 const IR::Value& e2, const IR::Value& e3, const IR::Value& e4) {
52 CompositeConstructU32(ctx, inst, e1, e2, e3, e4);
53}
54
55void EmitCompositeExtractU32x2(EmitContext& ctx, IR::Inst& inst, Register composite, u32 index) {
56 CompositeExtractU32(ctx, inst, composite, index);
57}
58
59void EmitCompositeExtractU32x3(EmitContext& ctx, IR::Inst& inst, Register composite, u32 index) {
60 CompositeExtractU32(ctx, inst, composite, index);
61}
62
63void EmitCompositeExtractU32x4(EmitContext& ctx, IR::Inst& inst, Register composite, u32 index) {
64 CompositeExtractU32(ctx, inst, composite, index);
65}
66
67void EmitCompositeInsertU32x2([[maybe_unused]] EmitContext& ctx,
68 [[maybe_unused]] Register composite,
69 [[maybe_unused]] ScalarU32 object, [[maybe_unused]] u32 index) {
70 throw NotImplementedException("GLASM instruction");
71}
72
73void EmitCompositeInsertU32x3([[maybe_unused]] EmitContext& ctx,
74 [[maybe_unused]] Register composite,
75 [[maybe_unused]] ScalarU32 object, [[maybe_unused]] u32 index) {
76 throw NotImplementedException("GLASM instruction");
77}
78
79void EmitCompositeInsertU32x4([[maybe_unused]] EmitContext& ctx,
80 [[maybe_unused]] Register composite,
81 [[maybe_unused]] ScalarU32 object, [[maybe_unused]] u32 index) {
82 throw NotImplementedException("GLASM instruction");
83}
84
85void EmitCompositeConstructF16x2([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register e1,
86 [[maybe_unused]] Register e2) {
87 throw NotImplementedException("GLASM instruction");
88}
89
90void EmitCompositeConstructF16x3([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register e1,
91 [[maybe_unused]] Register e2, [[maybe_unused]] Register e3) {
92 throw NotImplementedException("GLASM instruction");
93}
94
95void EmitCompositeConstructF16x4([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register e1,
96 [[maybe_unused]] Register e2, [[maybe_unused]] Register e3,
97 [[maybe_unused]] Register e4) {
98 throw NotImplementedException("GLASM instruction");
99}
100
101void EmitCompositeExtractF16x2([[maybe_unused]] EmitContext& ctx,
102 [[maybe_unused]] Register composite, [[maybe_unused]] u32 index) {
103 throw NotImplementedException("GLASM instruction");
104}
105
106void EmitCompositeExtractF16x3([[maybe_unused]] EmitContext& ctx,
107 [[maybe_unused]] Register composite, [[maybe_unused]] u32 index) {
108 throw NotImplementedException("GLASM instruction");
109}
110
111void EmitCompositeExtractF16x4([[maybe_unused]] EmitContext& ctx,
112 [[maybe_unused]] Register composite, [[maybe_unused]] u32 index) {
113 throw NotImplementedException("GLASM instruction");
114}
115
116void EmitCompositeInsertF16x2([[maybe_unused]] EmitContext& ctx,
117 [[maybe_unused]] Register composite, [[maybe_unused]] Register object,
118 [[maybe_unused]] u32 index) {
119 throw NotImplementedException("GLASM instruction");
120}
121
122void EmitCompositeInsertF16x3([[maybe_unused]] EmitContext& ctx,
123 [[maybe_unused]] Register composite, [[maybe_unused]] Register object,
124 [[maybe_unused]] u32 index) {
125 throw NotImplementedException("GLASM instruction");
126}
127
128void EmitCompositeInsertF16x4([[maybe_unused]] EmitContext& ctx,
129 [[maybe_unused]] Register composite, [[maybe_unused]] Register object,
130 [[maybe_unused]] u32 index) {
131 throw NotImplementedException("GLASM instruction");
132}
133
134void EmitCompositeConstructF32x2([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 e1,
135 [[maybe_unused]] ScalarF32 e2) {
136 throw NotImplementedException("GLASM instruction");
137}
138
139void EmitCompositeConstructF32x3([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 e1,
140 [[maybe_unused]] ScalarF32 e2, [[maybe_unused]] ScalarF32 e3) {
141 throw NotImplementedException("GLASM instruction");
142}
143
144void EmitCompositeConstructF32x4([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 e1,
145 [[maybe_unused]] ScalarF32 e2, [[maybe_unused]] ScalarF32 e3,
146 [[maybe_unused]] ScalarF32 e4) {
147 throw NotImplementedException("GLASM instruction");
148}
149
150void EmitCompositeExtractF32x2([[maybe_unused]] EmitContext& ctx,
151 [[maybe_unused]] Register composite, [[maybe_unused]] u32 index) {
152 throw NotImplementedException("GLASM instruction");
153}
154
155void EmitCompositeExtractF32x3([[maybe_unused]] EmitContext& ctx,
156 [[maybe_unused]] Register composite, [[maybe_unused]] u32 index) {
157 throw NotImplementedException("GLASM instruction");
158}
159
160void EmitCompositeExtractF32x4([[maybe_unused]] EmitContext& ctx,
161 [[maybe_unused]] Register composite, [[maybe_unused]] u32 index) {
162 throw NotImplementedException("GLASM instruction");
163}
164
165void EmitCompositeInsertF32x2([[maybe_unused]] EmitContext& ctx,
166 [[maybe_unused]] Register composite,
167 [[maybe_unused]] ScalarF32 object, [[maybe_unused]] u32 index) {
168 throw NotImplementedException("GLASM instruction");
169}
170
171void EmitCompositeInsertF32x3([[maybe_unused]] EmitContext& ctx,
172 [[maybe_unused]] Register composite,
173 [[maybe_unused]] ScalarF32 object, [[maybe_unused]] u32 index) {
174 throw NotImplementedException("GLASM instruction");
175}
176
177void EmitCompositeInsertF32x4([[maybe_unused]] EmitContext& ctx,
178 [[maybe_unused]] Register composite,
179 [[maybe_unused]] ScalarF32 object, [[maybe_unused]] u32 index) {
180 throw NotImplementedException("GLASM instruction");
181}
182
183void EmitCompositeConstructF64x2([[maybe_unused]] EmitContext& ctx) {
184 throw NotImplementedException("GLASM instruction");
185}
186
187void EmitCompositeConstructF64x3([[maybe_unused]] EmitContext& ctx) {
188 throw NotImplementedException("GLASM instruction");
189}
190
191void EmitCompositeConstructF64x4([[maybe_unused]] EmitContext& ctx) {
192 throw NotImplementedException("GLASM instruction");
193}
194
195void EmitCompositeExtractF64x2([[maybe_unused]] EmitContext& ctx) {
196 throw NotImplementedException("GLASM instruction");
197}
198
199void EmitCompositeExtractF64x3([[maybe_unused]] EmitContext& ctx) {
200 throw NotImplementedException("GLASM instruction");
201}
202
203void EmitCompositeExtractF64x4([[maybe_unused]] EmitContext& ctx) {
204 throw NotImplementedException("GLASM instruction");
205}
206
207void EmitCompositeInsertF64x2([[maybe_unused]] EmitContext& ctx,
208 [[maybe_unused]] Register composite, [[maybe_unused]] Register object,
209 [[maybe_unused]] u32 index) {
210 throw NotImplementedException("GLASM instruction");
211}
212
213void EmitCompositeInsertF64x3([[maybe_unused]] EmitContext& ctx,
214 [[maybe_unused]] Register composite, [[maybe_unused]] Register object,
215 [[maybe_unused]] u32 index) {
216 throw NotImplementedException("GLASM instruction");
217}
218
219void EmitCompositeInsertF64x4([[maybe_unused]] EmitContext& ctx,
220 [[maybe_unused]] Register composite, [[maybe_unused]] Register object,
221 [[maybe_unused]] u32 index) {
222 throw NotImplementedException("GLASM instruction");
223}
224
225} // namespace Shader::Backend::GLASM
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp
index 72733d1cf..fed79e381 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp
@@ -10,64 +10,58 @@
10 10
11namespace Shader::Backend::GLASM { 11namespace Shader::Backend::GLASM {
12namespace { 12namespace {
13void GetCbuf(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, const IR::Value& offset, 13void GetCbuf(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, ScalarU32 offset,
14 std::string_view size) { 14 std::string_view size) {
15 if (!binding.IsImmediate()) { 15 if (!binding.IsImmediate()) {
16 throw NotImplementedException("Indirect constant buffer loading"); 16 throw NotImplementedException("Indirect constant buffer loading");
17 } 17 }
18 const std::string ret{ctx.reg_alloc.Define(inst)}; 18 const Register ret{ctx.reg_alloc.Define(inst)};
19 ctx.Add("LDC.{} {},c{}[{}];", size, ret, binding.U32(), ctx.reg_alloc.Consume(offset)); 19 ctx.Add("LDC.{} {},c{}[{}];", size, ret, binding.U32(), offset);
20} 20}
21} // Anonymous namespace 21} // Anonymous namespace
22 22
23void EmitGetCbufU8(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 23void EmitGetCbufU8(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, ScalarU32 offset) {
24 const IR::Value& offset) {
25 GetCbuf(ctx, inst, binding, offset, "U8"); 24 GetCbuf(ctx, inst, binding, offset, "U8");
26} 25}
27 26
28void EmitGetCbufS8(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 27void EmitGetCbufS8(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, ScalarU32 offset) {
29 const IR::Value& offset) {
30 GetCbuf(ctx, inst, binding, offset, "S8"); 28 GetCbuf(ctx, inst, binding, offset, "S8");
31} 29}
32 30
33void EmitGetCbufU16(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 31void EmitGetCbufU16(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, ScalarU32 offset) {
34 const IR::Value& offset) {
35 GetCbuf(ctx, inst, binding, offset, "U16"); 32 GetCbuf(ctx, inst, binding, offset, "U16");
36} 33}
37 34
38void EmitGetCbufS16(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 35void EmitGetCbufS16(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, ScalarU32 offset) {
39 const IR::Value& offset) {
40 GetCbuf(ctx, inst, binding, offset, "S16"); 36 GetCbuf(ctx, inst, binding, offset, "S16");
41} 37}
42 38
43void EmitGetCbufU32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 39void EmitGetCbufU32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, ScalarU32 offset) {
44 const IR::Value& offset) {
45 GetCbuf(ctx, inst, binding, offset, "U32"); 40 GetCbuf(ctx, inst, binding, offset, "U32");
46} 41}
47 42
48void EmitGetCbufF32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 43void EmitGetCbufF32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, ScalarU32 offset) {
49 const IR::Value& offset) {
50 GetCbuf(ctx, inst, binding, offset, "F32"); 44 GetCbuf(ctx, inst, binding, offset, "F32");
51} 45}
52 46
53void EmitGetCbufU32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 47void EmitGetCbufU32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding,
54 const IR::Value& offset) { 48 ScalarU32 offset) {
55 GetCbuf(ctx, inst, binding, offset, "U32X2"); 49 GetCbuf(ctx, inst, binding, offset, "U32X2");
56} 50}
57 51
58void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr, 52void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr,
59 [[maybe_unused]] std::string_view vertex) { 53 [[maybe_unused]] ScalarU32 vertex) {
60 if (IR::IsGeneric(attr)) { 54 if (IR::IsGeneric(attr)) {
61 const u32 index{IR::GenericAttributeIndex(attr)}; 55 const u32 index{IR::GenericAttributeIndex(attr)};
62 const u32 element{IR::GenericAttributeElement(attr)}; 56 const u32 element{IR::GenericAttributeElement(attr)};
63 ctx.Add("MOV.F {},in_attr{}.{};", inst, index, "xyzw"[element]); 57 ctx.Add("MOV.F {}.x,in_attr{}.{};", inst, index, "xyzw"[element]);
64 return; 58 return;
65 } 59 }
66 throw NotImplementedException("Get attribute {}", attr); 60 throw NotImplementedException("Get attribute {}", attr);
67} 61}
68 62
69void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, std::string_view value, 63void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, ScalarF32 value,
70 [[maybe_unused]] std::string_view vertex) { 64 [[maybe_unused]] ScalarU32 vertex) {
71 const u32 element{static_cast<u32>(attr) % 4}; 65 const u32 element{static_cast<u32>(attr) % 4};
72 const char swizzle{"xyzw"[element]}; 66 const char swizzle{"xyzw"[element]};
73 if (IR::IsGeneric(attr)) { 67 if (IR::IsGeneric(attr)) {
@@ -87,16 +81,13 @@ void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, std::string_view val
87 } 81 }
88} 82}
89 83
90void EmitGetAttributeIndexed([[maybe_unused]] EmitContext& ctx, 84void EmitGetAttributeIndexed([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarU32 offset,
91 [[maybe_unused]] std::string_view offset, 85 [[maybe_unused]] ScalarU32 vertex) {
92 [[maybe_unused]] std::string_view vertex) {
93 throw NotImplementedException("GLASM instruction"); 86 throw NotImplementedException("GLASM instruction");
94} 87}
95 88
96void EmitSetAttributeIndexed([[maybe_unused]] EmitContext& ctx, 89void EmitSetAttributeIndexed([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarU32 offset,
97 [[maybe_unused]] std::string_view offset, 90 [[maybe_unused]] ScalarF32 value, [[maybe_unused]] ScalarU32 vertex) {
98 [[maybe_unused]] std::string_view value,
99 [[maybe_unused]] std::string_view vertex) {
100 throw NotImplementedException("GLASM instruction"); 91 throw NotImplementedException("GLASM instruction");
101} 92}
102 93
@@ -105,20 +96,20 @@ void EmitGetPatch([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Patch
105} 96}
106 97
107void EmitSetPatch([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Patch patch, 98void EmitSetPatch([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Patch patch,
108 [[maybe_unused]] std::string_view value) { 99 [[maybe_unused]] ScalarF32 value) {
109 throw NotImplementedException("GLASM instruction"); 100 throw NotImplementedException("GLASM instruction");
110} 101}
111 102
112void EmitSetFragColor([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] u32 index, 103void EmitSetFragColor([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] u32 index,
113 [[maybe_unused]] u32 component, [[maybe_unused]] std::string_view value) { 104 [[maybe_unused]] u32 component, [[maybe_unused]] ScalarF32 value) {
114 throw NotImplementedException("GLASM instruction"); 105 throw NotImplementedException("GLASM instruction");
115} 106}
116 107
117void EmitSetSampleMask([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 108void EmitSetSampleMask([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 value) {
118 throw NotImplementedException("GLASM instruction"); 109 throw NotImplementedException("GLASM instruction");
119} 110}
120 111
121void EmitSetFragDepth([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 112void EmitSetFragDepth([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 value) {
122 throw NotImplementedException("GLASM instruction"); 113 throw NotImplementedException("GLASM instruction");
123} 114}
124 115
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_floating_point.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_floating_point.cpp
index db9dda261..fed6503c6 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_floating_point.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_floating_point.cpp
@@ -10,411 +10,382 @@
10 10
11namespace Shader::Backend::GLASM { 11namespace Shader::Backend::GLASM {
12 12
13void EmitFPAbs16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 13void EmitFPAbs16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value) {
14 throw NotImplementedException("GLASM instruction"); 14 throw NotImplementedException("GLASM instruction");
15} 15}
16 16
17void EmitFPAbs32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 17void EmitFPAbs32(EmitContext& ctx, IR::Inst& inst, ScalarF32 value) {
18 ctx.Add("MOV.F {},|{}|;", inst, value); 18 ctx.Add("MOV.F {}.x,|{}|;", inst, value);
19} 19}
20 20
21void EmitFPAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 21void EmitFPAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value) {
22 throw NotImplementedException("GLASM instruction"); 22 throw NotImplementedException("GLASM instruction");
23} 23}
24 24
25void EmitFPAdd16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 25void EmitFPAdd16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
26 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 26 [[maybe_unused]] Register a, [[maybe_unused]] Register b) {
27 throw NotImplementedException("GLASM instruction"); 27 throw NotImplementedException("GLASM instruction");
28} 28}
29 29
30void EmitFPAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { 30void EmitFPAdd32(EmitContext& ctx, IR::Inst& inst, ScalarF32 a, ScalarF32 b) {
31 ctx.Add("ADD.F {},{},{};", inst, a, b); 31 ctx.Add("ADD.F {}.x,{},{};", inst, a, b);
32} 32}
33 33
34void EmitFPAdd64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 34void EmitFPAdd64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
35 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 35 [[maybe_unused]] Register a, [[maybe_unused]] Register b) {
36 throw NotImplementedException("GLASM instruction"); 36 throw NotImplementedException("GLASM instruction");
37} 37}
38 38
39void EmitFPFma16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 39void EmitFPFma16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
40 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b, 40 [[maybe_unused]] Register a, [[maybe_unused]] Register b,
41 [[maybe_unused]] std::string_view c) { 41 [[maybe_unused]] Register c) {
42 throw NotImplementedException("GLASM instruction"); 42 throw NotImplementedException("GLASM instruction");
43} 43}
44 44
45void EmitFPFma32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b, 45void EmitFPFma32(EmitContext& ctx, IR::Inst& inst, ScalarF32 a, ScalarF32 b, ScalarF32 c) {
46 std::string_view c) { 46 ctx.Add("MAD.F {}.x,{},{},{};", inst, a, b, c);
47 ctx.Add("MAD.F {},{},{},{};", inst, a, b, c);
48} 47}
49 48
50void EmitFPFma64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 49void EmitFPFma64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
51 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b, 50 [[maybe_unused]] Register a, [[maybe_unused]] Register b,
52 [[maybe_unused]] std::string_view c) { 51 [[maybe_unused]] Register c) {
53 throw NotImplementedException("GLASM instruction"); 52 throw NotImplementedException("GLASM instruction");
54} 53}
55 54
56void EmitFPMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a, 55void EmitFPMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 a,
57 [[maybe_unused]] std::string_view b) { 56 [[maybe_unused]] ScalarF32 b) {
58 throw NotImplementedException("GLASM instruction"); 57 throw NotImplementedException("GLASM instruction");
59} 58}
60 59
61void EmitFPMax64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a, 60void EmitFPMax64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register a,
62 [[maybe_unused]] std::string_view b) { 61 [[maybe_unused]] Register b) {
63 throw NotImplementedException("GLASM instruction"); 62 throw NotImplementedException("GLASM instruction");
64} 63}
65 64
66void EmitFPMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a, 65void EmitFPMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 a,
67 [[maybe_unused]] std::string_view b) { 66 [[maybe_unused]] ScalarF32 b) {
68 throw NotImplementedException("GLASM instruction"); 67 throw NotImplementedException("GLASM instruction");
69} 68}
70 69
71void EmitFPMin64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a, 70void EmitFPMin64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register a,
72 [[maybe_unused]] std::string_view b) { 71 [[maybe_unused]] Register b) {
73 throw NotImplementedException("GLASM instruction"); 72 throw NotImplementedException("GLASM instruction");
74} 73}
75 74
76void EmitFPMul16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 75void EmitFPMul16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
77 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 76 [[maybe_unused]] Register a, [[maybe_unused]] Register b) {
78 throw NotImplementedException("GLASM instruction"); 77 throw NotImplementedException("GLASM instruction");
79} 78}
80 79
81void EmitFPMul32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { 80void EmitFPMul32(EmitContext& ctx, IR::Inst& inst, ScalarF32 a, ScalarF32 b) {
82 ctx.Add("MUL.F {},{},{};", inst, a, b); 81 ctx.Add("MUL.F {}.x,{},{};", inst, a, b);
83} 82}
84 83
85void EmitFPMul64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 84void EmitFPMul64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
86 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 85 [[maybe_unused]] Register a, [[maybe_unused]] Register b) {
87 throw NotImplementedException("GLASM instruction"); 86 throw NotImplementedException("GLASM instruction");
88} 87}
89 88
90void EmitFPNeg16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 89void EmitFPNeg16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value) {
91 throw NotImplementedException("GLASM instruction"); 90 throw NotImplementedException("GLASM instruction");
92} 91}
93 92
94void EmitFPNeg32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 93void EmitFPNeg32(EmitContext& ctx, IR::Inst& inst, ScalarRegister value) {
95 if (value[0] == '-') { 94 ctx.Add("MOV.F {}.x,-{};", inst, value);
96 // Guard against negating a negative immediate
97 ctx.Add("MOV.F {},{};", inst, value.substr(1));
98 } else {
99 ctx.Add("MOV.F {},-{};", inst, value);
100 }
101} 95}
102 96
103void EmitFPNeg64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 97void EmitFPNeg64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value) {
104 throw NotImplementedException("GLASM instruction"); 98 throw NotImplementedException("GLASM instruction");
105} 99}
106 100
107void EmitFPSin([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 101void EmitFPSin([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 value) {
108 throw NotImplementedException("GLASM instruction"); 102 throw NotImplementedException("GLASM instruction");
109} 103}
110 104
111void EmitFPCos([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 105void EmitFPCos([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 value) {
112 throw NotImplementedException("GLASM instruction"); 106 throw NotImplementedException("GLASM instruction");
113} 107}
114 108
115void EmitFPExp2([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 109void EmitFPExp2([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 value) {
116 throw NotImplementedException("GLASM instruction"); 110 throw NotImplementedException("GLASM instruction");
117} 111}
118 112
119void EmitFPLog2([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 113void EmitFPLog2([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 value) {
120 throw NotImplementedException("GLASM instruction"); 114 throw NotImplementedException("GLASM instruction");
121} 115}
122 116
123void EmitFPRecip32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 117void EmitFPRecip32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 value) {
124 throw NotImplementedException("GLASM instruction"); 118 throw NotImplementedException("GLASM instruction");
125} 119}
126 120
127void EmitFPRecip64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 121void EmitFPRecip64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value) {
128 throw NotImplementedException("GLASM instruction"); 122 throw NotImplementedException("GLASM instruction");
129} 123}
130 124
131void EmitFPRecipSqrt32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 125void EmitFPRecipSqrt32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 value) {
132 throw NotImplementedException("GLASM instruction"); 126 throw NotImplementedException("GLASM instruction");
133} 127}
134 128
135void EmitFPRecipSqrt64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 129void EmitFPRecipSqrt64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value) {
136 throw NotImplementedException("GLASM instruction"); 130 throw NotImplementedException("GLASM instruction");
137} 131}
138 132
139void EmitFPSqrt([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 133void EmitFPSqrt([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 value) {
140 throw NotImplementedException("GLASM instruction"); 134 throw NotImplementedException("GLASM instruction");
141} 135}
142 136
143void EmitFPSaturate16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 137void EmitFPSaturate16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value) {
144 throw NotImplementedException("GLASM instruction"); 138 throw NotImplementedException("GLASM instruction");
145} 139}
146 140
147void EmitFPSaturate32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 141void EmitFPSaturate32(EmitContext& ctx, IR::Inst& inst, ScalarF32 value) {
148 ctx.Add("MOV.F.SAT {},{};", inst, value); 142 ctx.Add("MOV.F.SAT {}.x,{};", inst, value);
149} 143}
150 144
151void EmitFPSaturate64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 145void EmitFPSaturate64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value) {
152 throw NotImplementedException("GLASM instruction"); 146 throw NotImplementedException("GLASM instruction");
153} 147}
154 148
155void EmitFPClamp16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value, 149void EmitFPClamp16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value,
156 [[maybe_unused]] std::string_view min_value, 150 [[maybe_unused]] Register min_value, [[maybe_unused]] Register max_value) {
157 [[maybe_unused]] std::string_view max_value) {
158 throw NotImplementedException("GLASM instruction"); 151 throw NotImplementedException("GLASM instruction");
159} 152}
160 153
161void EmitFPClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value, 154void EmitFPClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 value,
162 [[maybe_unused]] std::string_view min_value, 155 [[maybe_unused]] ScalarF32 min_value, [[maybe_unused]] ScalarF32 max_value) {
163 [[maybe_unused]] std::string_view max_value) {
164 throw NotImplementedException("GLASM instruction"); 156 throw NotImplementedException("GLASM instruction");
165} 157}
166 158
167void EmitFPClamp64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value, 159void EmitFPClamp64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value,
168 [[maybe_unused]] std::string_view min_value, 160 [[maybe_unused]] Register min_value, [[maybe_unused]] Register max_value) {
169 [[maybe_unused]] std::string_view max_value) {
170 throw NotImplementedException("GLASM instruction"); 161 throw NotImplementedException("GLASM instruction");
171} 162}
172 163
173void EmitFPRoundEven16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 164void EmitFPRoundEven16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value) {
174 throw NotImplementedException("GLASM instruction"); 165 throw NotImplementedException("GLASM instruction");
175} 166}
176 167
177void EmitFPRoundEven32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 168void EmitFPRoundEven32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 value) {
178 throw NotImplementedException("GLASM instruction"); 169 throw NotImplementedException("GLASM instruction");
179} 170}
180 171
181void EmitFPRoundEven64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 172void EmitFPRoundEven64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value) {
182 throw NotImplementedException("GLASM instruction"); 173 throw NotImplementedException("GLASM instruction");
183} 174}
184 175
185void EmitFPFloor16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 176void EmitFPFloor16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value) {
186 throw NotImplementedException("GLASM instruction"); 177 throw NotImplementedException("GLASM instruction");
187} 178}
188 179
189void EmitFPFloor32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 180void EmitFPFloor32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 value) {
190 throw NotImplementedException("GLASM instruction"); 181 throw NotImplementedException("GLASM instruction");
191} 182}
192 183
193void EmitFPFloor64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 184void EmitFPFloor64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value) {
194 throw NotImplementedException("GLASM instruction"); 185 throw NotImplementedException("GLASM instruction");
195} 186}
196 187
197void EmitFPCeil16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 188void EmitFPCeil16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value) {
198 throw NotImplementedException("GLASM instruction"); 189 throw NotImplementedException("GLASM instruction");
199} 190}
200 191
201void EmitFPCeil32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 192void EmitFPCeil32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 value) {
202 throw NotImplementedException("GLASM instruction"); 193 throw NotImplementedException("GLASM instruction");
203} 194}
204 195
205void EmitFPCeil64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 196void EmitFPCeil64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value) {
206 throw NotImplementedException("GLASM instruction"); 197 throw NotImplementedException("GLASM instruction");
207} 198}
208 199
209void EmitFPTrunc16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 200void EmitFPTrunc16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value) {
210 throw NotImplementedException("GLASM instruction"); 201 throw NotImplementedException("GLASM instruction");
211} 202}
212 203
213void EmitFPTrunc32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 204void EmitFPTrunc32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 value) {
214 throw NotImplementedException("GLASM instruction"); 205 throw NotImplementedException("GLASM instruction");
215} 206}
216 207
217void EmitFPTrunc64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 208void EmitFPTrunc64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value) {
218 throw NotImplementedException("GLASM instruction"); 209 throw NotImplementedException("GLASM instruction");
219} 210}
220 211
221void EmitFPOrdEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 212void EmitFPOrdEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
222 [[maybe_unused]] std::string_view rhs) { 213 [[maybe_unused]] Register rhs) {
223 throw NotImplementedException("GLASM instruction"); 214 throw NotImplementedException("GLASM instruction");
224} 215}
225 216
226void EmitFPOrdEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 217void EmitFPOrdEqual32(EmitContext& ctx, IR::Inst& inst, ScalarF32 lhs, ScalarF32 rhs) {
227 std::string_view rhs) { 218 const Register ret{ctx.reg_alloc.Define(inst)};
228 const std::string ret{ctx.reg_alloc.Define(inst)}; 219 ctx.Add("SEQ.F {}.x,{},{};SNE.S {}.x,{},0;", ret, lhs, rhs, ret, ret);
229 ctx.Add("SEQ.F {},{},{};SNE.S {},{},0;", ret, lhs, rhs, ret, ret);
230} 220}
231 221
232void EmitFPOrdEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 222void EmitFPOrdEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
233 [[maybe_unused]] std::string_view rhs) { 223 [[maybe_unused]] Register rhs) {
234 throw NotImplementedException("GLASM instruction"); 224 throw NotImplementedException("GLASM instruction");
235} 225}
236 226
237void EmitFPUnordEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 227void EmitFPUnordEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
238 [[maybe_unused]] std::string_view rhs) { 228 [[maybe_unused]] Register rhs) {
239 throw NotImplementedException("GLASM instruction"); 229 throw NotImplementedException("GLASM instruction");
240} 230}
241 231
242void EmitFPUnordEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 232void EmitFPUnordEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 lhs,
243 [[maybe_unused]] std::string_view rhs) { 233 [[maybe_unused]] ScalarF32 rhs) {
244 throw NotImplementedException("GLASM instruction"); 234 throw NotImplementedException("GLASM instruction");
245} 235}
246 236
247void EmitFPUnordEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 237void EmitFPUnordEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
248 [[maybe_unused]] std::string_view rhs) { 238 [[maybe_unused]] Register rhs) {
249 throw NotImplementedException("GLASM instruction"); 239 throw NotImplementedException("GLASM instruction");
250} 240}
251 241
252void EmitFPOrdNotEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 242void EmitFPOrdNotEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
253 [[maybe_unused]] std::string_view rhs) { 243 [[maybe_unused]] Register rhs) {
254 throw NotImplementedException("GLASM instruction"); 244 throw NotImplementedException("GLASM instruction");
255} 245}
256 246
257void EmitFPOrdNotEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 247void EmitFPOrdNotEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 lhs,
258 [[maybe_unused]] std::string_view rhs) { 248 [[maybe_unused]] ScalarF32 rhs) {
259 throw NotImplementedException("GLASM instruction"); 249 throw NotImplementedException("GLASM instruction");
260} 250}
261 251
262void EmitFPOrdNotEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 252void EmitFPOrdNotEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
263 [[maybe_unused]] std::string_view rhs) { 253 [[maybe_unused]] Register rhs) {
264 throw NotImplementedException("GLASM instruction"); 254 throw NotImplementedException("GLASM instruction");
265} 255}
266 256
267void EmitFPUnordNotEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 257void EmitFPUnordNotEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
268 [[maybe_unused]] std::string_view rhs) { 258 [[maybe_unused]] Register rhs) {
269 throw NotImplementedException("GLASM instruction"); 259 throw NotImplementedException("GLASM instruction");
270} 260}
271 261
272void EmitFPUnordNotEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 262void EmitFPUnordNotEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 lhs,
273 [[maybe_unused]] std::string_view rhs) { 263 [[maybe_unused]] ScalarF32 rhs) {
274 throw NotImplementedException("GLASM instruction"); 264 throw NotImplementedException("GLASM instruction");
275} 265}
276 266
277void EmitFPUnordNotEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 267void EmitFPUnordNotEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
278 [[maybe_unused]] std::string_view rhs) { 268 [[maybe_unused]] Register rhs) {
279 throw NotImplementedException("GLASM instruction"); 269 throw NotImplementedException("GLASM instruction");
280} 270}
281 271
282void EmitFPOrdLessThan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 272void EmitFPOrdLessThan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
283 [[maybe_unused]] std::string_view rhs) { 273 [[maybe_unused]] Register rhs) {
284 throw NotImplementedException("GLASM instruction"); 274 throw NotImplementedException("GLASM instruction");
285} 275}
286 276
287void EmitFPOrdLessThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 277void EmitFPOrdLessThan32(EmitContext& ctx, IR::Inst& inst, ScalarF32 lhs, ScalarF32 rhs) {
288 std::string_view rhs) { 278 const Register ret{ctx.reg_alloc.Define(inst)};
289 const std::string ret{ctx.reg_alloc.Define(inst)}; 279 ctx.Add("SLT.F {}.x,{},{};SNE.S {}.x,{}.x,0;", ret, lhs, rhs, ret, ret);
290 ctx.Add("SLT.F {},{},{};SNE.S {},{},0;", ret, lhs, rhs, ret, ret);
291} 280}
292 281
293void EmitFPOrdLessThan64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 282void EmitFPOrdLessThan64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
294 [[maybe_unused]] std::string_view rhs) { 283 [[maybe_unused]] Register rhs) {
295 throw NotImplementedException("GLASM instruction"); 284 throw NotImplementedException("GLASM instruction");
296} 285}
297 286
298void EmitFPUnordLessThan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 287void EmitFPUnordLessThan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
299 [[maybe_unused]] std::string_view rhs) { 288 [[maybe_unused]] Register rhs) {
300 throw NotImplementedException("GLASM instruction"); 289 throw NotImplementedException("GLASM instruction");
301} 290}
302 291
303void EmitFPUnordLessThan32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 292void EmitFPUnordLessThan32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 lhs,
304 [[maybe_unused]] std::string_view rhs) { 293 [[maybe_unused]] ScalarF32 rhs) {
305 throw NotImplementedException("GLASM instruction"); 294 throw NotImplementedException("GLASM instruction");
306} 295}
307 296
308void EmitFPUnordLessThan64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 297void EmitFPUnordLessThan64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
309 [[maybe_unused]] std::string_view rhs) { 298 [[maybe_unused]] Register rhs) {
310 throw NotImplementedException("GLASM instruction"); 299 throw NotImplementedException("GLASM instruction");
311} 300}
312 301
313void EmitFPOrdGreaterThan16([[maybe_unused]] EmitContext& ctx, 302void EmitFPOrdGreaterThan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
314 [[maybe_unused]] std::string_view lhs, 303 [[maybe_unused]] Register rhs) {
315 [[maybe_unused]] std::string_view rhs) {
316 throw NotImplementedException("GLASM instruction"); 304 throw NotImplementedException("GLASM instruction");
317} 305}
318 306
319void EmitFPOrdGreaterThan32([[maybe_unused]] EmitContext& ctx, 307void EmitFPOrdGreaterThan32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 lhs,
320 [[maybe_unused]] std::string_view lhs, 308 [[maybe_unused]] ScalarF32 rhs) {
321 [[maybe_unused]] std::string_view rhs) {
322 throw NotImplementedException("GLASM instruction"); 309 throw NotImplementedException("GLASM instruction");
323} 310}
324 311
325void EmitFPOrdGreaterThan64([[maybe_unused]] EmitContext& ctx, 312void EmitFPOrdGreaterThan64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
326 [[maybe_unused]] std::string_view lhs, 313 [[maybe_unused]] Register rhs) {
327 [[maybe_unused]] std::string_view rhs) {
328 throw NotImplementedException("GLASM instruction"); 314 throw NotImplementedException("GLASM instruction");
329} 315}
330 316
331void EmitFPUnordGreaterThan16([[maybe_unused]] EmitContext& ctx, 317void EmitFPUnordGreaterThan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
332 [[maybe_unused]] std::string_view lhs, 318 [[maybe_unused]] Register rhs) {
333 [[maybe_unused]] std::string_view rhs) {
334 throw NotImplementedException("GLASM instruction"); 319 throw NotImplementedException("GLASM instruction");
335} 320}
336 321
337void EmitFPUnordGreaterThan32([[maybe_unused]] EmitContext& ctx, 322void EmitFPUnordGreaterThan32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 lhs,
338 [[maybe_unused]] std::string_view lhs, 323 [[maybe_unused]] ScalarF32 rhs) {
339 [[maybe_unused]] std::string_view rhs) {
340 throw NotImplementedException("GLASM instruction"); 324 throw NotImplementedException("GLASM instruction");
341} 325}
342 326
343void EmitFPUnordGreaterThan64([[maybe_unused]] EmitContext& ctx, 327void EmitFPUnordGreaterThan64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
344 [[maybe_unused]] std::string_view lhs, 328 [[maybe_unused]] Register rhs) {
345 [[maybe_unused]] std::string_view rhs) {
346 throw NotImplementedException("GLASM instruction"); 329 throw NotImplementedException("GLASM instruction");
347} 330}
348 331
349void EmitFPOrdLessThanEqual16([[maybe_unused]] EmitContext& ctx, 332void EmitFPOrdLessThanEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
350 [[maybe_unused]] std::string_view lhs, 333 [[maybe_unused]] Register rhs) {
351 [[maybe_unused]] std::string_view rhs) {
352 throw NotImplementedException("GLASM instruction"); 334 throw NotImplementedException("GLASM instruction");
353} 335}
354 336
355void EmitFPOrdLessThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 337void EmitFPOrdLessThanEqual32(EmitContext& ctx, IR::Inst& inst, ScalarF32 lhs, ScalarF32 rhs) {
356 std::string_view rhs) { 338 const Register ret{ctx.reg_alloc.Define(inst)};
357 const std::string ret{ctx.reg_alloc.Define(inst)}; 339 ctx.Add("SLE.F {}.x,{},{};SNE.S {}.x,{}.x,0;", ret, lhs, rhs, ret, ret);
358 ctx.Add("SLE.F {},{},{};SNE.S {},{},0;", ret, lhs, rhs, ret, ret);
359} 340}
360 341
361void EmitFPOrdLessThanEqual64([[maybe_unused]] EmitContext& ctx, 342void EmitFPOrdLessThanEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
362 [[maybe_unused]] std::string_view lhs, 343 [[maybe_unused]] Register rhs) {
363 [[maybe_unused]] std::string_view rhs) {
364 throw NotImplementedException("GLASM instruction"); 344 throw NotImplementedException("GLASM instruction");
365} 345}
366 346
367void EmitFPUnordLessThanEqual16([[maybe_unused]] EmitContext& ctx, 347void EmitFPUnordLessThanEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
368 [[maybe_unused]] std::string_view lhs, 348 [[maybe_unused]] Register rhs) {
369 [[maybe_unused]] std::string_view rhs) {
370 throw NotImplementedException("GLASM instruction"); 349 throw NotImplementedException("GLASM instruction");
371} 350}
372 351
373void EmitFPUnordLessThanEqual32([[maybe_unused]] EmitContext& ctx, 352void EmitFPUnordLessThanEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 lhs,
374 [[maybe_unused]] std::string_view lhs, 353 [[maybe_unused]] ScalarF32 rhs) {
375 [[maybe_unused]] std::string_view rhs) {
376 throw NotImplementedException("GLASM instruction"); 354 throw NotImplementedException("GLASM instruction");
377} 355}
378 356
379void EmitFPUnordLessThanEqual64([[maybe_unused]] EmitContext& ctx, 357void EmitFPUnordLessThanEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
380 [[maybe_unused]] std::string_view lhs, 358 [[maybe_unused]] Register rhs) {
381 [[maybe_unused]] std::string_view rhs) {
382 throw NotImplementedException("GLASM instruction"); 359 throw NotImplementedException("GLASM instruction");
383} 360}
384 361
385void EmitFPOrdGreaterThanEqual16([[maybe_unused]] EmitContext& ctx, 362void EmitFPOrdGreaterThanEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
386 [[maybe_unused]] std::string_view lhs, 363 [[maybe_unused]] Register rhs) {
387 [[maybe_unused]] std::string_view rhs) {
388 throw NotImplementedException("GLASM instruction"); 364 throw NotImplementedException("GLASM instruction");
389} 365}
390 366
391void EmitFPOrdGreaterThanEqual32([[maybe_unused]] EmitContext& ctx, 367void EmitFPOrdGreaterThanEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarF32 lhs,
392 [[maybe_unused]] std::string_view lhs, 368 [[maybe_unused]] ScalarF32 rhs) {
393 [[maybe_unused]] std::string_view rhs) {
394 throw NotImplementedException("GLASM instruction"); 369 throw NotImplementedException("GLASM instruction");
395} 370}
396 371
397void EmitFPOrdGreaterThanEqual64([[maybe_unused]] EmitContext& ctx, 372void EmitFPOrdGreaterThanEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
398 [[maybe_unused]] std::string_view lhs, 373 [[maybe_unused]] Register rhs) {
399 [[maybe_unused]] std::string_view rhs) {
400 throw NotImplementedException("GLASM instruction"); 374 throw NotImplementedException("GLASM instruction");
401} 375}
402 376
403void EmitFPUnordGreaterThanEqual16([[maybe_unused]] EmitContext& ctx, 377void EmitFPUnordGreaterThanEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
404 [[maybe_unused]] std::string_view lhs, 378 [[maybe_unused]] Register rhs) {
405 [[maybe_unused]] std::string_view rhs) {
406 throw NotImplementedException("GLASM instruction"); 379 throw NotImplementedException("GLASM instruction");
407} 380}
408 381
409void EmitFPUnordGreaterThanEqual32([[maybe_unused]] EmitContext& ctx, 382void EmitFPUnordGreaterThanEqual32([[maybe_unused]] EmitContext& ctx,
410 [[maybe_unused]] std::string_view lhs, 383 [[maybe_unused]] ScalarF32 lhs, [[maybe_unused]] ScalarF32 rhs) {
411 [[maybe_unused]] std::string_view rhs) {
412 throw NotImplementedException("GLASM instruction"); 384 throw NotImplementedException("GLASM instruction");
413} 385}
414 386
415void EmitFPUnordGreaterThanEqual64([[maybe_unused]] EmitContext& ctx, 387void EmitFPUnordGreaterThanEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register lhs,
416 [[maybe_unused]] std::string_view lhs, 388 [[maybe_unused]] Register rhs) {
417 [[maybe_unused]] std::string_view rhs) {
418 throw NotImplementedException("GLASM instruction"); 389 throw NotImplementedException("GLASM instruction");
419} 390}
420 391
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h b/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h
index 222285021..6db76bf46 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h
@@ -4,9 +4,8 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <string_view>
8
9#include "common/common_types.h" 7#include "common/common_types.h"
8#include "shader_recompiler/backend/glasm/reg_alloc.h"
10 9
11namespace Shader::IR { 10namespace Shader::IR {
12enum class Attribute : u64; 11enum class Attribute : u64;
@@ -23,15 +22,14 @@ class EmitContext;
23void EmitPhi(EmitContext& ctx, IR::Inst& inst); 22void EmitPhi(EmitContext& ctx, IR::Inst& inst);
24void EmitVoid(EmitContext& ctx); 23void EmitVoid(EmitContext& ctx);
25void EmitIdentity(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); 24void EmitIdentity(EmitContext& ctx, IR::Inst& inst, const IR::Value& value);
26void EmitBranch(EmitContext& ctx, std::string_view label); 25void EmitBranch(EmitContext& ctx);
27void EmitBranchConditional(EmitContext& ctx, std::string_view condition, 26void EmitBranchConditional(EmitContext& ctx);
28 std::string_view true_label, std::string_view false_label); 27void EmitLoopMerge(EmitContext& ctx);
29void EmitLoopMerge(EmitContext& ctx, std::string_view merge_label, std::string_view continue_label); 28void EmitSelectionMerge(EmitContext& ctx);
30void EmitSelectionMerge(EmitContext& ctx, std::string_view merge_label);
31void EmitReturn(EmitContext& ctx); 29void EmitReturn(EmitContext& ctx);
32void EmitJoin(EmitContext& ctx); 30void EmitJoin(EmitContext& ctx);
33void EmitUnreachable(EmitContext& ctx); 31void EmitUnreachable(EmitContext& ctx);
34void EmitDemoteToHelperInvocation(EmitContext& ctx, std::string_view continue_label); 32void EmitDemoteToHelperInvocation(EmitContext& ctx);
35void EmitBarrier(EmitContext& ctx); 33void EmitBarrier(EmitContext& ctx);
36void EmitWorkgroupMemoryBarrier(EmitContext& ctx); 34void EmitWorkgroupMemoryBarrier(EmitContext& ctx);
37void EmitDeviceMemoryBarrier(EmitContext& ctx); 35void EmitDeviceMemoryBarrier(EmitContext& ctx);
@@ -47,32 +45,22 @@ void EmitSetGotoVariable(EmitContext& ctx);
47void EmitGetGotoVariable(EmitContext& ctx); 45void EmitGetGotoVariable(EmitContext& ctx);
48void EmitSetIndirectBranchVariable(EmitContext& ctx); 46void EmitSetIndirectBranchVariable(EmitContext& ctx);
49void EmitGetIndirectBranchVariable(EmitContext& ctx); 47void EmitGetIndirectBranchVariable(EmitContext& ctx);
50void EmitGetCbufU8(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 48void EmitGetCbufU8(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, ScalarU32 offset);
51 const IR::Value& offset); 49void EmitGetCbufS8(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, ScalarU32 offset);
52void EmitGetCbufS8(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 50void EmitGetCbufU16(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, ScalarU32 offset);
53 const IR::Value& offset); 51void EmitGetCbufS16(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, ScalarU32 offset);
54void EmitGetCbufU16(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 52void EmitGetCbufU32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, ScalarU32 offset);
55 const IR::Value& offset); 53void EmitGetCbufF32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, ScalarU32 offset);
56void EmitGetCbufS16(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 54void EmitGetCbufU32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, ScalarU32 offset);
57 const IR::Value& offset); 55void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr, ScalarU32 vertex);
58void EmitGetCbufU32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 56void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, ScalarF32 value, ScalarU32 vertex);
59 const IR::Value& offset); 57void EmitGetAttributeIndexed(EmitContext& ctx, ScalarU32 offset, ScalarU32 vertex);
60void EmitGetCbufF32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 58void EmitSetAttributeIndexed(EmitContext& ctx, ScalarU32 offset, ScalarF32 value, ScalarU32 vertex);
61 const IR::Value& offset);
62void EmitGetCbufU32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding,
63 const IR::Value& offset);
64void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr,
65 std::string_view vertex);
66void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, std::string_view value,
67 std::string_view vertex);
68void EmitGetAttributeIndexed(EmitContext& ctx, std::string_view offset, std::string_view vertex);
69void EmitSetAttributeIndexed(EmitContext& ctx, std::string_view offset, std::string_view value,
70 std::string_view vertex);
71void EmitGetPatch(EmitContext& ctx, IR::Patch patch); 59void EmitGetPatch(EmitContext& ctx, IR::Patch patch);
72void EmitSetPatch(EmitContext& ctx, IR::Patch patch, std::string_view value); 60void EmitSetPatch(EmitContext& ctx, IR::Patch patch, ScalarF32 value);
73void EmitSetFragColor(EmitContext& ctx, u32 index, u32 component, std::string_view value); 61void EmitSetFragColor(EmitContext& ctx, u32 index, u32 component, ScalarF32 value);
74void EmitSetSampleMask(EmitContext& ctx, std::string_view value); 62void EmitSetSampleMask(EmitContext& ctx, ScalarF32 value);
75void EmitSetFragDepth(EmitContext& ctx, std::string_view value); 63void EmitSetFragDepth(EmitContext& ctx, ScalarF32 value);
76void EmitGetZFlag(EmitContext& ctx); 64void EmitGetZFlag(EmitContext& ctx);
77void EmitGetSFlag(EmitContext& ctx); 65void EmitGetSFlag(EmitContext& ctx);
78void EmitGetCFlag(EmitContext& ctx); 66void EmitGetCFlag(EmitContext& ctx);
@@ -82,13 +70,13 @@ void EmitSetSFlag(EmitContext& ctx);
82void EmitSetCFlag(EmitContext& ctx); 70void EmitSetCFlag(EmitContext& ctx);
83void EmitSetOFlag(EmitContext& ctx); 71void EmitSetOFlag(EmitContext& ctx);
84void EmitWorkgroupId(EmitContext& ctx); 72void EmitWorkgroupId(EmitContext& ctx);
85void EmitLocalInvocationId(EmitContext& ctx); 73void EmitLocalInvocationId(EmitContext& ctx, IR::Inst& inst);
86void EmitInvocationId(EmitContext& ctx); 74void EmitInvocationId(EmitContext& ctx);
87void EmitSampleId(EmitContext& ctx); 75void EmitSampleId(EmitContext& ctx);
88void EmitIsHelperInvocation(EmitContext& ctx); 76void EmitIsHelperInvocation(EmitContext& ctx);
89void EmitYDirection(EmitContext& ctx); 77void EmitYDirection(EmitContext& ctx);
90void EmitLoadLocal(EmitContext& ctx, std::string_view word_offset); 78void EmitLoadLocal(EmitContext& ctx, ScalarU32 word_offset);
91void EmitWriteLocal(EmitContext& ctx, std::string_view word_offset, std::string_view value); 79void EmitWriteLocal(EmitContext& ctx, ScalarU32 word_offset, ScalarU32 value);
92void EmitUndefU1(EmitContext& ctx); 80void EmitUndefU1(EmitContext& ctx);
93void EmitUndefU8(EmitContext& ctx); 81void EmitUndefU8(EmitContext& ctx);
94void EmitUndefU16(EmitContext& ctx); 82void EmitUndefU16(EmitContext& ctx);
@@ -98,368 +86,321 @@ void EmitLoadGlobalU8(EmitContext& ctx);
98void EmitLoadGlobalS8(EmitContext& ctx); 86void EmitLoadGlobalS8(EmitContext& ctx);
99void EmitLoadGlobalU16(EmitContext& ctx); 87void EmitLoadGlobalU16(EmitContext& ctx);
100void EmitLoadGlobalS16(EmitContext& ctx); 88void EmitLoadGlobalS16(EmitContext& ctx);
101void EmitLoadGlobal32(EmitContext& ctx, std::string_view address); 89void EmitLoadGlobal32(EmitContext& ctx, Register address);
102void EmitLoadGlobal64(EmitContext& ctx, std::string_view address); 90void EmitLoadGlobal64(EmitContext& ctx, Register address);
103void EmitLoadGlobal128(EmitContext& ctx, std::string_view address); 91void EmitLoadGlobal128(EmitContext& ctx, Register address);
104void EmitWriteGlobalU8(EmitContext& ctx); 92void EmitWriteGlobalU8(EmitContext& ctx);
105void EmitWriteGlobalS8(EmitContext& ctx); 93void EmitWriteGlobalS8(EmitContext& ctx);
106void EmitWriteGlobalU16(EmitContext& ctx); 94void EmitWriteGlobalU16(EmitContext& ctx);
107void EmitWriteGlobalS16(EmitContext& ctx); 95void EmitWriteGlobalS16(EmitContext& ctx);
108void EmitWriteGlobal32(EmitContext& ctx, std::string_view address, std::string_view value); 96void EmitWriteGlobal32(EmitContext& ctx, Register address, ScalarU32 value);
109void EmitWriteGlobal64(EmitContext& ctx, std::string_view address, std::string_view value); 97void EmitWriteGlobal64(EmitContext& ctx, Register address, Register value);
110void EmitWriteGlobal128(EmitContext& ctx, std::string_view address, std::string_view value); 98void EmitWriteGlobal128(EmitContext& ctx, Register address, Register value);
111void EmitLoadStorageU8(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 99void EmitLoadStorageU8(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding,
112 std::string_view offset); 100 ScalarU32 offset);
113void EmitLoadStorageS8(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 101void EmitLoadStorageS8(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding,
114 std::string_view offset); 102 ScalarU32 offset);
115void EmitLoadStorageU16(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 103void EmitLoadStorageU16(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding,
116 std::string_view offset); 104 ScalarU32 offset);
117void EmitLoadStorageS16(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 105void EmitLoadStorageS16(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding,
118 std::string_view offset); 106 ScalarU32 offset);
119void EmitLoadStorage32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 107void EmitLoadStorage32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding,
120 std::string_view offset); 108 ScalarU32 offset);
121void EmitLoadStorage64(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 109void EmitLoadStorage64(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding,
122 std::string_view offset); 110 ScalarU32 offset);
123void EmitLoadStorage128(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 111void EmitLoadStorage128(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding,
124 std::string_view offset); 112 ScalarU32 offset);
125void EmitWriteStorageU8(EmitContext& ctx, const IR::Value& binding, std::string_view offset, 113void EmitWriteStorageU8(EmitContext& ctx, const IR::Value& binding, ScalarU32 offset,
126 std::string_view value); 114 ScalarU32 value);
127void EmitWriteStorageS8(EmitContext& ctx, const IR::Value& binding, std::string_view offset, 115void EmitWriteStorageS8(EmitContext& ctx, const IR::Value& binding, ScalarU32 offset,
128 std::string_view value); 116 ScalarS32 value);
129void EmitWriteStorageU16(EmitContext& ctx, const IR::Value& binding, std::string_view offset, 117void EmitWriteStorageU16(EmitContext& ctx, const IR::Value& binding, ScalarU32 offset,
130 std::string_view value); 118 ScalarU32 value);
131void EmitWriteStorageS16(EmitContext& ctx, const IR::Value& binding, std::string_view offset, 119void EmitWriteStorageS16(EmitContext& ctx, const IR::Value& binding, ScalarU32 offset,
132 std::string_view value); 120 ScalarS32 value);
133void EmitWriteStorage32(EmitContext& ctx, const IR::Value& binding, std::string_view offset, 121void EmitWriteStorage32(EmitContext& ctx, const IR::Value& binding, ScalarU32 offset,
134 std::string_view value); 122 ScalarU32 value);
135void EmitWriteStorage64(EmitContext& ctx, const IR::Value& binding, std::string_view offset, 123void EmitWriteStorage64(EmitContext& ctx, const IR::Value& binding, ScalarU32 offset,
136 std::string_view value); 124 Register value);
137void EmitWriteStorage128(EmitContext& ctx, const IR::Value& binding, std::string_view offset, 125void EmitWriteStorage128(EmitContext& ctx, const IR::Value& binding, ScalarU32 offset,
138 std::string_view value); 126 Register value);
139void EmitLoadSharedU8(EmitContext& ctx, std::string_view offset); 127void EmitLoadSharedU8(EmitContext& ctx, ScalarU32 offset);
140void EmitLoadSharedS8(EmitContext& ctx, std::string_view offset); 128void EmitLoadSharedS8(EmitContext& ctx, ScalarU32 offset);
141void EmitLoadSharedU16(EmitContext& ctx, std::string_view offset); 129void EmitLoadSharedU16(EmitContext& ctx, ScalarU32 offset);
142void EmitLoadSharedS16(EmitContext& ctx, std::string_view offset); 130void EmitLoadSharedS16(EmitContext& ctx, ScalarU32 offset);
143void EmitLoadSharedU32(EmitContext& ctx, std::string_view offset); 131void EmitLoadSharedU32(EmitContext& ctx, ScalarU32 offset);
144void EmitLoadSharedU64(EmitContext& ctx, std::string_view offset); 132void EmitLoadSharedU64(EmitContext& ctx, ScalarU32 offset);
145void EmitLoadSharedU128(EmitContext& ctx, std::string_view offset); 133void EmitLoadSharedU128(EmitContext& ctx, ScalarU32 offset);
146void EmitWriteSharedU8(EmitContext& ctx, std::string_view offset, std::string_view value); 134void EmitWriteSharedU8(EmitContext& ctx, ScalarU32 offset, ScalarU32 value);
147void EmitWriteSharedU16(EmitContext& ctx, std::string_view offset, std::string_view value); 135void EmitWriteSharedU16(EmitContext& ctx, ScalarU32 offset, ScalarU32 value);
148void EmitWriteSharedU32(EmitContext& ctx, std::string_view offset, std::string_view value); 136void EmitWriteSharedU32(EmitContext& ctx, ScalarU32 offset, ScalarU32 value);
149void EmitWriteSharedU64(EmitContext& ctx, std::string_view offset, std::string_view value); 137void EmitWriteSharedU64(EmitContext& ctx, ScalarU32 offset, Register value);
150void EmitWriteSharedU128(EmitContext& ctx, std::string_view offset, std::string_view value); 138void EmitWriteSharedU128(EmitContext& ctx, ScalarU32 offset, Register value);
151void EmitCompositeConstructU32x2(EmitContext& ctx, std::string_view e1, std::string_view e2); 139void EmitCompositeConstructU32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value& e1,
152void EmitCompositeConstructU32x3(EmitContext& ctx, std::string_view e1, std::string_view e2, 140 const IR::Value& e2);
153 std::string_view e3); 141void EmitCompositeConstructU32x3(EmitContext& ctx, IR::Inst& inst, const IR::Value& e1,
154void EmitCompositeConstructU32x4(EmitContext& ctx, std::string_view e1, std::string_view e2, 142 const IR::Value& e2, const IR::Value& e3);
155 std::string_view e3, std::string_view e4); 143void EmitCompositeConstructU32x4(EmitContext& ctx, IR::Inst& inst, const IR::Value& e1,
156void EmitCompositeExtractU32x2(EmitContext& ctx, std::string_view composite, u32 index); 144 const IR::Value& e2, const IR::Value& e3, const IR::Value& e4);
157void EmitCompositeExtractU32x3(EmitContext& ctx, std::string_view composite, u32 index); 145void EmitCompositeExtractU32x2(EmitContext& ctx, IR::Inst& inst, Register composite, u32 index);
158void EmitCompositeExtractU32x4(EmitContext& ctx, std::string_view composite, u32 index); 146void EmitCompositeExtractU32x3(EmitContext& ctx, IR::Inst& inst, Register composite, u32 index);
159void EmitCompositeInsertU32x2(EmitContext& ctx, std::string_view composite, std::string_view object, 147void EmitCompositeExtractU32x4(EmitContext& ctx, IR::Inst& inst, Register composite, u32 index);
160 u32 index); 148void EmitCompositeInsertU32x2(EmitContext& ctx, Register composite, ScalarU32 object, u32 index);
161void EmitCompositeInsertU32x3(EmitContext& ctx, std::string_view composite, std::string_view object, 149void EmitCompositeInsertU32x3(EmitContext& ctx, Register composite, ScalarU32 object, u32 index);
162 u32 index); 150void EmitCompositeInsertU32x4(EmitContext& ctx, Register composite, ScalarU32 object, u32 index);
163void EmitCompositeInsertU32x4(EmitContext& ctx, std::string_view composite, std::string_view object, 151void EmitCompositeConstructF16x2(EmitContext& ctx, Register e1, Register e2);
164 u32 index); 152void EmitCompositeConstructF16x3(EmitContext& ctx, Register e1, Register e2, Register e3);
165void EmitCompositeConstructF16x2(EmitContext& ctx, std::string_view e1, std::string_view e2); 153void EmitCompositeConstructF16x4(EmitContext& ctx, Register e1, Register e2, Register e3,
166void EmitCompositeConstructF16x3(EmitContext& ctx, std::string_view e1, std::string_view e2, 154 Register e4);
167 std::string_view e3); 155void EmitCompositeExtractF16x2(EmitContext& ctx, Register composite, u32 index);
168void EmitCompositeConstructF16x4(EmitContext& ctx, std::string_view e1, std::string_view e2, 156void EmitCompositeExtractF16x3(EmitContext& ctx, Register composite, u32 index);
169 std::string_view e3, std::string_view e4); 157void EmitCompositeExtractF16x4(EmitContext& ctx, Register composite, u32 index);
170void EmitCompositeExtractF16x2(EmitContext& ctx, std::string_view composite, u32 index); 158void EmitCompositeInsertF16x2(EmitContext& ctx, Register composite, Register object, u32 index);
171void EmitCompositeExtractF16x3(EmitContext& ctx, std::string_view composite, u32 index); 159void EmitCompositeInsertF16x3(EmitContext& ctx, Register composite, Register object, u32 index);
172void EmitCompositeExtractF16x4(EmitContext& ctx, std::string_view composite, u32 index); 160void EmitCompositeInsertF16x4(EmitContext& ctx, Register composite, Register object, u32 index);
173void EmitCompositeInsertF16x2(EmitContext& ctx, std::string_view composite, std::string_view object, 161void EmitCompositeConstructF32x2(EmitContext& ctx, ScalarF32 e1, ScalarF32 e2);
174 u32 index); 162void EmitCompositeConstructF32x3(EmitContext& ctx, ScalarF32 e1, ScalarF32 e2, ScalarF32 e3);
175void EmitCompositeInsertF16x3(EmitContext& ctx, std::string_view composite, std::string_view object, 163void EmitCompositeConstructF32x4(EmitContext& ctx, ScalarF32 e1, ScalarF32 e2, ScalarF32 e3,
176 u32 index); 164 ScalarF32 e4);
177void EmitCompositeInsertF16x4(EmitContext& ctx, std::string_view composite, std::string_view object, 165void EmitCompositeExtractF32x2(EmitContext& ctx, Register composite, u32 index);
178 u32 index); 166void EmitCompositeExtractF32x3(EmitContext& ctx, Register composite, u32 index);
179void EmitCompositeConstructF32x2(EmitContext& ctx, std::string_view e1, std::string_view e2); 167void EmitCompositeExtractF32x4(EmitContext& ctx, Register composite, u32 index);
180void EmitCompositeConstructF32x3(EmitContext& ctx, std::string_view e1, std::string_view e2, 168void EmitCompositeInsertF32x2(EmitContext& ctx, Register composite, ScalarF32 object, u32 index);
181 std::string_view e3); 169void EmitCompositeInsertF32x3(EmitContext& ctx, Register composite, ScalarF32 object, u32 index);
182void EmitCompositeConstructF32x4(EmitContext& ctx, std::string_view e1, std::string_view e2, 170void EmitCompositeInsertF32x4(EmitContext& ctx, Register composite, ScalarF32 object, u32 index);
183 std::string_view e3, std::string_view e4);
184void EmitCompositeExtractF32x2(EmitContext& ctx, std::string_view composite, u32 index);
185void EmitCompositeExtractF32x3(EmitContext& ctx, std::string_view composite, u32 index);
186void EmitCompositeExtractF32x4(EmitContext& ctx, std::string_view composite, u32 index);
187void EmitCompositeInsertF32x2(EmitContext& ctx, std::string_view composite, std::string_view object,
188 u32 index);
189void EmitCompositeInsertF32x3(EmitContext& ctx, std::string_view composite, std::string_view object,
190 u32 index);
191void EmitCompositeInsertF32x4(EmitContext& ctx, std::string_view composite, std::string_view object,
192 u32 index);
193void EmitCompositeConstructF64x2(EmitContext& ctx); 171void EmitCompositeConstructF64x2(EmitContext& ctx);
194void EmitCompositeConstructF64x3(EmitContext& ctx); 172void EmitCompositeConstructF64x3(EmitContext& ctx);
195void EmitCompositeConstructF64x4(EmitContext& ctx); 173void EmitCompositeConstructF64x4(EmitContext& ctx);
196void EmitCompositeExtractF64x2(EmitContext& ctx); 174void EmitCompositeExtractF64x2(EmitContext& ctx);
197void EmitCompositeExtractF64x3(EmitContext& ctx); 175void EmitCompositeExtractF64x3(EmitContext& ctx);
198void EmitCompositeExtractF64x4(EmitContext& ctx); 176void EmitCompositeExtractF64x4(EmitContext& ctx);
199void EmitCompositeInsertF64x2(EmitContext& ctx, std::string_view composite, std::string_view object, 177void EmitCompositeInsertF64x2(EmitContext& ctx, Register composite, Register object, u32 index);
200 u32 index); 178void EmitCompositeInsertF64x3(EmitContext& ctx, Register composite, Register object, u32 index);
201void EmitCompositeInsertF64x3(EmitContext& ctx, std::string_view composite, std::string_view object, 179void EmitCompositeInsertF64x4(EmitContext& ctx, Register composite, Register object, u32 index);
202 u32 index); 180void EmitSelectU1(EmitContext& ctx, ScalarS32 cond, ScalarS32 true_value, ScalarS32 false_value);
203void EmitCompositeInsertF64x4(EmitContext& ctx, std::string_view composite, std::string_view object, 181void EmitSelectU8(EmitContext& ctx, ScalarS32 cond, ScalarS32 true_value, ScalarS32 false_value);
204 u32 index); 182void EmitSelectU16(EmitContext& ctx, ScalarS32 cond, ScalarS32 true_value, ScalarS32 false_value);
205void EmitSelectU1(EmitContext& ctx, std::string_view cond, std::string_view true_value, 183void EmitSelectU32(EmitContext& ctx, ScalarS32 cond, ScalarS32 true_value, ScalarS32 false_value);
206 std::string_view false_value); 184void EmitSelectU64(EmitContext& ctx, ScalarS32 cond, Register true_value, Register false_value);
207void EmitSelectU8(EmitContext& ctx, std::string_view cond, std::string_view true_value, 185void EmitSelectF16(EmitContext& ctx, ScalarS32 cond, Register true_value, Register false_value);
208 std::string_view false_value); 186void EmitSelectF32(EmitContext& ctx, ScalarS32 cond, ScalarS32 true_value, ScalarS32 false_value);
209void EmitSelectU16(EmitContext& ctx, std::string_view cond, std::string_view true_value, 187void EmitSelectF64(EmitContext& ctx, ScalarS32 cond, Register true_value, Register false_value);
210 std::string_view false_value);
211void EmitSelectU32(EmitContext& ctx, IR::Inst& inst, std::string_view cond,
212 std::string_view true_value, std::string_view false_value);
213void EmitSelectU64(EmitContext& ctx, std::string_view cond, std::string_view true_value,
214 std::string_view false_value);
215void EmitSelectF16(EmitContext& ctx, std::string_view cond, std::string_view true_value,
216 std::string_view false_value);
217void EmitSelectF32(EmitContext& ctx, IR::Inst& inst, std::string_view cond,
218 std::string_view true_value, std::string_view false_value);
219void EmitSelectF64(EmitContext& ctx, std::string_view cond, std::string_view true_value,
220 std::string_view false_value);
221void EmitBitCastU16F16(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); 188void EmitBitCastU16F16(EmitContext& ctx, IR::Inst& inst, const IR::Value& value);
222void EmitBitCastU32F32(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); 189void EmitBitCastU32F32(EmitContext& ctx, IR::Inst& inst, const IR::Value& value);
223void EmitBitCastU64F64(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); 190void EmitBitCastU64F64(EmitContext& ctx, IR::Inst& inst, const IR::Value& value);
224void EmitBitCastF16U16(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); 191void EmitBitCastF16U16(EmitContext& ctx, IR::Inst& inst, const IR::Value& value);
225void EmitBitCastF32U32(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); 192void EmitBitCastF32U32(EmitContext& ctx, IR::Inst& inst, const IR::Value& value);
226void EmitBitCastF64U64(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); 193void EmitBitCastF64U64(EmitContext& ctx, IR::Inst& inst, const IR::Value& value);
227void EmitPackUint2x32(EmitContext& ctx, std::string_view value); 194void EmitPackUint2x32(EmitContext& ctx, Register value);
228void EmitUnpackUint2x32(EmitContext& ctx, std::string_view value); 195void EmitUnpackUint2x32(EmitContext& ctx, Register value);
229void EmitPackFloat2x16(EmitContext& ctx, std::string_view value); 196void EmitPackFloat2x16(EmitContext& ctx, Register value);
230void EmitUnpackFloat2x16(EmitContext& ctx, std::string_view value); 197void EmitUnpackFloat2x16(EmitContext& ctx, Register value);
231void EmitPackHalf2x16(EmitContext& ctx, std::string_view value); 198void EmitPackHalf2x16(EmitContext& ctx, Register value);
232void EmitUnpackHalf2x16(EmitContext& ctx, std::string_view value); 199void EmitUnpackHalf2x16(EmitContext& ctx, Register value);
233void EmitPackDouble2x32(EmitContext& ctx, std::string_view value); 200void EmitPackDouble2x32(EmitContext& ctx, Register value);
234void EmitUnpackDouble2x32(EmitContext& ctx, std::string_view value); 201void EmitUnpackDouble2x32(EmitContext& ctx, Register value);
235void EmitGetZeroFromOp(EmitContext& ctx); 202void EmitGetZeroFromOp(EmitContext& ctx);
236void EmitGetSignFromOp(EmitContext& ctx); 203void EmitGetSignFromOp(EmitContext& ctx);
237void EmitGetCarryFromOp(EmitContext& ctx); 204void EmitGetCarryFromOp(EmitContext& ctx);
238void EmitGetOverflowFromOp(EmitContext& ctx); 205void EmitGetOverflowFromOp(EmitContext& ctx);
239void EmitGetSparseFromOp(EmitContext& ctx); 206void EmitGetSparseFromOp(EmitContext& ctx);
240void EmitGetInBoundsFromOp(EmitContext& ctx); 207void EmitGetInBoundsFromOp(EmitContext& ctx);
241void EmitFPAbs16(EmitContext& ctx, std::string_view value); 208void EmitFPAbs16(EmitContext& ctx, Register value);
242void EmitFPAbs32(EmitContext& ctx, IR::Inst& inst, std::string_view value); 209void EmitFPAbs32(EmitContext& ctx, IR::Inst& inst, ScalarF32 value);
243void EmitFPAbs64(EmitContext& ctx, std::string_view value); 210void EmitFPAbs64(EmitContext& ctx, Register value);
244void EmitFPAdd16(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); 211void EmitFPAdd16(EmitContext& ctx, IR::Inst& inst, Register a, Register b);
245void EmitFPAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); 212void EmitFPAdd32(EmitContext& ctx, IR::Inst& inst, ScalarF32 a, ScalarF32 b);
246void EmitFPAdd64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); 213void EmitFPAdd64(EmitContext& ctx, IR::Inst& inst, Register a, Register b);
247void EmitFPFma16(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b, 214void EmitFPFma16(EmitContext& ctx, IR::Inst& inst, Register a, Register b, Register c);
248 std::string_view c); 215void EmitFPFma32(EmitContext& ctx, IR::Inst& inst, ScalarF32 a, ScalarF32 b, ScalarF32 c);
249void EmitFPFma32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b, 216void EmitFPFma64(EmitContext& ctx, IR::Inst& inst, Register a, Register b, Register c);
250 std::string_view c); 217void EmitFPMax32(EmitContext& ctx, ScalarF32 a, ScalarF32 b);
251void EmitFPFma64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b, 218void EmitFPMax64(EmitContext& ctx, Register a, Register b);
252 std::string_view c); 219void EmitFPMin32(EmitContext& ctx, ScalarF32 a, ScalarF32 b);
253void EmitFPMax32(EmitContext& ctx, std::string_view a, std::string_view b); 220void EmitFPMin64(EmitContext& ctx, Register a, Register b);
254void EmitFPMax64(EmitContext& ctx, std::string_view a, std::string_view b); 221void EmitFPMul16(EmitContext& ctx, IR::Inst& inst, Register a, Register b);
255void EmitFPMin32(EmitContext& ctx, std::string_view a, std::string_view b); 222void EmitFPMul32(EmitContext& ctx, IR::Inst& inst, ScalarF32 a, ScalarF32 b);
256void EmitFPMin64(EmitContext& ctx, std::string_view a, std::string_view b); 223void EmitFPMul64(EmitContext& ctx, IR::Inst& inst, Register a, Register b);
257void EmitFPMul16(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); 224void EmitFPNeg16(EmitContext& ctx, Register value);
258void EmitFPMul32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); 225void EmitFPNeg32(EmitContext& ctx, IR::Inst& inst, ScalarRegister value);
259void EmitFPMul64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); 226void EmitFPNeg64(EmitContext& ctx, Register value);
260void EmitFPNeg16(EmitContext& ctx, std::string_view value); 227void EmitFPSin(EmitContext& ctx, ScalarF32 value);
261void EmitFPNeg32(EmitContext& ctx, IR::Inst& inst, std::string_view value); 228void EmitFPCos(EmitContext& ctx, ScalarF32 value);
262void EmitFPNeg64(EmitContext& ctx, std::string_view value); 229void EmitFPExp2(EmitContext& ctx, ScalarF32 value);
263void EmitFPSin(EmitContext& ctx, std::string_view value); 230void EmitFPLog2(EmitContext& ctx, ScalarF32 value);
264void EmitFPCos(EmitContext& ctx, std::string_view value); 231void EmitFPRecip32(EmitContext& ctx, ScalarF32 value);
265void EmitFPExp2(EmitContext& ctx, std::string_view value); 232void EmitFPRecip64(EmitContext& ctx, Register value);
266void EmitFPLog2(EmitContext& ctx, std::string_view value); 233void EmitFPRecipSqrt32(EmitContext& ctx, ScalarF32 value);
267void EmitFPRecip32(EmitContext& ctx, std::string_view value); 234void EmitFPRecipSqrt64(EmitContext& ctx, Register value);
268void EmitFPRecip64(EmitContext& ctx, std::string_view value); 235void EmitFPSqrt(EmitContext& ctx, ScalarF32 value);
269void EmitFPRecipSqrt32(EmitContext& ctx, std::string_view value); 236void EmitFPSaturate16(EmitContext& ctx, Register value);
270void EmitFPRecipSqrt64(EmitContext& ctx, std::string_view value); 237void EmitFPSaturate32(EmitContext& ctx, IR::Inst& inst, ScalarF32 value);
271void EmitFPSqrt(EmitContext& ctx, std::string_view value); 238void EmitFPSaturate64(EmitContext& ctx, Register value);
272void EmitFPSaturate16(EmitContext& ctx, std::string_view value); 239void EmitFPClamp16(EmitContext& ctx, Register value, Register min_value, Register max_value);
273void EmitFPSaturate32(EmitContext& ctx, IR::Inst& inst, std::string_view value); 240void EmitFPClamp32(EmitContext& ctx, ScalarF32 value, ScalarF32 min_value, ScalarF32 max_value);
274void EmitFPSaturate64(EmitContext& ctx, std::string_view value); 241void EmitFPClamp64(EmitContext& ctx, Register value, Register min_value, Register max_value);
275void EmitFPClamp16(EmitContext& ctx, std::string_view value, std::string_view min_value, 242void EmitFPRoundEven16(EmitContext& ctx, Register value);
276 std::string_view max_value); 243void EmitFPRoundEven32(EmitContext& ctx, ScalarF32 value);
277void EmitFPClamp32(EmitContext& ctx, std::string_view value, std::string_view min_value, 244void EmitFPRoundEven64(EmitContext& ctx, Register value);
278 std::string_view max_value); 245void EmitFPFloor16(EmitContext& ctx, Register value);
279void EmitFPClamp64(EmitContext& ctx, std::string_view value, std::string_view min_value, 246void EmitFPFloor32(EmitContext& ctx, ScalarF32 value);
280 std::string_view max_value); 247void EmitFPFloor64(EmitContext& ctx, Register value);
281void EmitFPRoundEven16(EmitContext& ctx, std::string_view value); 248void EmitFPCeil16(EmitContext& ctx, Register value);
282void EmitFPRoundEven32(EmitContext& ctx, std::string_view value); 249void EmitFPCeil32(EmitContext& ctx, ScalarF32 value);
283void EmitFPRoundEven64(EmitContext& ctx, std::string_view value); 250void EmitFPCeil64(EmitContext& ctx, Register value);
284void EmitFPFloor16(EmitContext& ctx, std::string_view value); 251void EmitFPTrunc16(EmitContext& ctx, Register value);
285void EmitFPFloor32(EmitContext& ctx, std::string_view value); 252void EmitFPTrunc32(EmitContext& ctx, ScalarF32 value);
286void EmitFPFloor64(EmitContext& ctx, std::string_view value); 253void EmitFPTrunc64(EmitContext& ctx, Register value);
287void EmitFPCeil16(EmitContext& ctx, std::string_view value); 254void EmitFPOrdEqual16(EmitContext& ctx, Register lhs, Register rhs);
288void EmitFPCeil32(EmitContext& ctx, std::string_view value); 255void EmitFPOrdEqual32(EmitContext& ctx, IR::Inst& inst, ScalarF32 lhs, ScalarF32 rhs);
289void EmitFPCeil64(EmitContext& ctx, std::string_view value); 256void EmitFPOrdEqual64(EmitContext& ctx, Register lhs, Register rhs);
290void EmitFPTrunc16(EmitContext& ctx, std::string_view value); 257void EmitFPUnordEqual16(EmitContext& ctx, Register lhs, Register rhs);
291void EmitFPTrunc32(EmitContext& ctx, std::string_view value); 258void EmitFPUnordEqual32(EmitContext& ctx, ScalarF32 lhs, ScalarF32 rhs);
292void EmitFPTrunc64(EmitContext& ctx, std::string_view value); 259void EmitFPUnordEqual64(EmitContext& ctx, Register lhs, Register rhs);
293void EmitFPOrdEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 260void EmitFPOrdNotEqual16(EmitContext& ctx, Register lhs, Register rhs);
294void EmitFPOrdEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); 261void EmitFPOrdNotEqual32(EmitContext& ctx, ScalarF32 lhs, ScalarF32 rhs);
295void EmitFPOrdEqual64(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 262void EmitFPOrdNotEqual64(EmitContext& ctx, Register lhs, Register rhs);
296void EmitFPUnordEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 263void EmitFPUnordNotEqual16(EmitContext& ctx, Register lhs, Register rhs);
297void EmitFPUnordEqual32(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 264void EmitFPUnordNotEqual32(EmitContext& ctx, ScalarF32 lhs, ScalarF32 rhs);
298void EmitFPUnordEqual64(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 265void EmitFPUnordNotEqual64(EmitContext& ctx, Register lhs, Register rhs);
299void EmitFPOrdNotEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 266void EmitFPOrdLessThan16(EmitContext& ctx, Register lhs, Register rhs);
300void EmitFPOrdNotEqual32(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 267void EmitFPOrdLessThan32(EmitContext& ctx, IR::Inst& inst, ScalarF32 lhs, ScalarF32 rhs);
301void EmitFPOrdNotEqual64(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 268void EmitFPOrdLessThan64(EmitContext& ctx, Register lhs, Register rhs);
302void EmitFPUnordNotEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 269void EmitFPUnordLessThan16(EmitContext& ctx, Register lhs, Register rhs);
303void EmitFPUnordNotEqual32(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 270void EmitFPUnordLessThan32(EmitContext& ctx, ScalarF32 lhs, ScalarF32 rhs);
304void EmitFPUnordNotEqual64(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 271void EmitFPUnordLessThan64(EmitContext& ctx, Register lhs, Register rhs);
305void EmitFPOrdLessThan16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 272void EmitFPOrdGreaterThan16(EmitContext& ctx, Register lhs, Register rhs);
306void EmitFPOrdLessThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 273void EmitFPOrdGreaterThan32(EmitContext& ctx, ScalarF32 lhs, ScalarF32 rhs);
307 std::string_view rhs); 274void EmitFPOrdGreaterThan64(EmitContext& ctx, Register lhs, Register rhs);
308void EmitFPOrdLessThan64(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 275void EmitFPUnordGreaterThan16(EmitContext& ctx, Register lhs, Register rhs);
309void EmitFPUnordLessThan16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 276void EmitFPUnordGreaterThan32(EmitContext& ctx, ScalarF32 lhs, ScalarF32 rhs);
310void EmitFPUnordLessThan32(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 277void EmitFPUnordGreaterThan64(EmitContext& ctx, Register lhs, Register rhs);
311void EmitFPUnordLessThan64(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 278void EmitFPOrdLessThanEqual16(EmitContext& ctx, Register lhs, Register rhs);
312void EmitFPOrdGreaterThan16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 279void EmitFPOrdLessThanEqual32(EmitContext& ctx, IR::Inst& inst, ScalarF32 lhs, ScalarF32 rhs);
313void EmitFPOrdGreaterThan32(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 280void EmitFPOrdLessThanEqual64(EmitContext& ctx, Register lhs, Register rhs);
314void EmitFPOrdGreaterThan64(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 281void EmitFPUnordLessThanEqual16(EmitContext& ctx, Register lhs, Register rhs);
315void EmitFPUnordGreaterThan16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 282void EmitFPUnordLessThanEqual32(EmitContext& ctx, ScalarF32 lhs, ScalarF32 rhs);
316void EmitFPUnordGreaterThan32(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 283void EmitFPUnordLessThanEqual64(EmitContext& ctx, Register lhs, Register rhs);
317void EmitFPUnordGreaterThan64(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 284void EmitFPOrdGreaterThanEqual16(EmitContext& ctx, Register lhs, Register rhs);
318void EmitFPOrdLessThanEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 285void EmitFPOrdGreaterThanEqual32(EmitContext& ctx, ScalarF32 lhs, ScalarF32 rhs);
319void EmitFPOrdLessThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 286void EmitFPOrdGreaterThanEqual64(EmitContext& ctx, Register lhs, Register rhs);
320 std::string_view rhs); 287void EmitFPUnordGreaterThanEqual16(EmitContext& ctx, Register lhs, Register rhs);
321void EmitFPOrdLessThanEqual64(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 288void EmitFPUnordGreaterThanEqual32(EmitContext& ctx, ScalarF32 lhs, ScalarF32 rhs);
322void EmitFPUnordLessThanEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 289void EmitFPUnordGreaterThanEqual64(EmitContext& ctx, Register lhs, Register rhs);
323void EmitFPUnordLessThanEqual32(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 290void EmitFPIsNan16(EmitContext& ctx, Register value);
324void EmitFPUnordLessThanEqual64(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 291void EmitFPIsNan32(EmitContext& ctx, ScalarF32 value);
325void EmitFPOrdGreaterThanEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 292void EmitFPIsNan64(EmitContext& ctx, Register value);
326void EmitFPOrdGreaterThanEqual32(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 293void EmitIAdd32(EmitContext& ctx, IR::Inst& inst, ScalarS32 a, ScalarS32 b);
327void EmitFPOrdGreaterThanEqual64(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 294void EmitIAdd64(EmitContext& ctx, Register a, Register b);
328void EmitFPUnordGreaterThanEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 295void EmitISub32(EmitContext& ctx, IR::Inst& inst, ScalarS32 a, ScalarS32 b);
329void EmitFPUnordGreaterThanEqual32(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 296void EmitISub64(EmitContext& ctx, Register a, Register b);
330void EmitFPUnordGreaterThanEqual64(EmitContext& ctx, std::string_view lhs, std::string_view rhs); 297void EmitIMul32(EmitContext& ctx, IR::Inst& inst, ScalarS32 a, ScalarS32 b);
331void EmitFPIsNan16(EmitContext& ctx, std::string_view value); 298void EmitINeg32(EmitContext& ctx, ScalarS32 value);
332void EmitFPIsNan32(EmitContext& ctx, std::string_view value); 299void EmitINeg64(EmitContext& ctx, Register value);
333void EmitFPIsNan64(EmitContext& ctx, std::string_view value); 300void EmitIAbs32(EmitContext& ctx, ScalarS32 value);
334void EmitIAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); 301void EmitIAbs64(EmitContext& ctx, Register value);
335void EmitIAdd64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); 302void EmitShiftLeftLogical32(EmitContext& ctx, IR::Inst& inst, ScalarU32 base, ScalarU32 shift);
336void EmitISub32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); 303void EmitShiftLeftLogical64(EmitContext& ctx, Register base, Register shift);
337void EmitISub64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); 304void EmitShiftRightLogical32(EmitContext& ctx, ScalarU32 base, ScalarU32 shift);
338void EmitIMul32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); 305void EmitShiftRightLogical64(EmitContext& ctx, Register base, Register shift);
339void EmitINeg32(EmitContext& ctx, IR::Inst& inst, std::string_view value); 306void EmitShiftRightArithmetic32(EmitContext& ctx, ScalarS32 base, ScalarS32 shift);
340void EmitINeg64(EmitContext& ctx, IR::Inst& inst, std::string_view value); 307void EmitShiftRightArithmetic64(EmitContext& ctx, Register base, Register shift);
341void EmitIAbs32(EmitContext& ctx, IR::Inst& inst, std::string_view value); 308void EmitBitwiseAnd32(EmitContext& ctx, IR::Inst& inst, ScalarS32 a, ScalarS32 b);
342void EmitIAbs64(EmitContext& ctx, IR::Inst& inst, std::string_view value); 309void EmitBitwiseOr32(EmitContext& ctx, IR::Inst& inst, ScalarS32 a, ScalarS32 b);
343void EmitShiftLeftLogical32(EmitContext& ctx, std::string_view base, std::string_view shift); 310void EmitBitwiseXor32(EmitContext& ctx, IR::Inst& inst, ScalarS32 a, ScalarS32 b);
344void EmitShiftLeftLogical64(EmitContext& ctx, std::string_view base, std::string_view shift); 311void EmitBitFieldInsert(EmitContext& ctx, ScalarS32 base, ScalarS32 insert, ScalarS32 offset,
345void EmitShiftRightLogical32(EmitContext& ctx, std::string_view base, std::string_view shift); 312 ScalarS32 count);
346void EmitShiftRightLogical64(EmitContext& ctx, std::string_view base, std::string_view shift); 313void EmitBitFieldSExtract(EmitContext& ctx, IR::Inst& inst, ScalarS32 base, ScalarS32 offset,
347void EmitShiftRightArithmetic32(EmitContext& ctx, std::string_view base, std::string_view shift); 314 ScalarS32 count);
348void EmitShiftRightArithmetic64(EmitContext& ctx, std::string_view base, std::string_view shift); 315void EmitBitFieldUExtract(EmitContext& ctx, IR::Inst& inst, ScalarU32 base, ScalarU32 offset,
349void EmitBitwiseAnd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); 316 ScalarU32 count);
350void EmitBitwiseOr32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); 317void EmitBitReverse32(EmitContext& ctx, ScalarS32 value);
351void EmitBitwiseXor32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); 318void EmitBitCount32(EmitContext& ctx, ScalarS32 value);
352void EmitBitFieldInsert(EmitContext& ctx, IR::Inst& inst, std::string_view base, 319void EmitBitwiseNot32(EmitContext& ctx, ScalarS32 value);
353 std::string_view insert, std::string_view offset, std::string_view count); 320void EmitFindSMsb32(EmitContext& ctx, ScalarS32 value);
354void EmitBitFieldSExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base, 321void EmitFindUMsb32(EmitContext& ctx, ScalarU32 value);
355 std::string_view offset, std::string_view count); 322void EmitSMin32(EmitContext& ctx, ScalarS32 a, ScalarS32 b);
356void EmitBitFieldUExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base, 323void EmitUMin32(EmitContext& ctx, ScalarU32 a, ScalarU32 b);
357 std::string_view offset, std::string_view count); 324void EmitSMax32(EmitContext& ctx, ScalarS32 a, ScalarS32 b);
358void EmitBitReverse32(EmitContext& ctx, IR::Inst& inst, std::string_view value); 325void EmitUMax32(EmitContext& ctx, ScalarU32 a, ScalarU32 b);
359void EmitBitCount32(EmitContext& ctx, IR::Inst& inst, std::string_view value); 326void EmitSClamp32(EmitContext& ctx, IR::Inst& inst, ScalarS32 value, ScalarS32 min, ScalarS32 max);
360void EmitBitwiseNot32(EmitContext& ctx, IR::Inst& inst, std::string_view value); 327void EmitUClamp32(EmitContext& ctx, IR::Inst& inst, ScalarU32 value, ScalarU32 min, ScalarU32 max);
361void EmitFindSMsb32(EmitContext& ctx, IR::Inst& inst, std::string_view value); 328void EmitSLessThan(EmitContext& ctx, ScalarS32 lhs, ScalarS32 rhs);
362void EmitFindUMsb32(EmitContext& ctx, IR::Inst& inst, std::string_view value); 329void EmitULessThan(EmitContext& ctx, ScalarU32 lhs, ScalarU32 rhs);
363void EmitSMin32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); 330void EmitIEqual(EmitContext& ctx, ScalarS32 lhs, ScalarS32 rhs);
364void EmitUMin32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); 331void EmitSLessThanEqual(EmitContext& ctx, ScalarS32 lhs, ScalarS32 rhs);
365void EmitSMax32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); 332void EmitULessThanEqual(EmitContext& ctx, ScalarU32 lhs, ScalarU32 rhs);
366void EmitUMax32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); 333void EmitSGreaterThan(EmitContext& ctx, ScalarS32 lhs, ScalarS32 rhs);
367void EmitSClamp32(EmitContext& ctx, IR::Inst& inst, std::string_view value, std::string_view min, 334void EmitUGreaterThan(EmitContext& ctx, ScalarU32 lhs, ScalarU32 rhs);
368 std::string_view max); 335void EmitINotEqual(EmitContext& ctx, ScalarS32 lhs, ScalarS32 rhs);
369void EmitUClamp32(EmitContext& ctx, IR::Inst& inst, std::string_view value, std::string_view min, 336void EmitSGreaterThanEqual(EmitContext& ctx, ScalarS32 lhs, ScalarS32 rhs);
370 std::string_view max); 337void EmitUGreaterThanEqual(EmitContext& ctx, ScalarU32 lhs, ScalarU32 rhs);
371void EmitSLessThan(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); 338void EmitSharedAtomicIAdd32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarU32 value);
372void EmitULessThan(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); 339void EmitSharedAtomicSMin32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarS32 value);
373void EmitIEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); 340void EmitSharedAtomicUMin32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarU32 value);
374void EmitSLessThanEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 341void EmitSharedAtomicSMax32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarS32 value);
375 std::string_view rhs); 342void EmitSharedAtomicUMax32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarU32 value);
376void EmitULessThanEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 343void EmitSharedAtomicInc32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarU32 value);
377 std::string_view rhs); 344void EmitSharedAtomicDec32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarU32 value);
378void EmitSGreaterThan(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); 345void EmitSharedAtomicAnd32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarU32 value);
379void EmitUGreaterThan(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); 346void EmitSharedAtomicOr32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarU32 value);
380void EmitINotEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); 347void EmitSharedAtomicXor32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarU32 value);
381void EmitSGreaterThanEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 348void EmitSharedAtomicExchange32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarU32 value);
382 std::string_view rhs); 349void EmitSharedAtomicExchange64(EmitContext& ctx, ScalarU32 pointer_offset, Register value);
383void EmitUGreaterThanEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
384 std::string_view rhs);
385void EmitSharedAtomicIAdd32(EmitContext& ctx, std::string_view pointer_offset,
386 std::string_view value);
387void EmitSharedAtomicSMin32(EmitContext& ctx, std::string_view pointer_offset,
388 std::string_view value);
389void EmitSharedAtomicUMin32(EmitContext& ctx, std::string_view pointer_offset,
390 std::string_view value);
391void EmitSharedAtomicSMax32(EmitContext& ctx, std::string_view pointer_offset,
392 std::string_view value);
393void EmitSharedAtomicUMax32(EmitContext& ctx, std::string_view pointer_offset,
394 std::string_view value);
395void EmitSharedAtomicInc32(EmitContext& ctx, std::string_view pointer_offset,
396 std::string_view value);
397void EmitSharedAtomicDec32(EmitContext& ctx, std::string_view pointer_offset,
398 std::string_view value);
399void EmitSharedAtomicAnd32(EmitContext& ctx, std::string_view pointer_offset,
400 std::string_view value);
401void EmitSharedAtomicOr32(EmitContext& ctx, std::string_view pointer_offset,
402 std::string_view value);
403void EmitSharedAtomicXor32(EmitContext& ctx, std::string_view pointer_offset,
404 std::string_view value);
405void EmitSharedAtomicExchange32(EmitContext& ctx, std::string_view pointer_offset,
406 std::string_view value);
407void EmitSharedAtomicExchange64(EmitContext& ctx, std::string_view pointer_offset,
408 std::string_view value);
409void EmitStorageAtomicIAdd32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 350void EmitStorageAtomicIAdd32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
410 std::string_view value); 351 ScalarU32 value);
411void EmitStorageAtomicSMin32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 352void EmitStorageAtomicSMin32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
412 std::string_view value); 353 ScalarS32 value);
413void EmitStorageAtomicUMin32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 354void EmitStorageAtomicUMin32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
414 std::string_view value); 355 ScalarU32 value);
415void EmitStorageAtomicSMax32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 356void EmitStorageAtomicSMax32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
416 std::string_view value); 357 ScalarS32 value);
417void EmitStorageAtomicUMax32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 358void EmitStorageAtomicUMax32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
418 std::string_view value); 359 ScalarU32 value);
419void EmitStorageAtomicInc32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 360void EmitStorageAtomicInc32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
420 std::string_view value); 361 ScalarU32 value);
421void EmitStorageAtomicDec32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 362void EmitStorageAtomicDec32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
422 std::string_view value); 363 ScalarU32 value);
423void EmitStorageAtomicAnd32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 364void EmitStorageAtomicAnd32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
424 std::string_view value); 365 ScalarU32 value);
425void EmitStorageAtomicOr32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 366void EmitStorageAtomicOr32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
426 std::string_view value); 367 ScalarU32 value);
427void EmitStorageAtomicXor32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 368void EmitStorageAtomicXor32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
428 std::string_view value); 369 ScalarU32 value);
429void EmitStorageAtomicExchange32(EmitContext& ctx, const IR::Value& binding, 370void EmitStorageAtomicExchange32(EmitContext& ctx, const IR::Value& binding,
430 const IR::Value& offset, std::string_view value); 371 const IR::Value& offset, ScalarU32 value);
431void EmitStorageAtomicIAdd64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 372void EmitStorageAtomicIAdd64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
432 std::string_view value); 373 Register value);
433void EmitStorageAtomicSMin64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 374void EmitStorageAtomicSMin64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
434 std::string_view value); 375 Register value);
435void EmitStorageAtomicUMin64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 376void EmitStorageAtomicUMin64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
436 std::string_view value); 377 Register value);
437void EmitStorageAtomicSMax64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 378void EmitStorageAtomicSMax64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
438 std::string_view value); 379 Register value);
439void EmitStorageAtomicUMax64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 380void EmitStorageAtomicUMax64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
440 std::string_view value); 381 Register value);
441void EmitStorageAtomicAnd64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 382void EmitStorageAtomicAnd64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
442 std::string_view value); 383 Register value);
443void EmitStorageAtomicOr64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 384void EmitStorageAtomicOr64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
444 std::string_view value); 385 Register value);
445void EmitStorageAtomicXor64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 386void EmitStorageAtomicXor64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
446 std::string_view value); 387 Register value);
447void EmitStorageAtomicExchange64(EmitContext& ctx, const IR::Value& binding, 388void EmitStorageAtomicExchange64(EmitContext& ctx, const IR::Value& binding,
448 const IR::Value& offset, std::string_view value); 389 const IR::Value& offset, Register value);
449void EmitStorageAtomicAddF32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 390void EmitStorageAtomicAddF32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
450 std::string_view value); 391 ScalarF32 value);
451void EmitStorageAtomicAddF16x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 392void EmitStorageAtomicAddF16x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
452 std::string_view value); 393 Register value);
453void EmitStorageAtomicAddF32x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 394void EmitStorageAtomicAddF32x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
454 std::string_view value); 395 Register value);
455void EmitStorageAtomicMinF16x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 396void EmitStorageAtomicMinF16x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
456 std::string_view value); 397 Register value);
457void EmitStorageAtomicMinF32x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 398void EmitStorageAtomicMinF32x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
458 std::string_view value); 399 Register value);
459void EmitStorageAtomicMaxF16x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 400void EmitStorageAtomicMaxF16x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
460 std::string_view value); 401 Register value);
461void EmitStorageAtomicMaxF32x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 402void EmitStorageAtomicMaxF32x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
462 std::string_view value); 403 Register value);
463void EmitGlobalAtomicIAdd32(EmitContext& ctx); 404void EmitGlobalAtomicIAdd32(EmitContext& ctx);
464void EmitGlobalAtomicSMin32(EmitContext& ctx); 405void EmitGlobalAtomicSMin32(EmitContext& ctx);
465void EmitGlobalAtomicUMin32(EmitContext& ctx); 406void EmitGlobalAtomicUMin32(EmitContext& ctx);
@@ -489,58 +430,58 @@ void EmitGlobalAtomicMinF16x2(EmitContext& ctx);
489void EmitGlobalAtomicMinF32x2(EmitContext& ctx); 430void EmitGlobalAtomicMinF32x2(EmitContext& ctx);
490void EmitGlobalAtomicMaxF16x2(EmitContext& ctx); 431void EmitGlobalAtomicMaxF16x2(EmitContext& ctx);
491void EmitGlobalAtomicMaxF32x2(EmitContext& ctx); 432void EmitGlobalAtomicMaxF32x2(EmitContext& ctx);
492void EmitLogicalOr(EmitContext& ctx, std::string_view a, std::string_view b); 433void EmitLogicalOr(EmitContext& ctx, ScalarS32 a, ScalarS32 b);
493void EmitLogicalAnd(EmitContext& ctx, std::string_view a, std::string_view b); 434void EmitLogicalAnd(EmitContext& ctx, ScalarS32 a, ScalarS32 b);
494void EmitLogicalXor(EmitContext& ctx, std::string_view a, std::string_view b); 435void EmitLogicalXor(EmitContext& ctx, ScalarS32 a, ScalarS32 b);
495void EmitLogicalNot(EmitContext& ctx, std::string_view value); 436void EmitLogicalNot(EmitContext& ctx, ScalarS32 value);
496void EmitConvertS16F16(EmitContext& ctx, std::string_view value); 437void EmitConvertS16F16(EmitContext& ctx, Register value);
497void EmitConvertS16F32(EmitContext& ctx, std::string_view value); 438void EmitConvertS16F32(EmitContext& ctx, Register value);
498void EmitConvertS16F64(EmitContext& ctx, std::string_view value); 439void EmitConvertS16F64(EmitContext& ctx, Register value);
499void EmitConvertS32F16(EmitContext& ctx, std::string_view value); 440void EmitConvertS32F16(EmitContext& ctx, Register value);
500void EmitConvertS32F32(EmitContext& ctx, std::string_view value); 441void EmitConvertS32F32(EmitContext& ctx, Register value);
501void EmitConvertS32F64(EmitContext& ctx, std::string_view value); 442void EmitConvertS32F64(EmitContext& ctx, Register value);
502void EmitConvertS64F16(EmitContext& ctx, std::string_view value); 443void EmitConvertS64F16(EmitContext& ctx, Register value);
503void EmitConvertS64F32(EmitContext& ctx, std::string_view value); 444void EmitConvertS64F32(EmitContext& ctx, Register value);
504void EmitConvertS64F64(EmitContext& ctx, std::string_view value); 445void EmitConvertS64F64(EmitContext& ctx, Register value);
505void EmitConvertU16F16(EmitContext& ctx, std::string_view value); 446void EmitConvertU16F16(EmitContext& ctx, Register value);
506void EmitConvertU16F32(EmitContext& ctx, std::string_view value); 447void EmitConvertU16F32(EmitContext& ctx, Register value);
507void EmitConvertU16F64(EmitContext& ctx, std::string_view value); 448void EmitConvertU16F64(EmitContext& ctx, Register value);
508void EmitConvertU32F16(EmitContext& ctx, std::string_view value); 449void EmitConvertU32F16(EmitContext& ctx, Register value);
509void EmitConvertU32F32(EmitContext& ctx, std::string_view value); 450void EmitConvertU32F32(EmitContext& ctx, Register value);
510void EmitConvertU32F64(EmitContext& ctx, std::string_view value); 451void EmitConvertU32F64(EmitContext& ctx, Register value);
511void EmitConvertU64F16(EmitContext& ctx, std::string_view value); 452void EmitConvertU64F16(EmitContext& ctx, Register value);
512void EmitConvertU64F32(EmitContext& ctx, std::string_view value); 453void EmitConvertU64F32(EmitContext& ctx, Register value);
513void EmitConvertU64F64(EmitContext& ctx, std::string_view value); 454void EmitConvertU64F64(EmitContext& ctx, Register value);
514void EmitConvertU64U32(EmitContext& ctx, std::string_view value); 455void EmitConvertU64U32(EmitContext& ctx, Register value);
515void EmitConvertU32U64(EmitContext& ctx, std::string_view value); 456void EmitConvertU32U64(EmitContext& ctx, Register value);
516void EmitConvertF16F32(EmitContext& ctx, std::string_view value); 457void EmitConvertF16F32(EmitContext& ctx, Register value);
517void EmitConvertF32F16(EmitContext& ctx, std::string_view value); 458void EmitConvertF32F16(EmitContext& ctx, Register value);
518void EmitConvertF32F64(EmitContext& ctx, std::string_view value); 459void EmitConvertF32F64(EmitContext& ctx, Register value);
519void EmitConvertF64F32(EmitContext& ctx, std::string_view value); 460void EmitConvertF64F32(EmitContext& ctx, Register value);
520void EmitConvertF16S8(EmitContext& ctx, std::string_view value); 461void EmitConvertF16S8(EmitContext& ctx, Register value);
521void EmitConvertF16S16(EmitContext& ctx, std::string_view value); 462void EmitConvertF16S16(EmitContext& ctx, Register value);
522void EmitConvertF16S32(EmitContext& ctx, std::string_view value); 463void EmitConvertF16S32(EmitContext& ctx, Register value);
523void EmitConvertF16S64(EmitContext& ctx, std::string_view value); 464void EmitConvertF16S64(EmitContext& ctx, Register value);
524void EmitConvertF16U8(EmitContext& ctx, std::string_view value); 465void EmitConvertF16U8(EmitContext& ctx, Register value);
525void EmitConvertF16U16(EmitContext& ctx, std::string_view value); 466void EmitConvertF16U16(EmitContext& ctx, Register value);
526void EmitConvertF16U32(EmitContext& ctx, std::string_view value); 467void EmitConvertF16U32(EmitContext& ctx, Register value);
527void EmitConvertF16U64(EmitContext& ctx, std::string_view value); 468void EmitConvertF16U64(EmitContext& ctx, Register value);
528void EmitConvertF32S8(EmitContext& ctx, std::string_view value); 469void EmitConvertF32S8(EmitContext& ctx, Register value);
529void EmitConvertF32S16(EmitContext& ctx, std::string_view value); 470void EmitConvertF32S16(EmitContext& ctx, Register value);
530void EmitConvertF32S32(EmitContext& ctx, std::string_view value); 471void EmitConvertF32S32(EmitContext& ctx, Register value);
531void EmitConvertF32S64(EmitContext& ctx, std::string_view value); 472void EmitConvertF32S64(EmitContext& ctx, Register value);
532void EmitConvertF32U8(EmitContext& ctx, std::string_view value); 473void EmitConvertF32U8(EmitContext& ctx, Register value);
533void EmitConvertF32U16(EmitContext& ctx, std::string_view value); 474void EmitConvertF32U16(EmitContext& ctx, Register value);
534void EmitConvertF32U32(EmitContext& ctx, std::string_view value); 475void EmitConvertF32U32(EmitContext& ctx, Register value);
535void EmitConvertF32U64(EmitContext& ctx, std::string_view value); 476void EmitConvertF32U64(EmitContext& ctx, Register value);
536void EmitConvertF64S8(EmitContext& ctx, std::string_view value); 477void EmitConvertF64S8(EmitContext& ctx, Register value);
537void EmitConvertF64S16(EmitContext& ctx, std::string_view value); 478void EmitConvertF64S16(EmitContext& ctx, Register value);
538void EmitConvertF64S32(EmitContext& ctx, std::string_view value); 479void EmitConvertF64S32(EmitContext& ctx, Register value);
539void EmitConvertF64S64(EmitContext& ctx, std::string_view value); 480void EmitConvertF64S64(EmitContext& ctx, Register value);
540void EmitConvertF64U8(EmitContext& ctx, std::string_view value); 481void EmitConvertF64U8(EmitContext& ctx, Register value);
541void EmitConvertF64U16(EmitContext& ctx, std::string_view value); 482void EmitConvertF64U16(EmitContext& ctx, Register value);
542void EmitConvertF64U32(EmitContext& ctx, std::string_view value); 483void EmitConvertF64U32(EmitContext& ctx, Register value);
543void EmitConvertF64U64(EmitContext& ctx, std::string_view value); 484void EmitConvertF64U64(EmitContext& ctx, Register value);
544void EmitBindlessImageSampleImplicitLod(EmitContext&); 485void EmitBindlessImageSampleImplicitLod(EmitContext&);
545void EmitBindlessImageSampleExplicitLod(EmitContext&); 486void EmitBindlessImageSampleExplicitLod(EmitContext&);
546void EmitBindlessImageSampleDrefImplicitLod(EmitContext&); 487void EmitBindlessImageSampleDrefImplicitLod(EmitContext&);
@@ -566,36 +507,29 @@ void EmitBoundImageGradient(EmitContext&);
566void EmitBoundImageRead(EmitContext&); 507void EmitBoundImageRead(EmitContext&);
567void EmitBoundImageWrite(EmitContext&); 508void EmitBoundImageWrite(EmitContext&);
568void EmitImageSampleImplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 509void EmitImageSampleImplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
569 std::string_view coords, std::string_view bias_lc, 510 Register coords, Register bias_lc, const IR::Value& offset);
570 const IR::Value& offset);
571void EmitImageSampleExplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 511void EmitImageSampleExplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
572 std::string_view coords, std::string_view lod_lc, 512 Register coords, Register lod_lc, const IR::Value& offset);
573 const IR::Value& offset);
574void EmitImageSampleDrefImplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 513void EmitImageSampleDrefImplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
575 std::string_view coords, std::string_view dref, 514 Register coords, Register dref, Register bias_lc,
576 std::string_view bias_lc, const IR::Value& offset); 515 const IR::Value& offset);
577void EmitImageSampleDrefExplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 516void EmitImageSampleDrefExplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
578 std::string_view coords, std::string_view dref, 517 Register coords, Register dref, Register lod_lc,
579 std::string_view lod_lc, const IR::Value& offset); 518 const IR::Value& offset);
580void EmitImageGather(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 519void EmitImageGather(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords,
581 std::string_view coords, const IR::Value& offset, const IR::Value& offset2); 520 const IR::Value& offset, const IR::Value& offset2);
582void EmitImageGatherDref(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 521void EmitImageGatherDref(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords,
583 std::string_view coords, const IR::Value& offset, const IR::Value& offset2, 522 const IR::Value& offset, const IR::Value& offset2, Register dref);
584 std::string_view dref); 523void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords,
585void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 524 Register offset, Register lod, Register ms);
586 std::string_view coords, std::string_view offset, std::string_view lod,
587 std::string_view ms);
588void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 525void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
589 std::string_view lod); 526 Register lod);
590void EmitImageQueryLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 527void EmitImageQueryLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords);
591 std::string_view coords); 528void EmitImageGradient(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords,
592void EmitImageGradient(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 529 Register derivates, Register offset, Register lod_clamp);
593 std::string_view coords, std::string_view derivates, std::string_view offset, 530void EmitImageRead(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords);
594 std::string_view lod_clamp); 531void EmitImageWrite(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords,
595void EmitImageRead(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 532 Register color);
596 std::string_view coords);
597void EmitImageWrite(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
598 std::string_view coords, std::string_view color);
599void EmitBindlessImageAtomicIAdd32(EmitContext&); 533void EmitBindlessImageAtomicIAdd32(EmitContext&);
600void EmitBindlessImageAtomicSMin32(EmitContext&); 534void EmitBindlessImageAtomicSMin32(EmitContext&);
601void EmitBindlessImageAtomicUMin32(EmitContext&); 535void EmitBindlessImageAtomicUMin32(EmitContext&);
@@ -619,53 +553,49 @@ void EmitBoundImageAtomicOr32(EmitContext&);
619void EmitBoundImageAtomicXor32(EmitContext&); 553void EmitBoundImageAtomicXor32(EmitContext&);
620void EmitBoundImageAtomicExchange32(EmitContext&); 554void EmitBoundImageAtomicExchange32(EmitContext&);
621void EmitImageAtomicIAdd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 555void EmitImageAtomicIAdd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
622 std::string_view coords, std::string_view value); 556 Register coords, ScalarU32 value);
623void EmitImageAtomicSMin32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 557void EmitImageAtomicSMin32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
624 std::string_view coords, std::string_view value); 558 Register coords, ScalarS32 value);
625void EmitImageAtomicUMin32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 559void EmitImageAtomicUMin32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
626 std::string_view coords, std::string_view value); 560 Register coords, ScalarU32 value);
627void EmitImageAtomicSMax32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 561void EmitImageAtomicSMax32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
628 std::string_view coords, std::string_view value); 562 Register coords, ScalarS32 value);
629void EmitImageAtomicUMax32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 563void EmitImageAtomicUMax32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
630 std::string_view coords, std::string_view value); 564 Register coords, ScalarU32 value);
631void EmitImageAtomicInc32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 565void EmitImageAtomicInc32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords,
632 std::string_view coords, std::string_view value); 566 ScalarU32 value);
633void EmitImageAtomicDec32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 567void EmitImageAtomicDec32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords,
634 std::string_view coords, std::string_view value); 568 ScalarU32 value);
635void EmitImageAtomicAnd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 569void EmitImageAtomicAnd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords,
636 std::string_view coords, std::string_view value); 570 ScalarU32 value);
637void EmitImageAtomicOr32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 571void EmitImageAtomicOr32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords,
638 std::string_view coords, std::string_view value); 572 ScalarU32 value);
639void EmitImageAtomicXor32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 573void EmitImageAtomicXor32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords,
640 std::string_view coords, std::string_view value); 574 ScalarU32 value);
641void EmitImageAtomicExchange32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 575void EmitImageAtomicExchange32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
642 std::string_view coords, std::string_view value); 576 Register coords, ScalarU32 value);
643void EmitLaneId(EmitContext& ctx); 577void EmitLaneId(EmitContext& ctx);
644void EmitVoteAll(EmitContext& ctx, std::string_view pred); 578void EmitVoteAll(EmitContext& ctx, ScalarS32 pred);
645void EmitVoteAny(EmitContext& ctx, std::string_view pred); 579void EmitVoteAny(EmitContext& ctx, ScalarS32 pred);
646void EmitVoteEqual(EmitContext& ctx, std::string_view pred); 580void EmitVoteEqual(EmitContext& ctx, ScalarS32 pred);
647void EmitSubgroupBallot(EmitContext& ctx, std::string_view pred); 581void EmitSubgroupBallot(EmitContext& ctx, ScalarS32 pred);
648void EmitSubgroupEqMask(EmitContext& ctx); 582void EmitSubgroupEqMask(EmitContext& ctx);
649void EmitSubgroupLtMask(EmitContext& ctx); 583void EmitSubgroupLtMask(EmitContext& ctx);
650void EmitSubgroupLeMask(EmitContext& ctx); 584void EmitSubgroupLeMask(EmitContext& ctx);
651void EmitSubgroupGtMask(EmitContext& ctx); 585void EmitSubgroupGtMask(EmitContext& ctx);
652void EmitSubgroupGeMask(EmitContext& ctx); 586void EmitSubgroupGeMask(EmitContext& ctx);
653void EmitShuffleIndex(EmitContext& ctx, IR::Inst& inst, std::string_view value, 587void EmitShuffleIndex(EmitContext& ctx, IR::Inst& inst, ScalarU32 value, ScalarU32 index,
654 std::string_view index, std::string_view clamp, 588 ScalarU32 clamp, ScalarU32 segmentation_mask);
655 std::string_view segmentation_mask); 589void EmitShuffleUp(EmitContext& ctx, IR::Inst& inst, ScalarU32 value, ScalarU32 index,
656void EmitShuffleUp(EmitContext& ctx, IR::Inst& inst, std::string_view value, std::string_view index, 590 ScalarU32 clamp, ScalarU32 segmentation_mask);
657 std::string_view clamp, std::string_view segmentation_mask); 591void EmitShuffleDown(EmitContext& ctx, IR::Inst& inst, ScalarU32 value, ScalarU32 index,
658void EmitShuffleDown(EmitContext& ctx, IR::Inst& inst, std::string_view value, 592 ScalarU32 clamp, ScalarU32 segmentation_mask);
659 std::string_view index, std::string_view clamp, 593void EmitShuffleButterfly(EmitContext& ctx, IR::Inst& inst, ScalarU32 value, ScalarU32 index,
660 std::string_view segmentation_mask); 594 ScalarU32 clamp, ScalarU32 segmentation_mask);
661void EmitShuffleButterfly(EmitContext& ctx, IR::Inst& inst, std::string_view value, 595void EmitFSwizzleAdd(EmitContext& ctx, ScalarF32 op_a, ScalarF32 op_b, ScalarU32 swizzle);
662 std::string_view index, std::string_view clamp, 596void EmitDPdxFine(EmitContext& ctx, ScalarF32 op_a);
663 std::string_view segmentation_mask); 597void EmitDPdyFine(EmitContext& ctx, ScalarF32 op_a);
664void EmitFSwizzleAdd(EmitContext& ctx, std::string_view op_a, std::string_view op_b, 598void EmitDPdxCoarse(EmitContext& ctx, ScalarF32 op_a);
665 std::string_view swizzle); 599void EmitDPdyCoarse(EmitContext& ctx, ScalarF32 op_a);
666void EmitDPdxFine(EmitContext& ctx, std::string_view op_a);
667void EmitDPdyFine(EmitContext& ctx, std::string_view op_a);
668void EmitDPdxCoarse(EmitContext& ctx, std::string_view op_a);
669void EmitDPdyCoarse(EmitContext& ctx, std::string_view op_a);
670 600
671} // namespace Shader::Backend::GLASM 601} // namespace Shader::Backend::GLASM
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp
index 579806c38..7b88d6f02 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp
@@ -2,239 +2,209 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <string_view>
6
7#include "shader_recompiler/backend/glasm/emit_context.h" 5#include "shader_recompiler/backend/glasm/emit_context.h"
8#include "shader_recompiler/backend/glasm/emit_glasm_instructions.h" 6#include "shader_recompiler/backend/glasm/emit_glasm_instructions.h"
9#include "shader_recompiler/frontend/ir/value.h" 7#include "shader_recompiler/frontend/ir/value.h"
10 8
11namespace Shader::Backend::GLASM { 9namespace Shader::Backend::GLASM {
12 10
13void EmitIAdd32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 11void EmitIAdd32(EmitContext& ctx, IR::Inst& inst, ScalarS32 a, ScalarS32 b) {
14 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 12 ctx.Add("ADD.S {}.x,{},{};", inst, a, b);
15 ctx.Add("ADD.U {},{},{};", inst, a, b);
16} 13}
17 14
18void EmitIAdd64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 15void EmitIAdd64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register a,
19 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 16 [[maybe_unused]] Register b) {
20 throw NotImplementedException("GLASM instruction"); 17 throw NotImplementedException("GLASM instruction");
21} 18}
22 19
23void EmitISub32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 20void EmitISub32(EmitContext& ctx, IR::Inst& inst, ScalarS32 a, ScalarS32 b) {
24 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 21 ctx.Add("SUB.S {}.x,{},{};", inst, a, b);
25 ctx.Add("SUB.U {},{},{};", inst, a, b);
26} 22}
27 23
28void EmitISub64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 24void EmitISub64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register a,
29 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 25 [[maybe_unused]] Register b) {
30 throw NotImplementedException("GLASM instruction"); 26 throw NotImplementedException("GLASM instruction");
31} 27}
32 28
33void EmitIMul32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 29void EmitIMul32(EmitContext& ctx, IR::Inst& inst, ScalarS32 a, ScalarS32 b) {
34 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 30 ctx.Add("MUL.S {}.x,{},{};", inst, a, b);
35 throw NotImplementedException("GLASM instruction");
36} 31}
37 32
38void EmitINeg32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 33void EmitINeg32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 value) {
39 [[maybe_unused]] std::string_view value) {
40 throw NotImplementedException("GLASM instruction"); 34 throw NotImplementedException("GLASM instruction");
41} 35}
42 36
43void EmitINeg64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 37void EmitINeg64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value) {
44 [[maybe_unused]] std::string_view value) {
45 throw NotImplementedException("GLASM instruction"); 38 throw NotImplementedException("GLASM instruction");
46} 39}
47 40
48void EmitIAbs32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 41void EmitIAbs32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 value) {
49 [[maybe_unused]] std::string_view value) {
50 throw NotImplementedException("GLASM instruction"); 42 throw NotImplementedException("GLASM instruction");
51} 43}
52 44
53void EmitIAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 45void EmitIAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value) {
54 [[maybe_unused]] std::string_view value) {
55 throw NotImplementedException("GLASM instruction"); 46 throw NotImplementedException("GLASM instruction");
56} 47}
57 48
58void EmitShiftLeftLogical32([[maybe_unused]] EmitContext& ctx, 49void EmitShiftLeftLogical32(EmitContext& ctx, IR::Inst& inst, ScalarU32 base, ScalarU32 shift) {
59 [[maybe_unused]] std::string_view base, 50 ctx.Add("SHL.U {}.x,{},{};", inst, base, shift);
60 [[maybe_unused]] std::string_view shift) {
61 throw NotImplementedException("GLASM instruction");
62} 51}
63 52
64void EmitShiftLeftLogical64([[maybe_unused]] EmitContext& ctx, 53void EmitShiftLeftLogical64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register base,
65 [[maybe_unused]] std::string_view base, 54 [[maybe_unused]] Register shift) {
66 [[maybe_unused]] std::string_view shift) {
67 throw NotImplementedException("GLASM instruction"); 55 throw NotImplementedException("GLASM instruction");
68} 56}
69 57
70void EmitShiftRightLogical32([[maybe_unused]] EmitContext& ctx, 58void EmitShiftRightLogical32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarU32 base,
71 [[maybe_unused]] std::string_view base, 59 [[maybe_unused]] ScalarU32 shift) {
72 [[maybe_unused]] std::string_view shift) {
73 throw NotImplementedException("GLASM instruction"); 60 throw NotImplementedException("GLASM instruction");
74} 61}
75 62
76void EmitShiftRightLogical64([[maybe_unused]] EmitContext& ctx, 63void EmitShiftRightLogical64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register base,
77 [[maybe_unused]] std::string_view base, 64 [[maybe_unused]] Register shift) {
78 [[maybe_unused]] std::string_view shift) {
79 throw NotImplementedException("GLASM instruction"); 65 throw NotImplementedException("GLASM instruction");
80} 66}
81 67
82void EmitShiftRightArithmetic32([[maybe_unused]] EmitContext& ctx, 68void EmitShiftRightArithmetic32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 base,
83 [[maybe_unused]] std::string_view base, 69 [[maybe_unused]] ScalarS32 shift) {
84 [[maybe_unused]] std::string_view shift) {
85 throw NotImplementedException("GLASM instruction"); 70 throw NotImplementedException("GLASM instruction");
86} 71}
87 72
88void EmitShiftRightArithmetic64([[maybe_unused]] EmitContext& ctx, 73void EmitShiftRightArithmetic64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register base,
89 [[maybe_unused]] std::string_view base, 74 [[maybe_unused]] Register shift) {
90 [[maybe_unused]] std::string_view shift) {
91 throw NotImplementedException("GLASM instruction"); 75 throw NotImplementedException("GLASM instruction");
92} 76}
93 77
94void EmitBitwiseAnd32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 78void EmitBitwiseAnd32(EmitContext& ctx, IR::Inst& inst, ScalarS32 a, ScalarS32 b) {
95 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 79 ctx.Add("AND.S {}.x,{},{};", inst, a, b);
96 ctx.Add("AND {},{},{};", inst, a, b);
97} 80}
98 81
99void EmitBitwiseOr32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 82void EmitBitwiseOr32(EmitContext& ctx, IR::Inst& inst, ScalarS32 a, ScalarS32 b) {
100 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 83 ctx.Add("OR.S {}.x,{},{};", inst, a, b);
101 ctx.Add("OR {},{},{};", inst, a, b);
102} 84}
103 85
104void EmitBitwiseXor32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 86void EmitBitwiseXor32(EmitContext& ctx, IR::Inst& inst, ScalarS32 a, ScalarS32 b) {
105 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 87 ctx.Add("XOR.S {}.x,{},{};", inst, a, b);
106 ctx.Add("XOR {},{},{};", inst, a, b);
107} 88}
108 89
109void EmitBitFieldInsert(EmitContext& ctx, IR::Inst& inst, std::string_view base, 90void EmitBitFieldInsert([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 base,
110 std::string_view insert, std::string_view offset, std::string_view count) { 91 [[maybe_unused]] ScalarS32 insert, [[maybe_unused]] ScalarS32 offset,
111 ctx.Add("MOV.U RC.x,{};MOV.U RC.y,{};", count, offset); 92 [[maybe_unused]] ScalarS32 count) {
112 ctx.Add("BFI.U {},RC,{},{};", inst, insert, base); 93 throw NotImplementedException("GLASM instruction");
113} 94}
114 95
115void EmitBitFieldSExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base, 96void EmitBitFieldSExtract([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
116 std::string_view offset, std::string_view count) { 97 [[maybe_unused]] ScalarS32 base, [[maybe_unused]] ScalarS32 offset,
117 ctx.Add("MOV.U RC.x,{};MOV.U RC.y,{};", count, offset); 98 [[maybe_unused]] ScalarS32 count) {
118 ctx.Add("BFE.S {},RC,{};", inst, base); 99 throw NotImplementedException("GLASM instruction");
119} 100}
120 101
121void EmitBitFieldUExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base, 102void EmitBitFieldUExtract([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
122 std::string_view offset, std::string_view count) { 103 [[maybe_unused]] ScalarU32 base, [[maybe_unused]] ScalarU32 offset,
123 ctx.Add("MOV.U RC.x,{};MOV.U RC.y,{};", count, offset); 104 [[maybe_unused]] ScalarU32 count) {
124 ctx.Add("BFE.U {},RC,{};", inst, base); 105 throw NotImplementedException("GLASM instruction");
125} 106}
126 107
127void EmitBitReverse32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 108void EmitBitReverse32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 value) {
128 [[maybe_unused]] std::string_view value) { 109 throw NotImplementedException("GLASM instruction");
129 ctx.Add("BFR {},{};", inst, value);
130} 110}
131 111
132void EmitBitCount32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 112void EmitBitCount32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 value) {
133 [[maybe_unused]] std::string_view value) {
134 throw NotImplementedException("GLASM instruction"); 113 throw NotImplementedException("GLASM instruction");
135} 114}
136 115
137void EmitBitwiseNot32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 116void EmitBitwiseNot32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 value) {
138 [[maybe_unused]] std::string_view value) { 117 throw NotImplementedException("GLASM instruction");
139 ctx.Add("NOT {},{};", inst, value);
140} 118}
141 119
142void EmitFindSMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 120void EmitFindSMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 value) {
143 [[maybe_unused]] std::string_view value) {
144 throw NotImplementedException("GLASM instruction"); 121 throw NotImplementedException("GLASM instruction");
145} 122}
146 123
147void EmitFindUMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 124void EmitFindUMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarU32 value) {
148 [[maybe_unused]] std::string_view value) {
149 throw NotImplementedException("GLASM instruction"); 125 throw NotImplementedException("GLASM instruction");
150} 126}
151 127
152void EmitSMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 128void EmitSMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 a,
153 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 129 [[maybe_unused]] ScalarS32 b) {
154 throw NotImplementedException("GLASM instruction"); 130 throw NotImplementedException("GLASM instruction");
155} 131}
156 132
157void EmitUMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 133void EmitUMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarU32 a,
158 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 134 [[maybe_unused]] ScalarU32 b) {
159 throw NotImplementedException("GLASM instruction"); 135 throw NotImplementedException("GLASM instruction");
160} 136}
161 137
162void EmitSMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 138void EmitSMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 a,
163 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 139 [[maybe_unused]] ScalarS32 b) {
164 throw NotImplementedException("GLASM instruction"); 140 throw NotImplementedException("GLASM instruction");
165} 141}
166 142
167void EmitUMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 143void EmitUMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarU32 a,
168 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 144 [[maybe_unused]] ScalarU32 b) {
169 throw NotImplementedException("GLASM instruction"); 145 throw NotImplementedException("GLASM instruction");
170} 146}
171 147
172void EmitSClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 148void EmitSClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
173 [[maybe_unused]] std::string_view value, [[maybe_unused]] std::string_view min, 149 [[maybe_unused]] ScalarS32 value, [[maybe_unused]] ScalarS32 min,
174 [[maybe_unused]] std::string_view max) { 150 [[maybe_unused]] ScalarS32 max) {
175 throw NotImplementedException("GLASM instruction"); 151 throw NotImplementedException("GLASM instruction");
176} 152}
177 153
178void EmitUClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 154void EmitUClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
179 [[maybe_unused]] std::string_view value, [[maybe_unused]] std::string_view min, 155 [[maybe_unused]] ScalarU32 value, [[maybe_unused]] ScalarU32 min,
180 [[maybe_unused]] std::string_view max) { 156 [[maybe_unused]] ScalarU32 max) {
181 throw NotImplementedException("GLASM instruction"); 157 throw NotImplementedException("GLASM instruction");
182} 158}
183 159
184void EmitSLessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 160void EmitSLessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 lhs,
185 [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { 161 [[maybe_unused]] ScalarS32 rhs) {
186 ctx.Add("SLT.S {},{},{};", inst, lhs, rhs); 162 throw NotImplementedException("GLASM instruction");
187} 163}
188 164
189void EmitULessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 165void EmitULessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarU32 lhs,
190 [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { 166 [[maybe_unused]] ScalarU32 rhs) {
191 ctx.Add("SLT.U {},{},{};", inst, lhs, rhs); 167 throw NotImplementedException("GLASM instruction");
192} 168}
193 169
194void EmitIEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 170void EmitIEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 lhs,
195 [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { 171 [[maybe_unused]] ScalarS32 rhs) {
196 ctx.Add("SEQ {},{},{};", inst, lhs, rhs); 172 throw NotImplementedException("GLASM instruction");
197} 173}
198 174
199void EmitSLessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 175void EmitSLessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 lhs,
200 [[maybe_unused]] std::string_view lhs, 176 [[maybe_unused]] ScalarS32 rhs) {
201 [[maybe_unused]] std::string_view rhs) { 177 throw NotImplementedException("GLASM instruction");
202 ctx.Add("SLE.S {},{},{};", inst, lhs, rhs);
203} 178}
204 179
205void EmitULessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 180void EmitULessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarU32 lhs,
206 [[maybe_unused]] std::string_view lhs, 181 [[maybe_unused]] ScalarU32 rhs) {
207 [[maybe_unused]] std::string_view rhs) { 182 throw NotImplementedException("GLASM instruction");
208 ctx.Add("SLE.U {},{},{};", inst, lhs, rhs);
209} 183}
210 184
211void EmitSGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 185void EmitSGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 lhs,
212 [[maybe_unused]] std::string_view lhs, 186 [[maybe_unused]] ScalarS32 rhs) {
213 [[maybe_unused]] std::string_view rhs) { 187 throw NotImplementedException("GLASM instruction");
214 ctx.Add("SGT.S {},{},{};", inst, lhs, rhs);
215} 188}
216 189
217void EmitUGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 190void EmitUGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarU32 lhs,
218 [[maybe_unused]] std::string_view lhs, 191 [[maybe_unused]] ScalarU32 rhs) {
219 [[maybe_unused]] std::string_view rhs) { 192 throw NotImplementedException("GLASM instruction");
220 ctx.Add("SGT.U {},{},{};", inst, lhs, rhs);
221} 193}
222 194
223void EmitINotEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 195void EmitINotEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 lhs,
224 [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { 196 [[maybe_unused]] ScalarS32 rhs) {
225 ctx.Add("SNE.U {},{},{};", inst, lhs, rhs); 197 throw NotImplementedException("GLASM instruction");
226} 198}
227 199
228void EmitSGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 200void EmitSGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 lhs,
229 [[maybe_unused]] std::string_view lhs, 201 [[maybe_unused]] ScalarS32 rhs) {
230 [[maybe_unused]] std::string_view rhs) { 202 throw NotImplementedException("GLASM instruction");
231 ctx.Add("SGE.S {},{},{};", inst, lhs, rhs);
232} 203}
233 204
234void EmitUGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 205void EmitUGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarU32 lhs,
235 [[maybe_unused]] std::string_view lhs, 206 [[maybe_unused]] ScalarU32 rhs) {
236 [[maybe_unused]] std::string_view rhs) { 207 throw NotImplementedException("GLASM instruction");
237 ctx.Add("SGE.U {},{},{};", inst, lhs, rhs);
238} 208}
239 209
240} // namespace Shader::Backend::GLASM 210} // namespace Shader::Backend::GLASM
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_memory.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_memory.cpp
index 9e38a1bdf..8ef0f7c17 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_memory.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_memory.cpp
@@ -11,7 +11,7 @@
11 11
12namespace Shader::Backend::GLASM { 12namespace Shader::Backend::GLASM {
13namespace { 13namespace {
14void StorageOp(EmitContext& ctx, const IR::Value& binding, std::string_view offset, 14void StorageOp(EmitContext& ctx, const IR::Value& binding, ScalarU32 offset,
15 std::string_view then_expr, std::string_view else_expr = {}) { 15 std::string_view then_expr, std::string_view else_expr = {}) {
16 // Operate on bindless SSBO, call the expression with bounds checking 16 // Operate on bindless SSBO, call the expression with bounds checking
17 // address = c[binding].xy 17 // address = c[binding].xy
@@ -23,20 +23,21 @@ void StorageOp(EmitContext& ctx, const IR::Value& binding, std::string_view offs
23 "SLT.U.CC RC.x,{},c[{}].z;", // cc = offset < length 23 "SLT.U.CC RC.x,{},c[{}].z;", // cc = offset < length
24 sb_binding, offset, offset, sb_binding); 24 sb_binding, offset, offset, sb_binding);
25 if (else_expr.empty()) { 25 if (else_expr.empty()) {
26 ctx.Add("{}", then_expr); 26 ctx.Add("IF NE.x;{}ENDIF;", then_expr);
27 } else { 27 } else {
28 ctx.Add("IF NE.x;{}ELSE;{}ENDIF;", then_expr, else_expr); 28 ctx.Add("IF NE.x;{}ELSE;{}ENDIF;", then_expr, else_expr);
29 } 29 }
30} 30}
31 31
32void Store(EmitContext& ctx, const IR::Value& binding, std::string_view offset, 32template <typename ValueType>
33 std::string_view value, std::string_view size) { 33void Store(EmitContext& ctx, const IR::Value& binding, ScalarU32 offset, ValueType value,
34 std::string_view size) {
34 StorageOp(ctx, binding, offset, fmt::format("STORE.{} {},LC.x;", size, value)); 35 StorageOp(ctx, binding, offset, fmt::format("STORE.{} {},LC.x;", size, value));
35} 36}
36 37
37void Load(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, std::string_view offset, 38void Load(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, ScalarU32 offset,
38 std::string_view size) { 39 std::string_view size) {
39 const std::string ret{ctx.reg_alloc.Define(inst)}; 40 const Register ret{ctx.reg_alloc.Define(inst)};
40 StorageOp(ctx, binding, offset, fmt::format("STORE.{} {},LC.x;", size, ret), 41 StorageOp(ctx, binding, offset, fmt::format("STORE.{} {},LC.x;", size, ret),
41 fmt::format("MOV.U {},{{0,0,0,0}};", ret)); 42 fmt::format("MOV.U {},{{0,0,0,0}};", ret));
42} 43}
@@ -58,18 +59,15 @@ void EmitLoadGlobalS16([[maybe_unused]] EmitContext& ctx) {
58 throw NotImplementedException("GLASM instruction"); 59 throw NotImplementedException("GLASM instruction");
59} 60}
60 61
61void EmitLoadGlobal32([[maybe_unused]] EmitContext& ctx, 62void EmitLoadGlobal32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register address) {
62 [[maybe_unused]] std::string_view address) {
63 throw NotImplementedException("GLASM instruction"); 63 throw NotImplementedException("GLASM instruction");
64} 64}
65 65
66void EmitLoadGlobal64([[maybe_unused]] EmitContext& ctx, 66void EmitLoadGlobal64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register address) {
67 [[maybe_unused]] std::string_view address) {
68 throw NotImplementedException("GLASM instruction"); 67 throw NotImplementedException("GLASM instruction");
69} 68}
70 69
71void EmitLoadGlobal128([[maybe_unused]] EmitContext& ctx, 70void EmitLoadGlobal128([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register address) {
72 [[maybe_unused]] std::string_view address) {
73 throw NotImplementedException("GLASM instruction"); 71 throw NotImplementedException("GLASM instruction");
74} 72}
75 73
@@ -89,89 +87,88 @@ void EmitWriteGlobalS16([[maybe_unused]] EmitContext& ctx) {
89 throw NotImplementedException("GLASM instruction"); 87 throw NotImplementedException("GLASM instruction");
90} 88}
91 89
92void EmitWriteGlobal32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view address, 90void EmitWriteGlobal32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register address,
93 [[maybe_unused]] std::string_view value) { 91 [[maybe_unused]] ScalarU32 value) {
94 throw NotImplementedException("GLASM instruction"); 92 throw NotImplementedException("GLASM instruction");
95} 93}
96 94
97void EmitWriteGlobal64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view address, 95void EmitWriteGlobal64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register address,
98 [[maybe_unused]] std::string_view value) { 96 [[maybe_unused]] Register value) {
99 throw NotImplementedException("GLASM instruction"); 97 throw NotImplementedException("GLASM instruction");
100} 98}
101 99
102void EmitWriteGlobal128([[maybe_unused]] EmitContext& ctx, 100void EmitWriteGlobal128([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register address,
103 [[maybe_unused]] std::string_view address, 101 [[maybe_unused]] Register value) {
104 [[maybe_unused]] std::string_view value) {
105 throw NotImplementedException("GLASM instruction"); 102 throw NotImplementedException("GLASM instruction");
106} 103}
107 104
108void EmitLoadStorageU8(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 105void EmitLoadStorageU8(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding,
109 std::string_view offset) { 106 ScalarU32 offset) {
110 Load(ctx, inst, binding, offset, "U8"); 107 Load(ctx, inst, binding, offset, "U8");
111} 108}
112 109
113void EmitLoadStorageS8(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 110void EmitLoadStorageS8(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding,
114 std::string_view offset) { 111 ScalarU32 offset) {
115 Load(ctx, inst, binding, offset, "S8"); 112 Load(ctx, inst, binding, offset, "S8");
116} 113}
117 114
118void EmitLoadStorageU16(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 115void EmitLoadStorageU16(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding,
119 std::string_view offset) { 116 ScalarU32 offset) {
120 Load(ctx, inst, binding, offset, "U16"); 117 Load(ctx, inst, binding, offset, "U16");
121} 118}
122 119
123void EmitLoadStorageS16(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 120void EmitLoadStorageS16(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding,
124 std::string_view offset) { 121 ScalarU32 offset) {
125 Load(ctx, inst, binding, offset, "S16"); 122 Load(ctx, inst, binding, offset, "S16");
126} 123}
127 124
128void EmitLoadStorage32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 125void EmitLoadStorage32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding,
129 std::string_view offset) { 126 ScalarU32 offset) {
130 Load(ctx, inst, binding, offset, "U32"); 127 Load(ctx, inst, binding, offset, "U32");
131} 128}
132 129
133void EmitLoadStorage64(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 130void EmitLoadStorage64(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding,
134 std::string_view offset) { 131 ScalarU32 offset) {
135 Load(ctx, inst, binding, offset, "U32X2"); 132 Load(ctx, inst, binding, offset, "U32X2");
136} 133}
137 134
138void EmitLoadStorage128(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, 135void EmitLoadStorage128(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding,
139 std::string_view offset) { 136 ScalarU32 offset) {
140 Load(ctx, inst, binding, offset, "U32X4"); 137 Load(ctx, inst, binding, offset, "U32X4");
141} 138}
142 139
143void EmitWriteStorageU8(EmitContext& ctx, const IR::Value& binding, std::string_view offset, 140void EmitWriteStorageU8(EmitContext& ctx, const IR::Value& binding, ScalarU32 offset,
144 std::string_view value) { 141 ScalarU32 value) {
145 Store(ctx, binding, offset, value, "U8"); 142 Store(ctx, binding, offset, value, "U8");
146} 143}
147 144
148void EmitWriteStorageS8(EmitContext& ctx, const IR::Value& binding, std::string_view offset, 145void EmitWriteStorageS8(EmitContext& ctx, const IR::Value& binding, ScalarU32 offset,
149 std::string_view value) { 146 ScalarS32 value) {
150 Store(ctx, binding, offset, value, "S8"); 147 Store(ctx, binding, offset, value, "S8");
151} 148}
152 149
153void EmitWriteStorageU16(EmitContext& ctx, const IR::Value& binding, std::string_view offset, 150void EmitWriteStorageU16(EmitContext& ctx, const IR::Value& binding, ScalarU32 offset,
154 std::string_view value) { 151 ScalarU32 value) {
155 Store(ctx, binding, offset, value, "U16"); 152 Store(ctx, binding, offset, value, "U16");
156} 153}
157 154
158void EmitWriteStorageS16(EmitContext& ctx, const IR::Value& binding, std::string_view offset, 155void EmitWriteStorageS16(EmitContext& ctx, const IR::Value& binding, ScalarU32 offset,
159 std::string_view value) { 156 ScalarS32 value) {
160 Store(ctx, binding, offset, value, "S16"); 157 Store(ctx, binding, offset, value, "S16");
161} 158}
162 159
163void EmitWriteStorage32(EmitContext& ctx, const IR::Value& binding, std::string_view offset, 160void EmitWriteStorage32(EmitContext& ctx, const IR::Value& binding, ScalarU32 offset,
164 std::string_view value) { 161 ScalarU32 value) {
165 Store(ctx, binding, offset, value, "U32"); 162 Store(ctx, binding, offset, value, "U32");
166} 163}
167 164
168void EmitWriteStorage64(EmitContext& ctx, const IR::Value& binding, std::string_view offset, 165void EmitWriteStorage64(EmitContext& ctx, const IR::Value& binding, ScalarU32 offset,
169 std::string_view value) { 166 Register value) {
170 Store(ctx, binding, offset, value, "U32X2"); 167 Store(ctx, binding, offset, value, "U32X2");
171} 168}
172 169
173void EmitWriteStorage128(EmitContext& ctx, const IR::Value& binding, std::string_view offset, 170void EmitWriteStorage128(EmitContext& ctx, const IR::Value& binding, ScalarU32 offset,
174 std::string_view value) { 171 Register value) {
175 Store(ctx, binding, offset, value, "U32X4"); 172 Store(ctx, binding, offset, value, "U32X4");
176} 173}
177 174
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp
index 32eb87837..08de3f92f 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp
@@ -25,21 +25,19 @@ void EmitVoid(EmitContext& ctx) {
25 NotImplemented(); 25 NotImplemented();
26} 26}
27 27
28void EmitBranch(EmitContext& ctx, std::string_view label) { 28void EmitBranch(EmitContext& ctx) {
29 NotImplemented(); 29 NotImplemented();
30} 30}
31 31
32void EmitBranchConditional(EmitContext& ctx, std::string_view condition, 32void EmitBranchConditional(EmitContext& ctx) {
33 std::string_view true_label, std::string_view false_label) {
34 NotImplemented(); 33 NotImplemented();
35} 34}
36 35
37void EmitLoopMerge(EmitContext& ctx, std::string_view merge_label, 36void EmitLoopMerge(EmitContext& ctx) {
38 std::string_view continue_label) {
39 NotImplemented(); 37 NotImplemented();
40} 38}
41 39
42void EmitSelectionMerge(EmitContext& ctx, std::string_view merge_label) { 40void EmitSelectionMerge(EmitContext& ctx) {
43 NotImplemented(); 41 NotImplemented();
44} 42}
45 43
@@ -55,7 +53,7 @@ void EmitUnreachable(EmitContext& ctx) {
55 NotImplemented(); 53 NotImplemented();
56} 54}
57 55
58void EmitDemoteToHelperInvocation(EmitContext& ctx, std::string_view continue_label) { 56void EmitDemoteToHelperInvocation(EmitContext& ctx) {
59 NotImplemented(); 57 NotImplemented();
60} 58}
61 59
@@ -155,8 +153,8 @@ void EmitWorkgroupId(EmitContext& ctx) {
155 NotImplemented(); 153 NotImplemented();
156} 154}
157 155
158void EmitLocalInvocationId(EmitContext& ctx) { 156void EmitLocalInvocationId(EmitContext& ctx, IR::Inst& inst) {
159 NotImplemented(); 157 ctx.Add("MOV.S {},invocation.localid;", inst);
160} 158}
161 159
162void EmitInvocationId(EmitContext& ctx) { 160void EmitInvocationId(EmitContext& ctx) {
@@ -175,11 +173,11 @@ void EmitYDirection(EmitContext& ctx) {
175 NotImplemented(); 173 NotImplemented();
176} 174}
177 175
178void EmitLoadLocal(EmitContext& ctx, std::string_view word_offset) { 176void EmitLoadLocal(EmitContext& ctx, ScalarU32 word_offset) {
179 NotImplemented(); 177 NotImplemented();
180} 178}
181 179
182void EmitWriteLocal(EmitContext& ctx, std::string_view word_offset, std::string_view value) { 180void EmitWriteLocal(EmitContext& ctx, ScalarU32 word_offset, ScalarU32 value) {
183 NotImplemented(); 181 NotImplemented();
184} 182}
185 183
@@ -203,245 +201,127 @@ void EmitUndefU64(EmitContext& ctx) {
203 NotImplemented(); 201 NotImplemented();
204} 202}
205 203
206void EmitLoadSharedU8(EmitContext& ctx, std::string_view offset) { 204void EmitLoadSharedU8(EmitContext& ctx, ScalarU32 offset) {
207 NotImplemented();
208}
209
210void EmitLoadSharedS8(EmitContext& ctx, std::string_view offset) {
211 NotImplemented();
212}
213
214void EmitLoadSharedU16(EmitContext& ctx, std::string_view offset) {
215 NotImplemented();
216}
217
218void EmitLoadSharedS16(EmitContext& ctx, std::string_view offset) {
219 NotImplemented();
220}
221
222void EmitLoadSharedU32(EmitContext& ctx, std::string_view offset) {
223 NotImplemented();
224}
225
226void EmitLoadSharedU64(EmitContext& ctx, std::string_view offset) {
227 NotImplemented();
228}
229
230void EmitLoadSharedU128(EmitContext& ctx, std::string_view offset) {
231 NotImplemented();
232}
233
234void EmitWriteSharedU8(EmitContext& ctx, std::string_view offset, std::string_view value) {
235 NotImplemented();
236}
237
238void EmitWriteSharedU16(EmitContext& ctx, std::string_view offset, std::string_view value) {
239 NotImplemented();
240}
241
242void EmitWriteSharedU32(EmitContext& ctx, std::string_view offset, std::string_view value) {
243 NotImplemented();
244}
245
246void EmitWriteSharedU64(EmitContext& ctx, std::string_view offset, std::string_view value) {
247 NotImplemented();
248}
249
250void EmitWriteSharedU128(EmitContext& ctx, std::string_view offset, std::string_view value) {
251 NotImplemented();
252}
253
254void EmitCompositeConstructU32x2(EmitContext& ctx, std::string_view e1, std::string_view e2) {
255 NotImplemented();
256}
257
258void EmitCompositeConstructU32x3(EmitContext& ctx, std::string_view e1, std::string_view e2,
259 std::string_view e3) {
260 NotImplemented();
261}
262
263void EmitCompositeConstructU32x4(EmitContext& ctx, std::string_view e1, std::string_view e2,
264 std::string_view e3, std::string_view e4) {
265 NotImplemented();
266}
267
268void EmitCompositeExtractU32x2(EmitContext& ctx, std::string_view composite, u32 index) {
269 NotImplemented();
270}
271
272void EmitCompositeExtractU32x3(EmitContext& ctx, std::string_view composite, u32 index) {
273 NotImplemented();
274}
275
276void EmitCompositeExtractU32x4(EmitContext& ctx, std::string_view composite, u32 index) {
277 NotImplemented();
278}
279
280void EmitCompositeInsertU32x2(EmitContext& ctx, std::string_view composite, std::string_view object,
281 u32 index) {
282 NotImplemented();
283}
284
285void EmitCompositeInsertU32x3(EmitContext& ctx, std::string_view composite, std::string_view object,
286 u32 index) {
287 NotImplemented();
288}
289
290void EmitCompositeInsertU32x4(EmitContext& ctx, std::string_view composite, std::string_view object,
291 u32 index) {
292 NotImplemented();
293}
294
295void EmitCompositeConstructF16x2(EmitContext& ctx, std::string_view e1, std::string_view e2) {
296 NotImplemented();
297}
298
299void EmitCompositeConstructF16x3(EmitContext& ctx, std::string_view e1, std::string_view e2,
300 std::string_view e3) {
301 NotImplemented();
302}
303
304void EmitCompositeConstructF16x4(EmitContext& ctx, std::string_view e1, std::string_view e2,
305 std::string_view e3, std::string_view e4) {
306 NotImplemented();
307}
308
309void EmitCompositeExtractF16x2(EmitContext& ctx, std::string_view composite, u32 index) {
310 NotImplemented();
311}
312
313void EmitCompositeExtractF16x3(EmitContext& ctx, std::string_view composite, u32 index) {
314 NotImplemented(); 205 NotImplemented();
315} 206}
316 207
317void EmitCompositeExtractF16x4(EmitContext& ctx, std::string_view composite, u32 index) { 208void EmitLoadSharedS8(EmitContext& ctx, ScalarU32 offset) {
318 NotImplemented(); 209 NotImplemented();
319} 210}
320 211
321void EmitCompositeInsertF16x2(EmitContext& ctx, std::string_view composite, std::string_view object, 212void EmitLoadSharedU16(EmitContext& ctx, ScalarU32 offset) {
322 u32 index) {
323 NotImplemented(); 213 NotImplemented();
324} 214}
325 215
326void EmitCompositeInsertF16x3(EmitContext& ctx, std::string_view composite, std::string_view object, 216void EmitLoadSharedS16(EmitContext& ctx, ScalarU32 offset) {
327 u32 index) {
328 NotImplemented(); 217 NotImplemented();
329} 218}
330 219
331void EmitCompositeInsertF16x4(EmitContext& ctx, std::string_view composite, std::string_view object, 220void EmitLoadSharedU32(EmitContext& ctx, ScalarU32 offset) {
332 u32 index) {
333 NotImplemented(); 221 NotImplemented();
334} 222}
335 223
336void EmitCompositeConstructF32x2(EmitContext& ctx, std::string_view e1, std::string_view e2) { 224void EmitLoadSharedU64(EmitContext& ctx, ScalarU32 offset) {
337 NotImplemented(); 225 NotImplemented();
338} 226}
339 227
340void EmitCompositeConstructF32x3(EmitContext& ctx, std::string_view e1, std::string_view e2, 228void EmitLoadSharedU128(EmitContext& ctx, ScalarU32 offset) {
341 std::string_view e3) {
342 NotImplemented(); 229 NotImplemented();
343} 230}
344 231
345void EmitCompositeConstructF32x4(EmitContext& ctx, std::string_view e1, std::string_view e2, 232void EmitWriteSharedU8(EmitContext& ctx, ScalarU32 offset, ScalarU32 value) {
346 std::string_view e3, std::string_view e4) {
347 NotImplemented(); 233 NotImplemented();
348} 234}
349 235
350void EmitCompositeExtractF32x2(EmitContext& ctx, std::string_view composite, u32 index) { 236void EmitWriteSharedU16(EmitContext& ctx, ScalarU32 offset, ScalarU32 value) {
351 NotImplemented(); 237 NotImplemented();
352} 238}
353 239
354void EmitCompositeExtractF32x3(EmitContext& ctx, std::string_view composite, u32 index) { 240void EmitWriteSharedU32(EmitContext& ctx, ScalarU32 offset, ScalarU32 value) {
355 NotImplemented(); 241 NotImplemented();
356} 242}
357 243
358void EmitCompositeExtractF32x4(EmitContext& ctx, std::string_view composite, u32 index) { 244void EmitWriteSharedU64(EmitContext& ctx, ScalarU32 offset, Register value) {
359 NotImplemented(); 245 NotImplemented();
360} 246}
361 247
362void EmitCompositeInsertF32x2(EmitContext& ctx, std::string_view composite, std::string_view object, 248void EmitWriteSharedU128(EmitContext& ctx, ScalarU32 offset, Register value) {
363 u32 index) {
364 NotImplemented(); 249 NotImplemented();
365} 250}
366 251
367void EmitCompositeInsertF32x3(EmitContext& ctx, std::string_view composite, std::string_view object, 252void EmitSelectU1(EmitContext& ctx, ScalarS32 cond, ScalarS32 true_value, ScalarS32 false_value) {
368 u32 index) {
369 NotImplemented(); 253 NotImplemented();
370} 254}
371 255
372void EmitCompositeInsertF32x4(EmitContext& ctx, std::string_view composite, std::string_view object, 256void EmitSelectU8(EmitContext& ctx, ScalarS32 cond, ScalarS32 true_value, ScalarS32 false_value) {
373 u32 index) {
374 NotImplemented(); 257 NotImplemented();
375} 258}
376 259
377void EmitCompositeConstructF64x2(EmitContext& ctx) { 260void EmitSelectU16(EmitContext& ctx, ScalarS32 cond, ScalarS32 true_value, ScalarS32 false_value) {
378 NotImplemented(); 261 NotImplemented();
379} 262}
380 263
381void EmitCompositeConstructF64x3(EmitContext& ctx) { 264void EmitSelectU32(EmitContext& ctx, ScalarS32 cond, ScalarS32 true_value, ScalarS32 false_value) {
382 NotImplemented(); 265 NotImplemented();
383} 266}
384 267
385void EmitCompositeConstructF64x4(EmitContext& ctx) { 268void EmitSelectU64(EmitContext& ctx, ScalarS32 cond, Register true_value, Register false_value) {
386 NotImplemented(); 269 NotImplemented();
387} 270}
388 271
389void EmitCompositeExtractF64x2(EmitContext& ctx) { 272void EmitSelectF16(EmitContext& ctx, ScalarS32 cond, Register true_value, Register false_value) {
390 NotImplemented(); 273 NotImplemented();
391} 274}
392 275
393void EmitCompositeExtractF64x3(EmitContext& ctx) { 276void EmitSelectF32(EmitContext& ctx, ScalarS32 cond, ScalarS32 true_value, ScalarS32 false_value) {
394 NotImplemented(); 277 NotImplemented();
395} 278}
396 279
397void EmitCompositeExtractF64x4(EmitContext& ctx) { 280void EmitSelectF64(EmitContext& ctx, ScalarS32 cond, Register true_value, Register false_value) {
398 NotImplemented(); 281 NotImplemented();
399} 282}
400 283
401void EmitCompositeInsertF64x2(EmitContext& ctx, std::string_view composite, std::string_view object, 284void EmitSelectF16(EmitContext& ctx, Register cond, Register true_value, Register false_value) {
402 u32 index) {
403 NotImplemented(); 285 NotImplemented();
404} 286}
405 287
406void EmitCompositeInsertF64x3(EmitContext& ctx, std::string_view composite, std::string_view object, 288void EmitSelectF32(EmitContext& ctx, Register cond, Register true_value, Register false_value) {
407 u32 index) {
408 NotImplemented(); 289 NotImplemented();
409} 290}
410 291
411void EmitCompositeInsertF64x4(EmitContext& ctx, std::string_view composite, std::string_view object, 292void EmitSelectF64(EmitContext& ctx, Register cond, Register true_value, Register false_value) {
412 u32 index) {
413 NotImplemented(); 293 NotImplemented();
414} 294}
415 295
416void EmitPackUint2x32(EmitContext& ctx, std::string_view value) { 296void EmitPackUint2x32(EmitContext& ctx, Register value) {
417 NotImplemented(); 297 NotImplemented();
418} 298}
419 299
420void EmitUnpackUint2x32(EmitContext& ctx, std::string_view value) { 300void EmitUnpackUint2x32(EmitContext& ctx, Register value) {
421 NotImplemented(); 301 NotImplemented();
422} 302}
423 303
424void EmitPackFloat2x16(EmitContext& ctx, std::string_view value) { 304void EmitPackFloat2x16(EmitContext& ctx, Register value) {
425 NotImplemented(); 305 NotImplemented();
426} 306}
427 307
428void EmitUnpackFloat2x16(EmitContext& ctx, std::string_view value) { 308void EmitUnpackFloat2x16(EmitContext& ctx, Register value) {
429 NotImplemented(); 309 NotImplemented();
430} 310}
431 311
432void EmitPackHalf2x16(EmitContext& ctx, std::string_view value) { 312void EmitPackHalf2x16(EmitContext& ctx, Register value) {
433 NotImplemented(); 313 NotImplemented();
434} 314}
435 315
436void EmitUnpackHalf2x16(EmitContext& ctx, std::string_view value) { 316void EmitUnpackHalf2x16(EmitContext& ctx, Register value) {
437 NotImplemented(); 317 NotImplemented();
438} 318}
439 319
440void EmitPackDouble2x32(EmitContext& ctx, std::string_view value) { 320void EmitPackDouble2x32(EmitContext& ctx, Register value) {
441 NotImplemented(); 321 NotImplemented();
442} 322}
443 323
444void EmitUnpackDouble2x32(EmitContext& ctx, std::string_view value) { 324void EmitUnpackDouble2x32(EmitContext& ctx, Register value) {
445 NotImplemented(); 325 NotImplemented();
446} 326}
447 327
@@ -469,210 +349,198 @@ void EmitGetInBoundsFromOp(EmitContext& ctx) {
469 NotImplemented(); 349 NotImplemented();
470} 350}
471 351
472void EmitFPIsNan16(EmitContext& ctx, std::string_view value) { 352void EmitFPIsNan16(EmitContext& ctx, Register value) {
473 NotImplemented(); 353 NotImplemented();
474} 354}
475 355
476void EmitFPIsNan32(EmitContext& ctx, std::string_view value) { 356void EmitFPIsNan32(EmitContext& ctx, ScalarF32 value) {
477 NotImplemented(); 357 NotImplemented();
478} 358}
479 359
480void EmitFPIsNan64(EmitContext& ctx, std::string_view value) { 360void EmitFPIsNan64(EmitContext& ctx, Register value) {
481 NotImplemented(); 361 NotImplemented();
482} 362}
483 363
484void EmitSharedAtomicIAdd32(EmitContext& ctx, std::string_view pointer_offset, 364void EmitSharedAtomicIAdd32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarU32 value) {
485 std::string_view value) {
486 NotImplemented(); 365 NotImplemented();
487} 366}
488 367
489void EmitSharedAtomicSMin32(EmitContext& ctx, std::string_view pointer_offset, 368void EmitSharedAtomicSMin32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarS32 value) {
490 std::string_view value) {
491 NotImplemented(); 369 NotImplemented();
492} 370}
493 371
494void EmitSharedAtomicUMin32(EmitContext& ctx, std::string_view pointer_offset, 372void EmitSharedAtomicUMin32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarU32 value) {
495 std::string_view value) {
496 NotImplemented(); 373 NotImplemented();
497} 374}
498 375
499void EmitSharedAtomicSMax32(EmitContext& ctx, std::string_view pointer_offset, 376void EmitSharedAtomicSMax32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarS32 value) {
500 std::string_view value) {
501 NotImplemented(); 377 NotImplemented();
502} 378}
503 379
504void EmitSharedAtomicUMax32(EmitContext& ctx, std::string_view pointer_offset, 380void EmitSharedAtomicUMax32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarU32 value) {
505 std::string_view value) {
506 NotImplemented(); 381 NotImplemented();
507} 382}
508 383
509void EmitSharedAtomicInc32(EmitContext& ctx, std::string_view pointer_offset, 384void EmitSharedAtomicInc32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarU32 value) {
510 std::string_view value) {
511 NotImplemented(); 385 NotImplemented();
512} 386}
513 387
514void EmitSharedAtomicDec32(EmitContext& ctx, std::string_view pointer_offset, 388void EmitSharedAtomicDec32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarU32 value) {
515 std::string_view value) {
516 NotImplemented(); 389 NotImplemented();
517} 390}
518 391
519void EmitSharedAtomicAnd32(EmitContext& ctx, std::string_view pointer_offset, 392void EmitSharedAtomicAnd32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarU32 value) {
520 std::string_view value) {
521 NotImplemented(); 393 NotImplemented();
522} 394}
523 395
524void EmitSharedAtomicOr32(EmitContext& ctx, std::string_view pointer_offset, 396void EmitSharedAtomicOr32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarU32 value) {
525 std::string_view value) {
526 NotImplemented(); 397 NotImplemented();
527} 398}
528 399
529void EmitSharedAtomicXor32(EmitContext& ctx, std::string_view pointer_offset, 400void EmitSharedAtomicXor32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarU32 value) {
530 std::string_view value) {
531 NotImplemented(); 401 NotImplemented();
532} 402}
533 403
534void EmitSharedAtomicExchange32(EmitContext& ctx, std::string_view pointer_offset, 404void EmitSharedAtomicExchange32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarU32 value) {
535 std::string_view value) {
536 NotImplemented(); 405 NotImplemented();
537} 406}
538 407
539void EmitSharedAtomicExchange64(EmitContext& ctx, std::string_view pointer_offset, 408void EmitSharedAtomicExchange64(EmitContext& ctx, ScalarU32 pointer_offset, Register value) {
540 std::string_view value) {
541 NotImplemented(); 409 NotImplemented();
542} 410}
543 411
544void EmitStorageAtomicIAdd32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 412void EmitStorageAtomicIAdd32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
545 std::string_view value) { 413 ScalarU32 value) {
546 NotImplemented(); 414 NotImplemented();
547} 415}
548 416
549void EmitStorageAtomicSMin32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 417void EmitStorageAtomicSMin32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
550 std::string_view value) { 418 ScalarS32 value) {
551 NotImplemented(); 419 NotImplemented();
552} 420}
553 421
554void EmitStorageAtomicUMin32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 422void EmitStorageAtomicUMin32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
555 std::string_view value) { 423 ScalarU32 value) {
556 NotImplemented(); 424 NotImplemented();
557} 425}
558 426
559void EmitStorageAtomicSMax32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 427void EmitStorageAtomicSMax32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
560 std::string_view value) { 428 ScalarS32 value) {
561 NotImplemented(); 429 NotImplemented();
562} 430}
563 431
564void EmitStorageAtomicUMax32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 432void EmitStorageAtomicUMax32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
565 std::string_view value) { 433 ScalarU32 value) {
566 NotImplemented(); 434 NotImplemented();
567} 435}
568 436
569void EmitStorageAtomicInc32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 437void EmitStorageAtomicInc32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
570 std::string_view value) { 438 ScalarU32 value) {
571 NotImplemented(); 439 NotImplemented();
572} 440}
573 441
574void EmitStorageAtomicDec32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 442void EmitStorageAtomicDec32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
575 std::string_view value) { 443 ScalarU32 value) {
576 NotImplemented(); 444 NotImplemented();
577} 445}
578 446
579void EmitStorageAtomicAnd32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 447void EmitStorageAtomicAnd32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
580 std::string_view value) { 448 ScalarU32 value) {
581 NotImplemented(); 449 NotImplemented();
582} 450}
583 451
584void EmitStorageAtomicOr32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 452void EmitStorageAtomicOr32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
585 std::string_view value) { 453 ScalarU32 value) {
586 NotImplemented(); 454 NotImplemented();
587} 455}
588 456
589void EmitStorageAtomicXor32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 457void EmitStorageAtomicXor32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
590 std::string_view value) { 458 ScalarU32 value) {
591 NotImplemented(); 459 NotImplemented();
592} 460}
593 461
594void EmitStorageAtomicExchange32(EmitContext& ctx, const IR::Value& binding, 462void EmitStorageAtomicExchange32(EmitContext& ctx, const IR::Value& binding,
595 const IR::Value& offset, std::string_view value) { 463 const IR::Value& offset, ScalarU32 value) {
596 NotImplemented(); 464 NotImplemented();
597} 465}
598 466
599void EmitStorageAtomicIAdd64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 467void EmitStorageAtomicIAdd64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
600 std::string_view value) { 468 Register value) {
601 NotImplemented(); 469 NotImplemented();
602} 470}
603 471
604void EmitStorageAtomicSMin64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 472void EmitStorageAtomicSMin64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
605 std::string_view value) { 473 Register value) {
606 NotImplemented(); 474 NotImplemented();
607} 475}
608 476
609void EmitStorageAtomicUMin64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 477void EmitStorageAtomicUMin64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
610 std::string_view value) { 478 Register value) {
611 NotImplemented(); 479 NotImplemented();
612} 480}
613 481
614void EmitStorageAtomicSMax64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 482void EmitStorageAtomicSMax64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
615 std::string_view value) { 483 Register value) {
616 NotImplemented(); 484 NotImplemented();
617} 485}
618 486
619void EmitStorageAtomicUMax64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 487void EmitStorageAtomicUMax64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
620 std::string_view value) { 488 Register value) {
621 NotImplemented(); 489 NotImplemented();
622} 490}
623 491
624void EmitStorageAtomicAnd64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 492void EmitStorageAtomicAnd64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
625 std::string_view value) { 493 Register value) {
626 NotImplemented(); 494 NotImplemented();
627} 495}
628 496
629void EmitStorageAtomicOr64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 497void EmitStorageAtomicOr64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
630 std::string_view value) { 498 Register value) {
631 NotImplemented(); 499 NotImplemented();
632} 500}
633 501
634void EmitStorageAtomicXor64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 502void EmitStorageAtomicXor64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
635 std::string_view value) { 503 Register value) {
636 NotImplemented(); 504 NotImplemented();
637} 505}
638 506
639void EmitStorageAtomicExchange64(EmitContext& ctx, const IR::Value& binding, 507void EmitStorageAtomicExchange64(EmitContext& ctx, const IR::Value& binding,
640 const IR::Value& offset, std::string_view value) { 508 const IR::Value& offset, Register value) {
641 NotImplemented(); 509 NotImplemented();
642} 510}
643 511
644void EmitStorageAtomicAddF32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 512void EmitStorageAtomicAddF32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
645 std::string_view value) { 513 ScalarF32 value) {
646 NotImplemented(); 514 NotImplemented();
647} 515}
648 516
649void EmitStorageAtomicAddF16x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 517void EmitStorageAtomicAddF16x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
650 std::string_view value) { 518 Register value) {
651 NotImplemented(); 519 NotImplemented();
652} 520}
653 521
654void EmitStorageAtomicAddF32x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 522void EmitStorageAtomicAddF32x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
655 std::string_view value) { 523 Register value) {
656 NotImplemented(); 524 NotImplemented();
657} 525}
658 526
659void EmitStorageAtomicMinF16x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 527void EmitStorageAtomicMinF16x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
660 std::string_view value) { 528 Register value) {
661 NotImplemented(); 529 NotImplemented();
662} 530}
663 531
664void EmitStorageAtomicMinF32x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 532void EmitStorageAtomicMinF32x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
665 std::string_view value) { 533 Register value) {
666 NotImplemented(); 534 NotImplemented();
667} 535}
668 536
669void EmitStorageAtomicMaxF16x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 537void EmitStorageAtomicMaxF16x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
670 std::string_view value) { 538 Register value) {
671 NotImplemented(); 539 NotImplemented();
672} 540}
673 541
674void EmitStorageAtomicMaxF32x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, 542void EmitStorageAtomicMaxF32x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset,
675 std::string_view value) { 543 Register value) {
676 NotImplemented(); 544 NotImplemented();
677} 545}
678 546
@@ -792,211 +660,211 @@ void EmitGlobalAtomicMaxF32x2(EmitContext& ctx) {
792 NotImplemented(); 660 NotImplemented();
793} 661}
794 662
795void EmitLogicalOr(EmitContext& ctx, std::string_view a, std::string_view b) { 663void EmitLogicalOr(EmitContext& ctx, ScalarS32 a, ScalarS32 b) {
796 NotImplemented(); 664 NotImplemented();
797} 665}
798 666
799void EmitLogicalAnd(EmitContext& ctx, std::string_view a, std::string_view b) { 667void EmitLogicalAnd(EmitContext& ctx, ScalarS32 a, ScalarS32 b) {
800 NotImplemented(); 668 NotImplemented();
801} 669}
802 670
803void EmitLogicalXor(EmitContext& ctx, std::string_view a, std::string_view b) { 671void EmitLogicalXor(EmitContext& ctx, ScalarS32 a, ScalarS32 b) {
804 NotImplemented(); 672 NotImplemented();
805} 673}
806 674
807void EmitLogicalNot(EmitContext& ctx, std::string_view value) { 675void EmitLogicalNot(EmitContext& ctx, ScalarS32 value) {
808 NotImplemented(); 676 NotImplemented();
809} 677}
810 678
811void EmitConvertS16F16(EmitContext& ctx, std::string_view value) { 679void EmitConvertS16F16(EmitContext& ctx, Register value) {
812 NotImplemented(); 680 NotImplemented();
813} 681}
814 682
815void EmitConvertS16F32(EmitContext& ctx, std::string_view value) { 683void EmitConvertS16F32(EmitContext& ctx, Register value) {
816 NotImplemented(); 684 NotImplemented();
817} 685}
818 686
819void EmitConvertS16F64(EmitContext& ctx, std::string_view value) { 687void EmitConvertS16F64(EmitContext& ctx, Register value) {
820 NotImplemented(); 688 NotImplemented();
821} 689}
822 690
823void EmitConvertS32F16(EmitContext& ctx, std::string_view value) { 691void EmitConvertS32F16(EmitContext& ctx, Register value) {
824 NotImplemented(); 692 NotImplemented();
825} 693}
826 694
827void EmitConvertS32F32(EmitContext& ctx, std::string_view value) { 695void EmitConvertS32F32(EmitContext& ctx, Register value) {
828 NotImplemented(); 696 NotImplemented();
829} 697}
830 698
831void EmitConvertS32F64(EmitContext& ctx, std::string_view value) { 699void EmitConvertS32F64(EmitContext& ctx, Register value) {
832 NotImplemented(); 700 NotImplemented();
833} 701}
834 702
835void EmitConvertS64F16(EmitContext& ctx, std::string_view value) { 703void EmitConvertS64F16(EmitContext& ctx, Register value) {
836 NotImplemented(); 704 NotImplemented();
837} 705}
838 706
839void EmitConvertS64F32(EmitContext& ctx, std::string_view value) { 707void EmitConvertS64F32(EmitContext& ctx, Register value) {
840 NotImplemented(); 708 NotImplemented();
841} 709}
842 710
843void EmitConvertS64F64(EmitContext& ctx, std::string_view value) { 711void EmitConvertS64F64(EmitContext& ctx, Register value) {
844 NotImplemented(); 712 NotImplemented();
845} 713}
846 714
847void EmitConvertU16F16(EmitContext& ctx, std::string_view value) { 715void EmitConvertU16F16(EmitContext& ctx, Register value) {
848 NotImplemented(); 716 NotImplemented();
849} 717}
850 718
851void EmitConvertU16F32(EmitContext& ctx, std::string_view value) { 719void EmitConvertU16F32(EmitContext& ctx, Register value) {
852 NotImplemented(); 720 NotImplemented();
853} 721}
854 722
855void EmitConvertU16F64(EmitContext& ctx, std::string_view value) { 723void EmitConvertU16F64(EmitContext& ctx, Register value) {
856 NotImplemented(); 724 NotImplemented();
857} 725}
858 726
859void EmitConvertU32F16(EmitContext& ctx, std::string_view value) { 727void EmitConvertU32F16(EmitContext& ctx, Register value) {
860 NotImplemented(); 728 NotImplemented();
861} 729}
862 730
863void EmitConvertU32F32(EmitContext& ctx, std::string_view value) { 731void EmitConvertU32F32(EmitContext& ctx, Register value) {
864 NotImplemented(); 732 NotImplemented();
865} 733}
866 734
867void EmitConvertU32F64(EmitContext& ctx, std::string_view value) { 735void EmitConvertU32F64(EmitContext& ctx, Register value) {
868 NotImplemented(); 736 NotImplemented();
869} 737}
870 738
871void EmitConvertU64F16(EmitContext& ctx, std::string_view value) { 739void EmitConvertU64F16(EmitContext& ctx, Register value) {
872 NotImplemented(); 740 NotImplemented();
873} 741}
874 742
875void EmitConvertU64F32(EmitContext& ctx, std::string_view value) { 743void EmitConvertU64F32(EmitContext& ctx, Register value) {
876 NotImplemented(); 744 NotImplemented();
877} 745}
878 746
879void EmitConvertU64F64(EmitContext& ctx, std::string_view value) { 747void EmitConvertU64F64(EmitContext& ctx, Register value) {
880 NotImplemented(); 748 NotImplemented();
881} 749}
882 750
883void EmitConvertU64U32(EmitContext& ctx, std::string_view value) { 751void EmitConvertU64U32(EmitContext& ctx, Register value) {
884 NotImplemented(); 752 NotImplemented();
885} 753}
886 754
887void EmitConvertU32U64(EmitContext& ctx, std::string_view value) { 755void EmitConvertU32U64(EmitContext& ctx, Register value) {
888 NotImplemented(); 756 NotImplemented();
889} 757}
890 758
891void EmitConvertF16F32(EmitContext& ctx, std::string_view value) { 759void EmitConvertF16F32(EmitContext& ctx, Register value) {
892 NotImplemented(); 760 NotImplemented();
893} 761}
894 762
895void EmitConvertF32F16(EmitContext& ctx, std::string_view value) { 763void EmitConvertF32F16(EmitContext& ctx, Register value) {
896 NotImplemented(); 764 NotImplemented();
897} 765}
898 766
899void EmitConvertF32F64(EmitContext& ctx, std::string_view value) { 767void EmitConvertF32F64(EmitContext& ctx, Register value) {
900 NotImplemented(); 768 NotImplemented();
901} 769}
902 770
903void EmitConvertF64F32(EmitContext& ctx, std::string_view value) { 771void EmitConvertF64F32(EmitContext& ctx, Register value) {
904 NotImplemented(); 772 NotImplemented();
905} 773}
906 774
907void EmitConvertF16S8(EmitContext& ctx, std::string_view value) { 775void EmitConvertF16S8(EmitContext& ctx, Register value) {
908 NotImplemented(); 776 NotImplemented();
909} 777}
910 778
911void EmitConvertF16S16(EmitContext& ctx, std::string_view value) { 779void EmitConvertF16S16(EmitContext& ctx, Register value) {
912 NotImplemented(); 780 NotImplemented();
913} 781}
914 782
915void EmitConvertF16S32(EmitContext& ctx, std::string_view value) { 783void EmitConvertF16S32(EmitContext& ctx, Register value) {
916 NotImplemented(); 784 NotImplemented();
917} 785}
918 786
919void EmitConvertF16S64(EmitContext& ctx, std::string_view value) { 787void EmitConvertF16S64(EmitContext& ctx, Register value) {
920 NotImplemented(); 788 NotImplemented();
921} 789}
922 790
923void EmitConvertF16U8(EmitContext& ctx, std::string_view value) { 791void EmitConvertF16U8(EmitContext& ctx, Register value) {
924 NotImplemented(); 792 NotImplemented();
925} 793}
926 794
927void EmitConvertF16U16(EmitContext& ctx, std::string_view value) { 795void EmitConvertF16U16(EmitContext& ctx, Register value) {
928 NotImplemented(); 796 NotImplemented();
929} 797}
930 798
931void EmitConvertF16U32(EmitContext& ctx, std::string_view value) { 799void EmitConvertF16U32(EmitContext& ctx, Register value) {
932 NotImplemented(); 800 NotImplemented();
933} 801}
934 802
935void EmitConvertF16U64(EmitContext& ctx, std::string_view value) { 803void EmitConvertF16U64(EmitContext& ctx, Register value) {
936 NotImplemented(); 804 NotImplemented();
937} 805}
938 806
939void EmitConvertF32S8(EmitContext& ctx, std::string_view value) { 807void EmitConvertF32S8(EmitContext& ctx, Register value) {
940 NotImplemented(); 808 NotImplemented();
941} 809}
942 810
943void EmitConvertF32S16(EmitContext& ctx, std::string_view value) { 811void EmitConvertF32S16(EmitContext& ctx, Register value) {
944 NotImplemented(); 812 NotImplemented();
945} 813}
946 814
947void EmitConvertF32S32(EmitContext& ctx, std::string_view value) { 815void EmitConvertF32S32(EmitContext& ctx, Register value) {
948 NotImplemented(); 816 NotImplemented();
949} 817}
950 818
951void EmitConvertF32S64(EmitContext& ctx, std::string_view value) { 819void EmitConvertF32S64(EmitContext& ctx, Register value) {
952 NotImplemented(); 820 NotImplemented();
953} 821}
954 822
955void EmitConvertF32U8(EmitContext& ctx, std::string_view value) { 823void EmitConvertF32U8(EmitContext& ctx, Register value) {
956 NotImplemented(); 824 NotImplemented();
957} 825}
958 826
959void EmitConvertF32U16(EmitContext& ctx, std::string_view value) { 827void EmitConvertF32U16(EmitContext& ctx, Register value) {
960 NotImplemented(); 828 NotImplemented();
961} 829}
962 830
963void EmitConvertF32U32(EmitContext& ctx, std::string_view value) { 831void EmitConvertF32U32(EmitContext& ctx, Register value) {
964 NotImplemented(); 832 NotImplemented();
965} 833}
966 834
967void EmitConvertF32U64(EmitContext& ctx, std::string_view value) { 835void EmitConvertF32U64(EmitContext& ctx, Register value) {
968 NotImplemented(); 836 NotImplemented();
969} 837}
970 838
971void EmitConvertF64S8(EmitContext& ctx, std::string_view value) { 839void EmitConvertF64S8(EmitContext& ctx, Register value) {
972 NotImplemented(); 840 NotImplemented();
973} 841}
974 842
975void EmitConvertF64S16(EmitContext& ctx, std::string_view value) { 843void EmitConvertF64S16(EmitContext& ctx, Register value) {
976 NotImplemented(); 844 NotImplemented();
977} 845}
978 846
979void EmitConvertF64S32(EmitContext& ctx, std::string_view value) { 847void EmitConvertF64S32(EmitContext& ctx, Register value) {
980 NotImplemented(); 848 NotImplemented();
981} 849}
982 850
983void EmitConvertF64S64(EmitContext& ctx, std::string_view value) { 851void EmitConvertF64S64(EmitContext& ctx, Register value) {
984 NotImplemented(); 852 NotImplemented();
985} 853}
986 854
987void EmitConvertF64U8(EmitContext& ctx, std::string_view value) { 855void EmitConvertF64U8(EmitContext& ctx, Register value) {
988 NotImplemented(); 856 NotImplemented();
989} 857}
990 858
991void EmitConvertF64U16(EmitContext& ctx, std::string_view value) { 859void EmitConvertF64U16(EmitContext& ctx, Register value) {
992 NotImplemented(); 860 NotImplemented();
993} 861}
994 862
995void EmitConvertF64U32(EmitContext& ctx, std::string_view value) { 863void EmitConvertF64U32(EmitContext& ctx, Register value) {
996 NotImplemented(); 864 NotImplemented();
997} 865}
998 866
999void EmitConvertF64U64(EmitContext& ctx, std::string_view value) { 867void EmitConvertF64U64(EmitContext& ctx, Register value) {
1000 NotImplemented(); 868 NotImplemented();
1001} 869}
1002 870
@@ -1097,69 +965,62 @@ void EmitBoundImageWrite(EmitContext&) {
1097} 965}
1098 966
1099void EmitImageSampleImplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 967void EmitImageSampleImplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
1100 std::string_view coords, std::string_view bias_lc, 968 Register coords, Register bias_lc, const IR::Value& offset) {
1101 const IR::Value& offset) {
1102 NotImplemented(); 969 NotImplemented();
1103} 970}
1104 971
1105void EmitImageSampleExplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 972void EmitImageSampleExplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
1106 std::string_view coords, std::string_view lod_lc, 973 Register coords, Register lod_lc, const IR::Value& offset) {
1107 const IR::Value& offset) {
1108 NotImplemented(); 974 NotImplemented();
1109} 975}
1110 976
1111void EmitImageSampleDrefImplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 977void EmitImageSampleDrefImplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
1112 std::string_view coords, std::string_view dref, 978 Register coords, Register dref, Register bias_lc,
1113 std::string_view bias_lc, const IR::Value& offset) { 979 const IR::Value& offset) {
1114 NotImplemented(); 980 NotImplemented();
1115} 981}
1116 982
1117void EmitImageSampleDrefExplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 983void EmitImageSampleDrefExplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
1118 std::string_view coords, std::string_view dref, 984 Register coords, Register dref, Register lod_lc,
1119 std::string_view lod_lc, const IR::Value& offset) { 985 const IR::Value& offset) {
1120 NotImplemented(); 986 NotImplemented();
1121} 987}
1122 988
1123void EmitImageGather(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 989void EmitImageGather(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords,
1124 std::string_view coords, const IR::Value& offset, const IR::Value& offset2) { 990 const IR::Value& offset, const IR::Value& offset2) {
1125 NotImplemented(); 991 NotImplemented();
1126} 992}
1127 993
1128void EmitImageGatherDref(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 994void EmitImageGatherDref(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords,
1129 std::string_view coords, const IR::Value& offset, const IR::Value& offset2, 995 const IR::Value& offset, const IR::Value& offset2, Register dref) {
1130 std::string_view dref) {
1131 NotImplemented(); 996 NotImplemented();
1132} 997}
1133 998
1134void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 999void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords,
1135 std::string_view coords, std::string_view offset, std::string_view lod, 1000 Register offset, Register lod, Register ms) {
1136 std::string_view ms) {
1137 NotImplemented(); 1001 NotImplemented();
1138} 1002}
1139 1003
1140void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 1004void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
1141 std::string_view lod) { 1005 Register lod) {
1142 NotImplemented(); 1006 NotImplemented();
1143} 1007}
1144 1008
1145void EmitImageQueryLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 1009void EmitImageQueryLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords) {
1146 std::string_view coords) {
1147 NotImplemented(); 1010 NotImplemented();
1148} 1011}
1149 1012
1150void EmitImageGradient(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 1013void EmitImageGradient(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords,
1151 std::string_view coords, std::string_view derivates, std::string_view offset, 1014 Register derivates, Register offset, Register lod_clamp) {
1152 std::string_view lod_clamp) {
1153 NotImplemented(); 1015 NotImplemented();
1154} 1016}
1155 1017
1156void EmitImageRead(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 1018void EmitImageRead(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords) {
1157 std::string_view coords) {
1158 NotImplemented(); 1019 NotImplemented();
1159} 1020}
1160 1021
1161void EmitImageWrite(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 1022void EmitImageWrite(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords,
1162 std::string_view coords, std::string_view color) { 1023 Register color) {
1163 NotImplemented(); 1024 NotImplemented();
1164} 1025}
1165 1026
@@ -1252,57 +1113,57 @@ void EmitBoundImageAtomicExchange32(EmitContext&) {
1252} 1113}
1253 1114
1254void EmitImageAtomicIAdd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 1115void EmitImageAtomicIAdd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
1255 std::string_view coords, std::string_view value) { 1116 Register coords, ScalarU32 value) {
1256 NotImplemented(); 1117 NotImplemented();
1257} 1118}
1258 1119
1259void EmitImageAtomicSMin32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 1120void EmitImageAtomicSMin32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
1260 std::string_view coords, std::string_view value) { 1121 Register coords, ScalarS32 value) {
1261 NotImplemented(); 1122 NotImplemented();
1262} 1123}
1263 1124
1264void EmitImageAtomicUMin32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 1125void EmitImageAtomicUMin32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
1265 std::string_view coords, std::string_view value) { 1126 Register coords, ScalarU32 value) {
1266 NotImplemented(); 1127 NotImplemented();
1267} 1128}
1268 1129
1269void EmitImageAtomicSMax32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 1130void EmitImageAtomicSMax32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
1270 std::string_view coords, std::string_view value) { 1131 Register coords, ScalarS32 value) {
1271 NotImplemented(); 1132 NotImplemented();
1272} 1133}
1273 1134
1274void EmitImageAtomicUMax32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 1135void EmitImageAtomicUMax32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
1275 std::string_view coords, std::string_view value) { 1136 Register coords, ScalarU32 value) {
1276 NotImplemented(); 1137 NotImplemented();
1277} 1138}
1278 1139
1279void EmitImageAtomicInc32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 1140void EmitImageAtomicInc32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords,
1280 std::string_view coords, std::string_view value) { 1141 ScalarU32 value) {
1281 NotImplemented(); 1142 NotImplemented();
1282} 1143}
1283 1144
1284void EmitImageAtomicDec32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 1145void EmitImageAtomicDec32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords,
1285 std::string_view coords, std::string_view value) { 1146 ScalarU32 value) {
1286 NotImplemented(); 1147 NotImplemented();
1287} 1148}
1288 1149
1289void EmitImageAtomicAnd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 1150void EmitImageAtomicAnd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords,
1290 std::string_view coords, std::string_view value) { 1151 ScalarU32 value) {
1291 NotImplemented(); 1152 NotImplemented();
1292} 1153}
1293 1154
1294void EmitImageAtomicOr32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 1155void EmitImageAtomicOr32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords,
1295 std::string_view coords, std::string_view value) { 1156 ScalarU32 value) {
1296 NotImplemented(); 1157 NotImplemented();
1297} 1158}
1298 1159
1299void EmitImageAtomicXor32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 1160void EmitImageAtomicXor32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coords,
1300 std::string_view coords, std::string_view value) { 1161 ScalarU32 value) {
1301 NotImplemented(); 1162 NotImplemented();
1302} 1163}
1303 1164
1304void EmitImageAtomicExchange32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 1165void EmitImageAtomicExchange32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
1305 std::string_view coords, std::string_view value) { 1166 Register coords, ScalarU32 value) {
1306 NotImplemented(); 1167 NotImplemented();
1307} 1168}
1308 1169
@@ -1310,19 +1171,19 @@ void EmitLaneId(EmitContext& ctx) {
1310 NotImplemented(); 1171 NotImplemented();
1311} 1172}
1312 1173
1313void EmitVoteAll(EmitContext& ctx, std::string_view pred) { 1174void EmitVoteAll(EmitContext& ctx, ScalarS32 pred) {
1314 NotImplemented(); 1175 NotImplemented();
1315} 1176}
1316 1177
1317void EmitVoteAny(EmitContext& ctx, std::string_view pred) { 1178void EmitVoteAny(EmitContext& ctx, ScalarS32 pred) {
1318 NotImplemented(); 1179 NotImplemented();
1319} 1180}
1320 1181
1321void EmitVoteEqual(EmitContext& ctx, std::string_view pred) { 1182void EmitVoteEqual(EmitContext& ctx, ScalarS32 pred) {
1322 NotImplemented(); 1183 NotImplemented();
1323} 1184}
1324 1185
1325void EmitSubgroupBallot(EmitContext& ctx, std::string_view pred) { 1186void EmitSubgroupBallot(EmitContext& ctx, ScalarS32 pred) {
1326 NotImplemented(); 1187 NotImplemented();
1327} 1188}
1328 1189
@@ -1346,47 +1207,43 @@ void EmitSubgroupGeMask(EmitContext& ctx) {
1346 NotImplemented(); 1207 NotImplemented();
1347} 1208}
1348 1209
1349void EmitShuffleIndex(EmitContext& ctx, IR::Inst& inst, std::string_view value, 1210void EmitShuffleIndex(EmitContext& ctx, IR::Inst& inst, ScalarU32 value, ScalarU32 index,
1350 std::string_view index, std::string_view clamp, 1211 ScalarU32 clamp, ScalarU32 segmentation_mask) {
1351 std::string_view segmentation_mask) {
1352 NotImplemented(); 1212 NotImplemented();
1353} 1213}
1354 1214
1355void EmitShuffleUp(EmitContext& ctx, IR::Inst& inst, std::string_view value, std::string_view index, 1215void EmitShuffleUp(EmitContext& ctx, IR::Inst& inst, ScalarU32 value, ScalarU32 index,
1356 std::string_view clamp, std::string_view segmentation_mask) { 1216 ScalarU32 clamp, ScalarU32 segmentation_mask) {
1357 NotImplemented(); 1217 NotImplemented();
1358} 1218}
1359 1219
1360void EmitShuffleDown(EmitContext& ctx, IR::Inst& inst, std::string_view value, 1220void EmitShuffleDown(EmitContext& ctx, IR::Inst& inst, ScalarU32 value, ScalarU32 index,
1361 std::string_view index, std::string_view clamp, 1221 ScalarU32 clamp, ScalarU32 segmentation_mask) {
1362 std::string_view segmentation_mask) {
1363 NotImplemented(); 1222 NotImplemented();
1364} 1223}
1365 1224
1366void EmitShuffleButterfly(EmitContext& ctx, IR::Inst& inst, std::string_view value, 1225void EmitShuffleButterfly(EmitContext& ctx, IR::Inst& inst, ScalarU32 value, ScalarU32 index,
1367 std::string_view index, std::string_view clamp, 1226 ScalarU32 clamp, ScalarU32 segmentation_mask) {
1368 std::string_view segmentation_mask) {
1369 NotImplemented(); 1227 NotImplemented();
1370} 1228}
1371 1229
1372void EmitFSwizzleAdd(EmitContext& ctx, std::string_view op_a, std::string_view op_b, 1230void EmitFSwizzleAdd(EmitContext& ctx, ScalarF32 op_a, ScalarF32 op_b, ScalarU32 swizzle) {
1373 std::string_view swizzle) {
1374 NotImplemented(); 1231 NotImplemented();
1375} 1232}
1376 1233
1377void EmitDPdxFine(EmitContext& ctx, std::string_view op_a) { 1234void EmitDPdxFine(EmitContext& ctx, ScalarF32 op_a) {
1378 NotImplemented(); 1235 NotImplemented();
1379} 1236}
1380 1237
1381void EmitDPdyFine(EmitContext& ctx, std::string_view op_a) { 1238void EmitDPdyFine(EmitContext& ctx, ScalarF32 op_a) {
1382 NotImplemented(); 1239 NotImplemented();
1383} 1240}
1384 1241
1385void EmitDPdxCoarse(EmitContext& ctx, std::string_view op_a) { 1242void EmitDPdxCoarse(EmitContext& ctx, ScalarF32 op_a) {
1386 NotImplemented(); 1243 NotImplemented();
1387} 1244}
1388 1245
1389void EmitDPdyCoarse(EmitContext& ctx, std::string_view op_a) { 1246void EmitDPdyCoarse(EmitContext& ctx, ScalarF32 op_a) {
1390 NotImplemented(); 1247 NotImplemented();
1391} 1248}
1392 1249
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_select.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_select.cpp
index 16f6c33f3..e69de29bb 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_select.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_select.cpp
@@ -1,46 +0,0 @@
1// Copyright 2021 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include <string_view>
6
7#include "shader_recompiler/backend/glasm/emit_context.h"
8#include "shader_recompiler/backend/glasm/emit_glasm_instructions.h"
9#include "shader_recompiler/frontend/ir/value.h"
10
11namespace Shader::Backend::GLASM {
12
13void EmitSelectU1(EmitContext&, std::string_view, std::string_view, std::string_view) {
14 throw NotImplementedException("GLASM instruction");
15}
16
17void EmitSelectU8(EmitContext&, std::string_view, std::string_view, std::string_view) {
18 throw NotImplementedException("GLASM instruction");
19}
20
21void EmitSelectU16(EmitContext&, std::string_view, std::string_view, std::string_view) {
22 throw NotImplementedException("GLASM instruction");
23}
24
25void EmitSelectU32(EmitContext& ctx, IR::Inst& inst, std::string_view cond,
26 std::string_view true_value, std::string_view false_value) {
27 ctx.Add("CMP.S {},{},{},{};", inst, cond, true_value, false_value);
28}
29
30void EmitSelectU64(EmitContext&, std::string_view, std::string_view, std::string_view) {
31 throw NotImplementedException("GLASM instruction");
32}
33
34void EmitSelectF16(EmitContext&, std::string_view, std::string_view, std::string_view) {
35 throw NotImplementedException("GLASM instruction");
36}
37
38void EmitSelectF32(EmitContext& ctx, IR::Inst& inst, std::string_view cond,
39 std::string_view true_value, std::string_view false_value) {
40 ctx.Add("CMP.S {},{},{},{};", inst, cond, true_value, false_value);
41}
42
43void EmitSelectF64(EmitContext&, std::string_view, std::string_view, std::string_view) {
44 throw NotImplementedException("GLASM instruction");
45}
46} // namespace Shader::Backend::GLASM
diff --git a/src/shader_recompiler/backend/glasm/reg_alloc.cpp b/src/shader_recompiler/backend/glasm/reg_alloc.cpp
index e198dd522..030b48d83 100644
--- a/src/shader_recompiler/backend/glasm/reg_alloc.cpp
+++ b/src/shader_recompiler/backend/glasm/reg_alloc.cpp
@@ -12,53 +12,61 @@
12#include "shader_recompiler/frontend/ir/value.h" 12#include "shader_recompiler/frontend/ir/value.h"
13 13
14namespace Shader::Backend::GLASM { 14namespace Shader::Backend::GLASM {
15namespace { 15
16std::string Representation(Id id) { 16Register RegAlloc::Define(IR::Inst& inst) {
17 if (id.is_condition_code != 0) { 17 const Id id{Alloc()};
18 throw NotImplementedException("Condition code"); 18 inst.SetDefinition<Id>(id);
19 } 19 Register ret;
20 if (id.is_spill != 0) { 20 ret.type = Type::Register;
21 throw NotImplementedException("Spilling"); 21 ret.id = id;
22 } 22 return ret;
23 const u32 index{static_cast<u32>(id.index)};
24 return fmt::format("R{}.x", index);
25} 23}
26 24
27std::string ImmValue(const IR::Value& value) { 25Value RegAlloc::Consume(const IR::Value& value) {
26 if (!value.IsImmediate()) {
27 return Consume(*value.InstRecursive());
28 }
29 Value ret;
28 switch (value.Type()) { 30 switch (value.Type()) {
29 case IR::Type::U1: 31 case IR::Type::U1:
30 return value.U1() ? "-1" : "0"; 32 ret.type = Type::U32;
33 ret.imm_u32 = value.U1() ? 0xffffffff : 0;
34 break;
31 case IR::Type::U32: 35 case IR::Type::U32:
32 return fmt::format("{}", value.U32()); 36 ret.type = Type::U32;
37 ret.imm_u32 = value.U32();
38 break;
33 case IR::Type::F32: 39 case IR::Type::F32:
34 return fmt::format("{}", value.F32()); 40 ret.type = Type::F32;
41 ret.imm_f32 = value.F32();
42 break;
35 default: 43 default:
36 throw NotImplementedException("Immediate type {}", value.Type()); 44 throw NotImplementedException("Immediate type {}", value.Type());
37 } 45 }
46 return ret;
38} 47}
39} // Anonymous namespace
40 48
41std::string RegAlloc::Define(IR::Inst& inst) { 49Register RegAlloc::AllocReg() {
42 const Id id{Alloc()}; 50 Register ret;
43 inst.SetDefinition<Id>(id); 51 ret.type = Type::Register;
44 return Representation(id); 52 ret.id = Alloc();
53 return ret;
45} 54}
46 55
47std::string RegAlloc::Consume(const IR::Value& value) { 56void RegAlloc::FreeReg(Register reg) {
48 if (value.IsImmediate()) { 57 Free(reg.id);
49 return ImmValue(value);
50 } else {
51 return Consume(*value.InstRecursive());
52 }
53} 58}
54 59
55std::string RegAlloc::Consume(IR::Inst& inst) { 60Value RegAlloc::Consume(IR::Inst& inst) {
56 const Id id{inst.Definition<Id>()}; 61 const Id id{inst.Definition<Id>()};
57 inst.DestructiveRemoveUsage(); 62 inst.DestructiveRemoveUsage();
58 if (!inst.HasUses()) { 63 if (!inst.HasUses()) {
59 Free(id); 64 Free(id);
60 } 65 }
61 return Representation(inst.Definition<Id>()); 66 Value ret;
67 ret.type = Type::Register;
68 ret.id = id;
69 return ret;
62} 70}
63 71
64Id RegAlloc::Alloc() { 72Id RegAlloc::Alloc() {
diff --git a/src/shader_recompiler/backend/glasm/reg_alloc.h b/src/shader_recompiler/backend/glasm/reg_alloc.h
index f73aa3348..ef0b6697f 100644
--- a/src/shader_recompiler/backend/glasm/reg_alloc.h
+++ b/src/shader_recompiler/backend/glasm/reg_alloc.h
@@ -6,8 +6,12 @@
6 6
7#include <bitset> 7#include <bitset>
8 8
9#include <fmt/format.h>
10
11#include "common/bit_cast.h"
9#include "common/bit_field.h" 12#include "common/bit_field.h"
10#include "common/common_types.h" 13#include "common/common_types.h"
14#include "shader_recompiler/exception.h"
11 15
12namespace Shader::IR { 16namespace Shader::IR {
13class Inst; 17class Inst;
@@ -18,6 +22,13 @@ namespace Shader::Backend::GLASM {
18 22
19class EmitContext; 23class EmitContext;
20 24
25enum class Type : u32 {
26 Register,
27 U32,
28 S32,
29 F32,
30};
31
21struct Id { 32struct Id {
22 union { 33 union {
23 u32 raw; 34 u32 raw;
@@ -25,15 +36,62 @@ struct Id {
25 BitField<30, 1, u32> is_spill; 36 BitField<30, 1, u32> is_spill;
26 BitField<31, 1, u32> is_condition_code; 37 BitField<31, 1, u32> is_condition_code;
27 }; 38 };
39
40 bool operator==(Id rhs) const noexcept {
41 return raw == rhs.raw;
42 }
43 bool operator!=(Id rhs) const noexcept {
44 return !operator==(rhs);
45 }
28}; 46};
47static_assert(sizeof(Id) == sizeof(u32));
48
49struct Value {
50 Type type;
51 union {
52 Id id;
53 u32 imm_u32;
54 s32 imm_s32;
55 f32 imm_f32;
56 };
57
58 bool operator==(const Value& rhs) const noexcept {
59 if (type != rhs.type) {
60 return false;
61 }
62 switch (type) {
63 case Type::Register:
64 return id == rhs.id;
65 case Type::U32:
66 return imm_u32 == rhs.imm_u32;
67 case Type::S32:
68 return imm_s32 == rhs.imm_s32;
69 case Type::F32:
70 return Common::BitCast<u32>(imm_f32) == Common::BitCast<u32>(rhs.imm_f32);
71 }
72 return false;
73 }
74 bool operator!=(const Value& rhs) const noexcept {
75 return !operator==(rhs);
76 }
77};
78struct Register : Value {};
79struct ScalarRegister : Value {};
80struct ScalarU32 : Value {};
81struct ScalarS32 : Value {};
82struct ScalarF32 : Value {};
29 83
30class RegAlloc { 84class RegAlloc {
31public: 85public:
32 RegAlloc(EmitContext& ctx_) : ctx{ctx_} {} 86 RegAlloc(EmitContext& ctx_) : ctx{ctx_} {}
33 87
34 std::string Define(IR::Inst& inst); 88 Register Define(IR::Inst& inst);
89
90 Value Consume(const IR::Value& value);
91
92 Register AllocReg();
35 93
36 std::string Consume(const IR::Value& value); 94 void FreeReg(Register reg);
37 95
38 [[nodiscard]] size_t NumUsedRegisters() const noexcept { 96 [[nodiscard]] size_t NumUsedRegisters() const noexcept {
39 return num_used_registers; 97 return num_used_registers;
@@ -43,16 +101,132 @@ private:
43 static constexpr size_t NUM_REGS = 4096; 101 static constexpr size_t NUM_REGS = 4096;
44 static constexpr size_t NUM_ELEMENTS = 4; 102 static constexpr size_t NUM_ELEMENTS = 4;
45 103
46 EmitContext& ctx; 104 Value Consume(IR::Inst& inst);
47
48 std::string Consume(IR::Inst& inst);
49 105
50 Id Alloc(); 106 Id Alloc();
51 107
52 void Free(Id id); 108 void Free(Id id);
53 109
110 EmitContext& ctx;
54 size_t num_used_registers{}; 111 size_t num_used_registers{};
55 std::bitset<NUM_REGS> register_use{}; 112 std::bitset<NUM_REGS> register_use{};
56}; 113};
57 114
115template <bool scalar, typename FormatContext>
116auto FormatTo(FormatContext& ctx, Id id) {
117 if (id.is_condition_code != 0) {
118 throw NotImplementedException("Condition code emission");
119 }
120 if (id.is_spill != 0) {
121 throw NotImplementedException("Spill emission");
122 }
123 if constexpr (scalar) {
124 return fmt::format_to(ctx.out(), "R{}.x", id.index.Value());
125 } else {
126 return fmt::format_to(ctx.out(), "R{}", id.index.Value());
127 }
128}
129
58} // namespace Shader::Backend::GLASM 130} // namespace Shader::Backend::GLASM
131
132template <>
133struct fmt::formatter<Shader::Backend::GLASM::Id> {
134 constexpr auto parse(format_parse_context& ctx) {
135 return ctx.begin();
136 }
137 template <typename FormatContext>
138 auto format(Shader::Backend::GLASM::Id id, FormatContext& ctx) {
139 return FormatTo<true>(ctx, id);
140 }
141};
142
143template <>
144struct fmt::formatter<Shader::Backend::GLASM::Register> {
145 constexpr auto parse(format_parse_context& ctx) {
146 return ctx.begin();
147 }
148 template <typename FormatContext>
149 auto format(const Shader::Backend::GLASM::Register& value, FormatContext& ctx) {
150 if (value.type != Shader::Backend::GLASM::Type::Register) {
151 throw Shader::InvalidArgument("Register value type is not register");
152 }
153 return FormatTo<false>(ctx, value.id);
154 }
155};
156
157template <>
158struct fmt::formatter<Shader::Backend::GLASM::ScalarRegister> {
159 constexpr auto parse(format_parse_context& ctx) {
160 return ctx.begin();
161 }
162 template <typename FormatContext>
163 auto format(const Shader::Backend::GLASM::ScalarRegister& value, FormatContext& ctx) {
164 if (value.type != Shader::Backend::GLASM::Type::Register) {
165 throw Shader::InvalidArgument("Register value type is not register");
166 }
167 return FormatTo<true>(ctx, value.id);
168 }
169};
170
171template <>
172struct fmt::formatter<Shader::Backend::GLASM::ScalarU32> {
173 constexpr auto parse(format_parse_context& ctx) {
174 return ctx.begin();
175 }
176 template <typename FormatContext>
177 auto format(const Shader::Backend::GLASM::ScalarU32& value, FormatContext& ctx) {
178 switch (value.type) {
179 case Shader::Backend::GLASM::Type::Register:
180 return FormatTo<true>(ctx, value.id);
181 case Shader::Backend::GLASM::Type::U32:
182 return fmt::format_to(ctx.out(), "{}", value.imm_u32);
183 case Shader::Backend::GLASM::Type::S32:
184 return fmt::format_to(ctx.out(), "{}", static_cast<u32>(value.imm_s32));
185 case Shader::Backend::GLASM::Type::F32:
186 return fmt::format_to(ctx.out(), "{}", Common::BitCast<u32>(value.imm_f32));
187 }
188 throw Shader::InvalidArgument("Invalid value type {}", value.type);
189 }
190};
191
192template <>
193struct fmt::formatter<Shader::Backend::GLASM::ScalarS32> {
194 constexpr auto parse(format_parse_context& ctx) {
195 return ctx.begin();
196 }
197 template <typename FormatContext>
198 auto format(const Shader::Backend::GLASM::ScalarS32& value, FormatContext& ctx) {
199 switch (value.type) {
200 case Shader::Backend::GLASM::Type::Register:
201 return FormatTo<true>(ctx, value.id);
202 case Shader::Backend::GLASM::Type::U32:
203 return fmt::format_to(ctx.out(), "{}", static_cast<s32>(value.imm_u32));
204 case Shader::Backend::GLASM::Type::S32:
205 return fmt::format_to(ctx.out(), "{}", value.imm_s32);
206 case Shader::Backend::GLASM::Type::F32:
207 return fmt::format_to(ctx.out(), "{}", Common::BitCast<s32>(value.imm_f32));
208 }
209 throw Shader::InvalidArgument("Invalid value type {}", value.type);
210 }
211};
212
213template <>
214struct fmt::formatter<Shader::Backend::GLASM::ScalarF32> {
215 constexpr auto parse(format_parse_context& ctx) {
216 return ctx.begin();
217 }
218 template <typename FormatContext>
219 auto format(const Shader::Backend::GLASM::ScalarF32& value, FormatContext& ctx) {
220 switch (value.type) {
221 case Shader::Backend::GLASM::Type::Register:
222 return FormatTo<true>(ctx, value.id);
223 case Shader::Backend::GLASM::Type::U32:
224 return fmt::format_to(ctx.out(), "{}", Common::BitCast<u32>(value.imm_u32));
225 case Shader::Backend::GLASM::Type::S32:
226 return fmt::format_to(ctx.out(), "{}", Common::BitCast<s32>(value.imm_s32));
227 case Shader::Backend::GLASM::Type::F32:
228 return fmt::format_to(ctx.out(), "{}", value.imm_f32);
229 }
230 throw Shader::InvalidArgument("Invalid value type {}", value.type);
231 }
232};