authorgravatar for alichraghi@proton.meAli Chraghi <alichraghi@proton.me> 2025-08-03 17:02:51+03:30
committergravatar for alichraghi@proton.meAli Chraghi <alichraghi@proton.me> 2025-08-04 07:05:00+03:30
logcd4b03c5ed1bc5b48ad9c353679b309ead75551d
treed1da1bcfac91d5ed55f977c7fae37dd947f92d49
parent246e1de55485b0b4e9392529778b8f50275e204a
signaturelock-open Commit is signed but in an unrecognized format.

spirv: define and use extended instruction set opcodes


7 files changed, 1504 insertions(+), 4206 deletions(-)

src/codegen/spirv/Assembler.zig+292-289
......@@ -16,7 +16,7 @@ const Assembler = @This();
1616cg: *CodeGen,
1717errors: std.ArrayListUnmanaged(ErrorMsg) = .empty,
1818src: []const u8 = undefined,
19/// `self.src` tokenized.
19/// `ass.src` tokenized.
2020tokens: std.ArrayListUnmanaged(Token) = .empty,
2121current_token: u32 = 0,
2222/// The instruction that is currently being parsed or has just been parsed.
......@@ -25,8 +25,8 @@ inst: struct {
2525 operands: std.ArrayListUnmanaged(Operand) = .empty,
2626 string_bytes: std.ArrayListUnmanaged(u8) = .empty,
2727
28 fn result(self: @This()) ?AsmValue.Ref {
29 for (self.operands.items[0..@min(self.operands.items.len, 2)]) |op| {
28 fn result(ass: @This()) ?AsmValue.Ref {
29 for (ass.operands.items[0..@min(ass.operands.items.len, 2)]) |op| {
3030 switch (op) {
3131 .result_id => |index| return index,
3232 else => {},
......@@ -55,42 +55,42 @@ const Operand = union(enum) {
5555 string: u32,
5656};
5757
58pub fn deinit(self: *Assembler) void {
59 const gpa = self.cg.module.gpa;
60 for (self.errors.items) |err| gpa.free(err.msg);
61 self.tokens.deinit(gpa);
62 self.errors.deinit(gpa);
63 self.inst.operands.deinit(gpa);
64 self.inst.string_bytes.deinit(gpa);
65 self.value_map.deinit(gpa);
66 self.inst_map.deinit(gpa);
58pub fn deinit(ass: *Assembler) void {
59 const gpa = ass.cg.module.gpa;
60 for (ass.errors.items) |err| gpa.free(err.msg);
61 ass.tokens.deinit(gpa);
62 ass.errors.deinit(gpa);
63 ass.inst.operands.deinit(gpa);
64 ass.inst.string_bytes.deinit(gpa);
65 ass.value_map.deinit(gpa);
66 ass.inst_map.deinit(gpa);
6767}
6868
6969const Error = error{ AssembleFail, OutOfMemory };
7070
71pub fn assemble(self: *Assembler, src: []const u8) Error!void {
72 const gpa = self.cg.module.gpa;
71pub fn assemble(ass: *Assembler, src: []const u8) Error!void {
72 const gpa = ass.cg.module.gpa;
7373
74 self.src = src;
75 self.errors.clearRetainingCapacity();
74 ass.src = src;
75 ass.errors.clearRetainingCapacity();
7676
7777 // Populate the opcode map if it isn't already
78 if (self.inst_map.count() == 0) {
78 if (ass.inst_map.count() == 0) {
7979 const instructions = spec.InstructionSet.core.instructions();
80 try self.inst_map.ensureUnusedCapacity(gpa, @intCast(instructions.len));
80 try ass.inst_map.ensureUnusedCapacity(gpa, @intCast(instructions.len));
8181 for (spec.InstructionSet.core.instructions(), 0..) |inst, i| {
82 const entry = try self.inst_map.getOrPut(gpa, inst.name);
82 const entry = try ass.inst_map.getOrPut(gpa, inst.name);
8383 assert(entry.index == i);
8484 }
8585 }
8686
87 try self.tokenize();
88 while (!self.testToken(.eof)) {
89 try self.parseInstruction();
90 try self.processInstruction();
87 try ass.tokenize();
88 while (!ass.testToken(.eof)) {
89 try ass.parseInstruction();
90 try ass.processInstruction();
9191 }
9292
93 if (self.errors.items.len > 0) return error.AssembleFail;
93 if (ass.errors.items.len > 0) return error.AssembleFail;
9494}
9595
9696const ErrorMsg = struct {
......@@ -99,23 +99,23 @@ const ErrorMsg = struct {
9999 msg: []const u8,
100100};
101101
102fn addError(self: *Assembler, offset: u32, comptime fmt: []const u8, args: anytype) !void {
103 const gpa = self.cg.module.gpa;
102fn addError(ass: *Assembler, offset: u32, comptime fmt: []const u8, args: anytype) !void {
103 const gpa = ass.cg.module.gpa;
104104 const msg = try std.fmt.allocPrint(gpa, fmt, args);
105105 errdefer gpa.free(msg);
106 try self.errors.append(gpa, .{
106 try ass.errors.append(gpa, .{
107107 .byte_offset = offset,
108108 .msg = msg,
109109 });
110110}
111111
112fn fail(self: *Assembler, offset: u32, comptime fmt: []const u8, args: anytype) Error {
113 try self.addError(offset, fmt, args);
112fn fail(ass: *Assembler, offset: u32, comptime fmt: []const u8, args: anytype) Error {
113 try ass.addError(offset, fmt, args);
114114 return error.AssembleFail;
115115}
116116
117fn todo(self: *Assembler, comptime fmt: []const u8, args: anytype) Error {
118 return self.fail(0, "todo: " ++ fmt, args);
117fn todo(ass: *Assembler, comptime fmt: []const u8, args: anytype) Error {
118 return ass.fail(0, "todo: " ++ fmt, args);
119119}
120120
121121const AsmValue = union(enum) {
......@@ -139,8 +139,8 @@ const AsmValue = union(enum) {
139139 /// Retrieve the result-id of this AsmValue. Asserts that this AsmValue
140140 /// is of a variant that allows the result to be obtained (not an unresolved
141141 /// forward declaration, not in the process of being declared, etc).
142 pub fn resultId(self: AsmValue) Id {
143 return switch (self) {
142 pub fn resultId(value: AsmValue) Id {
143 return switch (value) {
144144 .just_declared,
145145 .unresolved_forward_reference,
146146 // TODO: Lower this value as constant?
......@@ -153,61 +153,62 @@ const AsmValue = union(enum) {
153153 }
154154};
155155
156/// Attempt to process the instruction currently in `self.inst`.
156/// Attempt to process the instruction currently in `ass.inst`.
157157/// This for example emits the instruction in the module or function, or
158158/// records type definitions.
159159/// If this function returns `error.AssembleFail`, an explanatory
160/// error message has already been emitted into `self.errors`.
161fn processInstruction(self: *Assembler) !void {
162 const module = self.cg.module;
163 const result: AsmValue = switch (self.inst.opcode) {
160/// error message has already been emitted into `ass.errors`.
161fn processInstruction(ass: *Assembler) !void {
162 const module = ass.cg.module;
163 const result: AsmValue = switch (ass.inst.opcode) {
164164 .OpEntryPoint => {
165 return self.fail(self.currentToken().start, "cannot export entry points in assembly", .{});
165 return ass.fail(ass.currentToken().start, "cannot export entry points in assembly", .{});
166166 },
167167 .OpExecutionMode, .OpExecutionModeId => {
168 return self.fail(self.currentToken().start, "cannot set execution mode in assembly", .{});
168 return ass.fail(ass.currentToken().start, "cannot set execution mode in assembly", .{});
169169 },
170170 .OpCapability => {
171 try module.addCapability(@enumFromInt(self.inst.operands.items[0].value));
171 try module.addCapability(@enumFromInt(ass.inst.operands.items[0].value));
172172 return;
173173 },
174174 .OpExtension => {
175 const ext_name_offset = self.inst.operands.items[0].string;
176 const ext_name = std.mem.sliceTo(self.inst.string_bytes.items[ext_name_offset..], 0);
175 const ext_name_offset = ass.inst.operands.items[0].string;
176 const ext_name = std.mem.sliceTo(ass.inst.string_bytes.items[ext_name_offset..], 0);
177177 try module.addExtension(ext_name);
178178 return;
179179 },
180180 .OpExtInstImport => blk: {
181 const set_name_offset = self.inst.operands.items[1].string;
182 const set_name = std.mem.sliceTo(self.inst.string_bytes.items[set_name_offset..], 0);
181 const set_name_offset = ass.inst.operands.items[1].string;
182 const set_name = std.mem.sliceTo(ass.inst.string_bytes.items[set_name_offset..], 0);
183183 const set_tag = std.meta.stringToEnum(spec.InstructionSet, set_name) orelse {
184 return self.fail(set_name_offset, "unknown instruction set: {s}", .{set_name});
184 return ass.fail(set_name_offset, "unknown instruction set: {s}", .{set_name});
185185 };
186186 break :blk .{ .value = try module.importInstructionSet(set_tag) };
187187 },
188 else => switch (self.inst.opcode.class()) {
189 .type_declaration => try self.processTypeInstruction(),
190 else => (try self.processGenericInstruction()) orelse return,
188 else => switch (ass.inst.opcode.class()) {
189 .type_declaration => try ass.processTypeInstruction(),
190 else => (try ass.processGenericInstruction()) orelse return,
191191 },
192192 };
193193
194 const result_ref = self.inst.result().?;
195 switch (self.value_map.values()[result_ref]) {
196 .just_declared => self.value_map.values()[result_ref] = result,
194 const result_ref = ass.inst.result().?;
195 switch (ass.value_map.values()[result_ref]) {
196 .just_declared => ass.value_map.values()[result_ref] = result,
197197 else => {
198198 // TODO: Improve source location.
199 const name = self.value_map.keys()[result_ref];
200 return self.fail(0, "duplicate definition of %{s}", .{name});
199 const name = ass.value_map.keys()[result_ref];
200 return ass.fail(0, "duplicate definition of %{s}", .{name});
201201 },
202202 }
203203}
204204
205fn processTypeInstruction(self: *Assembler) !AsmValue {
206 const gpa = self.cg.module.gpa;
207 const module = self.cg.module;
208 const operands = self.inst.operands.items;
205fn processTypeInstruction(ass: *Assembler) !AsmValue {
206 const cg = ass.cg;
207 const gpa = cg.module.gpa;
208 const module = cg.module;
209 const operands = ass.inst.operands.items;
209210 const section = &module.sections.globals;
210 const id = switch (self.inst.opcode) {
211 const id = switch (ass.inst.opcode) {
211212 .OpTypeVoid => try module.voidType(),
212213 .OpTypeBool => try module.boolType(),
213214 .OpTypeInt => blk: {
......@@ -216,11 +217,11 @@ fn processTypeInstruction(self: *Assembler) !AsmValue {
216217 1 => .signed,
217218 else => {
218219 // TODO: Improve source location.
219 return self.fail(0, "{} is not a valid signedness (expected 0 or 1)", .{operands[2].literal32});
220 return ass.fail(0, "{} is not a valid signedness (expected 0 or 1)", .{operands[2].literal32});
220221 },
221222 };
222223 const width = std.math.cast(u16, operands[1].literal32) orelse {
223 return self.fail(0, "int type of {} bits is too large", .{operands[1].literal32});
224 return ass.fail(0, "int type of {} bits is too large", .{operands[1].literal32});
224225 };
225226 break :blk try module.intType(signedness, width);
226227 },
......@@ -229,22 +230,22 @@ fn processTypeInstruction(self: *Assembler) !AsmValue {
229230 switch (bits) {
230231 16, 32, 64 => {},
231232 else => {
232 return self.fail(0, "{} is not a valid bit count for floats (expected 16, 32 or 64)", .{bits});
233 return ass.fail(0, "{} is not a valid bit count for floats (expected 16, 32 or 64)", .{bits});
233234 },
234235 }
235236 break :blk try module.floatType(@intCast(bits));
236237 },
237238 .OpTypeVector => blk: {
238 const child_type = try self.resolveRefId(operands[1].ref_id);
239 const child_type = try ass.resolveRefId(operands[1].ref_id);
239240 break :blk try module.vectorType(operands[2].literal32, child_type);
240241 },
241242 .OpTypeArray => {
242243 // TODO: The length of an OpTypeArray is determined by a constant (which may be a spec constant),
243244 // and so some consideration must be taken when entering this in the type system.
244 return self.todo("process OpTypeArray", .{});
245 return ass.todo("process OpTypeArray", .{});
245246 },
246247 .OpTypeRuntimeArray => blk: {
247 const element_type = try self.resolveRefId(operands[1].ref_id);
248 const element_type = try ass.resolveRefId(operands[1].ref_id);
248249 const result_id = module.allocId();
249250 try section.emit(module.gpa, .OpTypeRuntimeArray, .{
250251 .id_result = result_id,
......@@ -254,7 +255,7 @@ fn processTypeInstruction(self: *Assembler) !AsmValue {
254255 },
255256 .OpTypePointer => blk: {
256257 const storage_class: StorageClass = @enumFromInt(operands[1].value);
257 const child_type = try self.resolveRefId(operands[2].ref_id);
258 const child_type = try ass.resolveRefId(operands[2].ref_id);
258259 const result_id = module.allocId();
259260 try section.emit(module.gpa, .OpTypePointer, .{
260261 .id_result = result_id,
......@@ -264,13 +265,14 @@ fn processTypeInstruction(self: *Assembler) !AsmValue {
264265 break :blk result_id;
265266 },
266267 .OpTypeStruct => blk: {
267 const ids = try gpa.alloc(Id, operands[1..].len);
268 defer gpa.free(ids);
269 for (operands[1..], ids) |op, *id| id.* = try self.resolveRefId(op.ref_id);
268 const scratch_top = cg.id_scratch.items.len;
269 defer cg.id_scratch.shrinkRetainingCapacity(scratch_top);
270 const ids = try cg.id_scratch.addManyAsSlice(gpa, operands[1..].len);
271 for (operands[1..], ids) |op, *id| id.* = try ass.resolveRefId(op.ref_id);
270272 break :blk try module.structType(ids, null, null, .none);
271273 },
272274 .OpTypeImage => blk: {
273 const sampled_type = try self.resolveRefId(operands[1].ref_id);
275 const sampled_type = try ass.resolveRefId(operands[1].ref_id);
274276 const result_id = module.allocId();
275277 try section.emit(gpa, .OpTypeImage, .{
276278 .id_result = result_id,
......@@ -290,19 +292,21 @@ fn processTypeInstruction(self: *Assembler) !AsmValue {
290292 break :blk result_id;
291293 },
292294 .OpTypeSampledImage => blk: {
293 const image_type = try self.resolveRefId(operands[1].ref_id);
295 const image_type = try ass.resolveRefId(operands[1].ref_id);
294296 const result_id = module.allocId();
295297 try section.emit(gpa, .OpTypeSampledImage, .{ .id_result = result_id, .image_type = image_type });
296298 break :blk result_id;
297299 },
298300 .OpTypeFunction => blk: {
299301 const param_operands = operands[2..];
300 const return_type = try self.resolveRefId(operands[1].ref_id);
302 const return_type = try ass.resolveRefId(operands[1].ref_id);
303
304 const scratch_top = cg.id_scratch.items.len;
305 defer cg.id_scratch.shrinkRetainingCapacity(scratch_top);
306 const param_types = try cg.id_scratch.addManyAsSlice(gpa, param_operands.len);
301307
302 const param_types = try module.gpa.alloc(Id, param_operands.len);
303 defer module.gpa.free(param_types);
304308 for (param_types, param_operands) |*param, operand| {
305 param.* = try self.resolveRefId(operand.ref_id);
309 param.* = try ass.resolveRefId(operand.ref_id);
306310 }
307311 const result_id = module.allocId();
308312 try section.emit(module.gpa, .OpTypeFunction, .{
......@@ -312,7 +316,7 @@ fn processTypeInstruction(self: *Assembler) !AsmValue {
312316 });
313317 break :blk result_id;
314318 },
315 else => return self.todo("process type instruction {s}", .{@tagName(self.inst.opcode)}),
319 else => return ass.todo("process type instruction {s}", .{@tagName(ass.inst.opcode)}),
316320 };
317321
318322 return .{ .ty = id };
......@@ -320,31 +324,30 @@ fn processTypeInstruction(self: *Assembler) !AsmValue {
320324
321325/// - No forward references are allowed in operands.
322326/// - Target section is determined from instruction type.
323fn processGenericInstruction(self: *Assembler) !?AsmValue {
324 const module = self.cg.module;
327fn processGenericInstruction(ass: *Assembler) !?AsmValue {
328 const module = ass.cg.module;
325329 const target = module.zcu.getTarget();
326 const operands = self.inst.operands.items;
330 const operands = ass.inst.operands.items;
327331 var maybe_spv_decl_index: ?Decl.Index = null;
328 const section = switch (self.inst.opcode.class()) {
332 const section = switch (ass.inst.opcode.class()) {
329333 .constant_creation => &module.sections.globals,
330334 .annotation => &module.sections.annotations,
331335 .type_declaration => unreachable, // Handled elsewhere.
332 else => switch (self.inst.opcode) {
336 else => switch (ass.inst.opcode) {
333337 .OpEntryPoint => unreachable,
334338 .OpExecutionMode, .OpExecutionModeId => &module.sections.execution_modes,
335339 .OpVariable => section: {
336340 const storage_class: spec.StorageClass = @enumFromInt(operands[2].value);
337 if (storage_class == .function) break :section &self.cg.prologue;
341 if (storage_class == .function) break :section &ass.cg.prologue;
338342 maybe_spv_decl_index = try module.allocDecl(.global);
339343 if (!target.cpu.has(.spirv, .v1_4) and storage_class != .input and storage_class != .output) {
340344 // Before version 1.4, the interface’s storage classes are limited to the Input and Output
341345 break :section &module.sections.globals;
342346 }
343 try self.cg.decl_deps.put(module.gpa, maybe_spv_decl_index.?, {});
344 try module.declareDeclDeps(maybe_spv_decl_index.?, &.{});
347 try ass.cg.module.decl_deps.append(module.gpa, maybe_spv_decl_index.?);
345348 break :section &module.sections.globals;
346349 },
347 else => &self.cg.body,
350 else => &ass.cg.body,
348351 },
349352 };
350353
......@@ -374,12 +377,12 @@ fn processGenericInstruction(self: *Assembler) !?AsmValue {
374377 section.writeOperand(Id, maybe_result_id.?);
375378 },
376379 .ref_id => |index| {
377 const result = try self.resolveRef(index);
380 const result = try ass.resolveRef(index);
378381 try section.ensureUnusedCapacity(module.gpa, 1);
379382 section.writeOperand(spec.Id, result.resultId());
380383 },
381384 .string => |offset| {
382 const text = std.mem.sliceTo(self.inst.string_bytes.items[offset..], 0);
385 const text = std.mem.sliceTo(ass.inst.string_bytes.items[offset..], 0);
383386 const size = std.math.divCeil(usize, text.len + 1, @sizeOf(Word)) catch unreachable;
384387 try section.ensureUnusedCapacity(module.gpa, size);
385388 section.writeOperand(spec.LiteralString, text);
......@@ -388,74 +391,74 @@ fn processGenericInstruction(self: *Assembler) !?AsmValue {
388391 }
389392
390393 const actual_word_count = section.instructions.items.len - first_word;
391 section.instructions.items[first_word] |= @as(u32, @as(u16, @intCast(actual_word_count))) << 16 | @intFromEnum(self.inst.opcode);
394 section.instructions.items[first_word] |= @as(u32, @as(u16, @intCast(actual_word_count))) << 16 | @intFromEnum(ass.inst.opcode);
392395
393396 if (maybe_result_id) |result| return .{ .value = result };
394397 return null;
395398}
396399
397fn resolveMaybeForwardRef(self: *Assembler, ref: AsmValue.Ref) !AsmValue {
398 const value = self.value_map.values()[ref];
400fn resolveMaybeForwardRef(ass: *Assembler, ref: AsmValue.Ref) !AsmValue {
401 const value = ass.value_map.values()[ref];
399402 switch (value) {
400403 .just_declared => {
401 const name = self.value_map.keys()[ref];
404 const name = ass.value_map.keys()[ref];
402405 // TODO: Improve source location.
403 return self.fail(0, "self-referential parameter %{s}", .{name});
406 return ass.fail(0, "ass-referential parameter %{s}", .{name});
404407 },
405408 else => return value,
406409 }
407410}
408411
409fn resolveRef(self: *Assembler, ref: AsmValue.Ref) !AsmValue {
410 const value = try self.resolveMaybeForwardRef(ref);
412fn resolveRef(ass: *Assembler, ref: AsmValue.Ref) !AsmValue {
413 const value = try ass.resolveMaybeForwardRef(ref);
411414 switch (value) {
412415 .just_declared => unreachable,
413416 .unresolved_forward_reference => {
414 const name = self.value_map.keys()[ref];
417 const name = ass.value_map.keys()[ref];
415418 // TODO: Improve source location.
416 return self.fail(0, "reference to undeclared result-id %{s}", .{name});
419 return ass.fail(0, "reference to undeclared result-id %{s}", .{name});
417420 },
418421 else => return value,
419422 }
420423}
421424
422fn resolveRefId(self: *Assembler, ref: AsmValue.Ref) !Id {
423 const value = try self.resolveRef(ref);
425fn resolveRefId(ass: *Assembler, ref: AsmValue.Ref) !Id {
426 const value = try ass.resolveRef(ref);
424427 return value.resultId();
425428}
426429
427fn parseInstruction(self: *Assembler) !void {
428 const gpa = self.cg.module.gpa;
430fn parseInstruction(ass: *Assembler) !void {
431 const gpa = ass.cg.module.gpa;
429432
430 self.inst.opcode = undefined;
431 self.inst.operands.clearRetainingCapacity();
432 self.inst.string_bytes.clearRetainingCapacity();
433 ass.inst.opcode = undefined;
434 ass.inst.operands.clearRetainingCapacity();
435 ass.inst.string_bytes.clearRetainingCapacity();
433436
434 const lhs_result_tok = self.currentToken();
435 const maybe_lhs_result: ?AsmValue.Ref = if (self.eatToken(.result_id_assign)) blk: {
436 const name = self.tokenText(lhs_result_tok)[1..];
437 const entry = try self.value_map.getOrPut(gpa, name);
438 try self.expectToken(.equals);
437 const lhs_result_tok = ass.currentToken();
438 const maybe_lhs_result: ?AsmValue.Ref = if (ass.eatToken(.result_id_assign)) blk: {
439 const name = ass.tokenText(lhs_result_tok)[1..];
440 const entry = try ass.value_map.getOrPut(gpa, name);
441 try ass.expectToken(.equals);
439442 if (!entry.found_existing) {
440443 entry.value_ptr.* = .just_declared;
441444 }
442445 break :blk @intCast(entry.index);
443446 } else null;
444447
445 const opcode_tok = self.currentToken();
448 const opcode_tok = ass.currentToken();
446449 if (maybe_lhs_result != null) {
447 try self.expectToken(.opcode);
448 } else if (!self.eatToken(.opcode)) {
449 return self.fail(opcode_tok.start, "expected start of instruction, found {s}", .{opcode_tok.tag.name()});
450 try ass.expectToken(.opcode);
451 } else if (!ass.eatToken(.opcode)) {
452 return ass.fail(opcode_tok.start, "expected start of instruction, found {s}", .{opcode_tok.tag.name()});
450453 }
451454
452 const opcode_text = self.tokenText(opcode_tok);
453 const index = self.inst_map.getIndex(opcode_text) orelse {
454 return self.fail(opcode_tok.start, "invalid opcode '{s}'", .{opcode_text});
455 const opcode_text = ass.tokenText(opcode_tok);
456 const index = ass.inst_map.getIndex(opcode_text) orelse {
457 return ass.fail(opcode_tok.start, "invalid opcode '{s}'", .{opcode_text});
455458 };
456459
457460 const inst = spec.InstructionSet.core.instructions()[index];
458 self.inst.opcode = @enumFromInt(inst.opcode);
461 ass.inst.opcode = @enumFromInt(inst.opcode);
459462
460463 const expected_operands = inst.operands;
461464 // This is a loop because the result-id is not always the first operand.
......@@ -464,67 +467,67 @@ fn parseInstruction(self: *Assembler) !void {
464467 } else false;
465468
466469 if (requires_lhs_result and maybe_lhs_result == null) {
467 return self.fail(opcode_tok.start, "opcode '{s}' expects result on left-hand side", .{@tagName(self.inst.opcode)});
470 return ass.fail(opcode_tok.start, "opcode '{s}' expects result on left-hand side", .{@tagName(ass.inst.opcode)});
468471 } else if (!requires_lhs_result and maybe_lhs_result != null) {
469 return self.fail(
472 return ass.fail(
470473 lhs_result_tok.start,
471474 "opcode '{s}' does not expect a result-id on the left-hand side",
472 .{@tagName(self.inst.opcode)},
475 .{@tagName(ass.inst.opcode)},
473476 );
474477 }
475478
476479 for (expected_operands) |operand| {
477480 if (operand.kind == .id_result) {
478 try self.inst.operands.append(gpa, .{ .result_id = maybe_lhs_result.? });
481 try ass.inst.operands.append(gpa, .{ .result_id = maybe_lhs_result.? });
479482 continue;
480483 }
481484
482485 switch (operand.quantifier) {
483 .required => if (self.isAtInstructionBoundary()) {
484 return self.fail(
485 self.currentToken().start,
486 .required => if (ass.isAtInstructionBoundary()) {
487 return ass.fail(
488 ass.currentToken().start,
486489 "missing required operand", // TODO: Operand name?
487490 .{},
488491 );
489492 } else {
490 try self.parseOperand(operand.kind);
493 try ass.parseOperand(operand.kind);
491494 },
492 .optional => if (!self.isAtInstructionBoundary()) {
493 try self.parseOperand(operand.kind);
495 .optional => if (!ass.isAtInstructionBoundary()) {
496 try ass.parseOperand(operand.kind);
494497 },
495 .variadic => while (!self.isAtInstructionBoundary()) {
496 try self.parseOperand(operand.kind);
498 .variadic => while (!ass.isAtInstructionBoundary()) {
499 try ass.parseOperand(operand.kind);
497500 },
498501 }
499502 }
500503}
501504
502fn parseOperand(self: *Assembler, kind: spec.OperandKind) Error!void {
505fn parseOperand(ass: *Assembler, kind: spec.OperandKind) Error!void {
503506 switch (kind.category()) {
504 .bit_enum => try self.parseBitEnum(kind),
505 .value_enum => try self.parseValueEnum(kind),
506 .id => try self.parseRefId(),
507 .bit_enum => try ass.parseBitEnum(kind),
508 .value_enum => try ass.parseValueEnum(kind),
509 .id => try ass.parseRefId(),
507510 else => switch (kind) {
508 .literal_integer => try self.parseLiteralInteger(),
509 .literal_string => try self.parseString(),
510 .literal_context_dependent_number => try self.parseContextDependentNumber(),
511 .literal_ext_inst_integer => try self.parseLiteralExtInstInteger(),
512 .pair_id_ref_id_ref => try self.parsePhiSource(),
513 else => return self.todo("parse operand of type {s}", .{@tagName(kind)}),
511 .literal_integer => try ass.parseLiteralInteger(),
512 .literal_string => try ass.parseString(),
513 .literal_context_dependent_number => try ass.parseContextDependentNumber(),
514 .literal_ext_inst_integer => try ass.parseLiteralExtInstInteger(),
515 .pair_id_ref_id_ref => try ass.parsePhiSource(),
516 else => return ass.todo("parse operand of type {s}", .{@tagName(kind)}),
514517 },
515518 }
516519}
517520
518521/// Also handles parsing any required extra operands.
519fn parseBitEnum(self: *Assembler, kind: spec.OperandKind) !void {
520 const gpa = self.cg.module.gpa;
522fn parseBitEnum(ass: *Assembler, kind: spec.OperandKind) !void {
523 const gpa = ass.cg.module.gpa;
521524
522 var tok = self.currentToken();
523 try self.expectToken(.value);
525 var tok = ass.currentToken();
526 try ass.expectToken(.value);
524527
525 var text = self.tokenText(tok);
528 var text = ass.tokenText(tok);
526529 if (std.mem.eql(u8, text, "None")) {
527 try self.inst.operands.append(gpa, .{ .value = 0 });
530 try ass.inst.operands.append(gpa, .{ .value = 0 });
528531 return;
529532 }
530533
......@@ -535,18 +538,18 @@ fn parseBitEnum(self: *Assembler, kind: spec.OperandKind) !void {
535538 if (std.mem.eql(u8, enumerant.name, text))
536539 break enumerant;
537540 } else {
538 return self.fail(tok.start, "'{s}' is not a valid flag for bitmask {s}", .{ text, @tagName(kind) });
541 return ass.fail(tok.start, "'{s}' is not a valid flag for bitmask {s}", .{ text, @tagName(kind) });
539542 };
540543 mask |= enumerant.value;
541 if (!self.eatToken(.pipe))
544 if (!ass.eatToken(.pipe))
542545 break;
543546
544 tok = self.currentToken();
545 try self.expectToken(.value);
546 text = self.tokenText(tok);
547 tok = ass.currentToken();
548 try ass.expectToken(.value);
549 text = ass.tokenText(tok);
547550 }
548551
549 try self.inst.operands.append(gpa, .{ .value = mask });
552 try ass.inst.operands.append(gpa, .{ .value = mask });
550553
551554 // Assume values are sorted.
552555 // TODO: ensure in generator.
......@@ -555,45 +558,45 @@ fn parseBitEnum(self: *Assembler, kind: spec.OperandKind) !void {
555558 continue;
556559
557560 for (enumerant.parameters) |param_kind| {
558 if (self.isAtInstructionBoundary()) {
559 return self.fail(self.currentToken().start, "missing required parameter for bit flag '{s}'", .{enumerant.name});
561 if (ass.isAtInstructionBoundary()) {
562 return ass.fail(ass.currentToken().start, "missing required parameter for bit flag '{s}'", .{enumerant.name});
560563 }
561564
562 try self.parseOperand(param_kind);
565 try ass.parseOperand(param_kind);
563566 }
564567 }
565568}
566569
567570/// Also handles parsing any required extra operands.
568fn parseValueEnum(self: *Assembler, kind: spec.OperandKind) !void {
569 const gpa = self.cg.module.gpa;
570
571 const tok = self.currentToken();
572 if (self.eatToken(.placeholder)) {
573 const name = self.tokenText(tok)[1..];
574 const value = self.value_map.get(name) orelse {
575 return self.fail(tok.start, "invalid placeholder '${s}'", .{name});
571fn parseValueEnum(ass: *Assembler, kind: spec.OperandKind) !void {
572 const gpa = ass.cg.module.gpa;
573
574 const tok = ass.currentToken();
575 if (ass.eatToken(.placeholder)) {
576 const name = ass.tokenText(tok)[1..];
577 const value = ass.value_map.get(name) orelse {
578 return ass.fail(tok.start, "invalid placeholder '${s}'", .{name});
576579 };
577580 switch (value) {
578581 .constant => |literal32| {
579 try self.inst.operands.append(gpa, .{ .value = literal32 });
582 try ass.inst.operands.append(gpa, .{ .value = literal32 });
580583 },
581584 .string => |str| {
582585 const enumerant = for (kind.enumerants()) |enumerant| {
583586 if (std.mem.eql(u8, enumerant.name, str)) break enumerant;
584587 } else {
585 return self.fail(tok.start, "'{s}' is not a valid value for enumeration {s}", .{ str, @tagName(kind) });
588 return ass.fail(tok.start, "'{s}' is not a valid value for enumeration {s}", .{ str, @tagName(kind) });
586589 };
587 try self.inst.operands.append(gpa, .{ .value = enumerant.value });
590 try ass.inst.operands.append(gpa, .{ .value = enumerant.value });
588591 },
589 else => return self.fail(tok.start, "value '{s}' cannot be used as placeholder", .{name}),
592 else => return ass.fail(tok.start, "value '{s}' cannot be used as placeholder", .{name}),
590593 }
591594 return;
592595 }
593596
594 try self.expectToken(.value);
597 try ass.expectToken(.value);
595598
596 const text = self.tokenText(tok);
599 const text = ass.tokenText(tok);
597600 const int_value = std.fmt.parseInt(u32, text, 0) catch null;
598601 const enumerant = for (kind.enumerants()) |enumerant| {
599602 if (int_value) |v| {
......@@ -602,131 +605,131 @@ fn parseValueEnum(self: *Assembler, kind: spec.OperandKind) !void {
602605 if (std.mem.eql(u8, enumerant.name, text)) break enumerant;
603606 }
604607 } else {
605 return self.fail(tok.start, "'{s}' is not a valid value for enumeration {s}", .{ text, @tagName(kind) });
608 return ass.fail(tok.start, "'{s}' is not a valid value for enumeration {s}", .{ text, @tagName(kind) });
606609 };
607610
608 try self.inst.operands.append(gpa, .{ .value = enumerant.value });
611 try ass.inst.operands.append(gpa, .{ .value = enumerant.value });
609612
610613 for (enumerant.parameters) |param_kind| {
611 if (self.isAtInstructionBoundary()) {
612 return self.fail(self.currentToken().start, "missing required parameter for enum variant '{s}'", .{enumerant.name});
614 if (ass.isAtInstructionBoundary()) {
615 return ass.fail(ass.currentToken().start, "missing required parameter for enum variant '{s}'", .{enumerant.name});
613616 }
614617
615 try self.parseOperand(param_kind);
618 try ass.parseOperand(param_kind);
616619 }
617620}
618621
619fn parseRefId(self: *Assembler) !void {
620 const gpa = self.cg.module.gpa;
622fn parseRefId(ass: *Assembler) !void {
623 const gpa = ass.cg.module.gpa;
621624
622 const tok = self.currentToken();
623 try self.expectToken(.result_id);
625 const tok = ass.currentToken();
626 try ass.expectToken(.result_id);
624627
625 const name = self.tokenText(tok)[1..];
626 const entry = try self.value_map.getOrPut(gpa, name);
628 const name = ass.tokenText(tok)[1..];
629 const entry = try ass.value_map.getOrPut(gpa, name);
627630 if (!entry.found_existing) {
628631 entry.value_ptr.* = .unresolved_forward_reference;
629632 }
630633
631634 const index: AsmValue.Ref = @intCast(entry.index);
632 try self.inst.operands.append(gpa, .{ .ref_id = index });
635 try ass.inst.operands.append(gpa, .{ .ref_id = index });
633636}
634637
635fn parseLiteralInteger(self: *Assembler) !void {
636 const gpa = self.cg.module.gpa;
638fn parseLiteralInteger(ass: *Assembler) !void {
639 const gpa = ass.cg.module.gpa;
637640
638 const tok = self.currentToken();
639 if (self.eatToken(.placeholder)) {
640 const name = self.tokenText(tok)[1..];
641 const value = self.value_map.get(name) orelse {
642 return self.fail(tok.start, "invalid placeholder '${s}'", .{name});
641 const tok = ass.currentToken();
642 if (ass.eatToken(.placeholder)) {
643 const name = ass.tokenText(tok)[1..];
644 const value = ass.value_map.get(name) orelse {
645 return ass.fail(tok.start, "invalid placeholder '${s}'", .{name});
643646 };
644647 switch (value) {
645648 .constant => |literal32| {
646 try self.inst.operands.append(gpa, .{ .literal32 = literal32 });
649 try ass.inst.operands.append(gpa, .{ .literal32 = literal32 });
647650 },
648651 else => {
649 return self.fail(tok.start, "value '{s}' cannot be used as placeholder", .{name});
652 return ass.fail(tok.start, "value '{s}' cannot be used as placeholder", .{name});
650653 },
651654 }
652655 return;
653656 }
654657
655 try self.expectToken(.value);
658 try ass.expectToken(.value);
656659 // According to the SPIR-V machine readable grammar, a LiteralInteger
657660 // may consist of one or more words. From the SPIR-V docs it seems like there
658661 // only one instruction where multiple words are allowed, the literals that make up the
659662 // switch cases of OpSwitch. This case is handled separately, and so we just assume
660663 // everything is a 32-bit integer in this function.
661 const text = self.tokenText(tok);
664 const text = ass.tokenText(tok);
662665 const value = std.fmt.parseInt(u32, text, 0) catch {
663 return self.fail(tok.start, "'{s}' is not a valid 32-bit integer literal", .{text});
666 return ass.fail(tok.start, "'{s}' is not a valid 32-bit integer literal", .{text});
664667 };
665 try self.inst.operands.append(gpa, .{ .literal32 = value });
668 try ass.inst.operands.append(gpa, .{ .literal32 = value });
666669}
667670
668fn parseLiteralExtInstInteger(self: *Assembler) !void {
669 const gpa = self.cg.module.gpa;
671fn parseLiteralExtInstInteger(ass: *Assembler) !void {
672 const gpa = ass.cg.module.gpa;
670673
671 const tok = self.currentToken();
672 if (self.eatToken(.placeholder)) {
673 const name = self.tokenText(tok)[1..];
674 const value = self.value_map.get(name) orelse {
675 return self.fail(tok.start, "invalid placeholder '${s}'", .{name});
674 const tok = ass.currentToken();
675 if (ass.eatToken(.placeholder)) {
676 const name = ass.tokenText(tok)[1..];
677 const value = ass.value_map.get(name) orelse {
678 return ass.fail(tok.start, "invalid placeholder '${s}'", .{name});
676679 };
677680 switch (value) {
678681 .constant => |literal32| {
679 try self.inst.operands.append(gpa, .{ .literal32 = literal32 });
682 try ass.inst.operands.append(gpa, .{ .literal32 = literal32 });
680683 },
681684 else => {
682 return self.fail(tok.start, "value '{s}' cannot be used as placeholder", .{name});
685 return ass.fail(tok.start, "value '{s}' cannot be used as placeholder", .{name});
683686 },
684687 }
685688 return;
686689 }
687690
688 try self.expectToken(.value);
689 const text = self.tokenText(tok);
691 try ass.expectToken(.value);
692 const text = ass.tokenText(tok);
690693 const value = std.fmt.parseInt(u32, text, 0) catch {
691 return self.fail(tok.start, "'{s}' is not a valid 32-bit integer literal", .{text});
694 return ass.fail(tok.start, "'{s}' is not a valid 32-bit integer literal", .{text});
692695 };
693 try self.inst.operands.append(gpa, .{ .literal32 = value });
696 try ass.inst.operands.append(gpa, .{ .literal32 = value });
694697}
695698
696fn parseString(self: *Assembler) !void {
697 const gpa = self.cg.module.gpa;
699fn parseString(ass: *Assembler) !void {
700 const gpa = ass.cg.module.gpa;
698701
699 const tok = self.currentToken();
700 try self.expectToken(.string);
702 const tok = ass.currentToken();
703 try ass.expectToken(.string);
701704 // Note, the string might not have a closing quote. In this case,
702705 // an error is already emitted but we are trying to continue processing
703706 // anyway, so in this function we have to deal with that situation.
704 const text = self.tokenText(tok);
707 const text = ass.tokenText(tok);
705708 assert(text.len > 0 and text[0] == '"');
706709 const literal = if (text.len != 1 and text[text.len - 1] == '"')
707710 text[1 .. text.len - 1]
708711 else
709712 text[1..];
710713
711 const string_offset: u32 = @intCast(self.inst.string_bytes.items.len);
712 try self.inst.string_bytes.ensureUnusedCapacity(gpa, literal.len + 1);
713 self.inst.string_bytes.appendSliceAssumeCapacity(literal);
714 self.inst.string_bytes.appendAssumeCapacity(0);
714 const string_offset: u32 = @intCast(ass.inst.string_bytes.items.len);
715 try ass.inst.string_bytes.ensureUnusedCapacity(gpa, literal.len + 1);
716 ass.inst.string_bytes.appendSliceAssumeCapacity(literal);
717 ass.inst.string_bytes.appendAssumeCapacity(0);
715718
716 try self.inst.operands.append(gpa, .{ .string = string_offset });
719 try ass.inst.operands.append(gpa, .{ .string = string_offset });
717720}
718721
719fn parseContextDependentNumber(self: *Assembler) !void {
720 const module = self.cg.module;
722fn parseContextDependentNumber(ass: *Assembler) !void {
723 const module = ass.cg.module;
721724
722725 // For context dependent numbers, the actual type to parse is determined by the instruction.
723726 // Currently, this operand appears in OpConstant and OpSpecConstant, where the too-be-parsed type
724727 // is determined by the result type. That means that in this instructions we have to resolve the
725728 // operand type early and look at the result to see how we need to proceed.
726 assert(self.inst.opcode == .OpConstant or self.inst.opcode == .OpSpecConstant);
729 assert(ass.inst.opcode == .OpConstant or ass.inst.opcode == .OpSpecConstant);
727730
728 const tok = self.currentToken();
729 const result = try self.resolveRef(self.inst.operands.items[0].ref_id);
731 const tok = ass.currentToken();
732 const result = try ass.resolveRef(ass.inst.operands.items[0].ref_id);
730733 const result_id = result.resultId();
731734 // We are going to cheat a little bit: The types we are interested in, int and float,
732735 // are added to the module and cached via module.intType and module.floatType. Therefore,
......@@ -741,7 +744,7 @@ fn parseContextDependentNumber(self: *Assembler) !void {
741744 const id = entry.value_ptr.*;
742745 if (id != result_id) continue;
743746 const info = entry.key_ptr.*;
744 return try self.parseContextDependentInt(info.signedness, info.bits);
747 return try ass.parseContextDependentInt(info.signedness, info.bits);
745748 }
746749 }
747750
......@@ -752,44 +755,44 @@ fn parseContextDependentNumber(self: *Assembler) !void {
752755 if (id != result_id) continue;
753756 const info = entry.key_ptr.*;
754757 switch (info.bits) {
755 16 => try self.parseContextDependentFloat(16),
756 32 => try self.parseContextDependentFloat(32),
757 64 => try self.parseContextDependentFloat(64),
758 else => return self.fail(tok.start, "cannot parse {}-bit info literal", .{info.bits}),
758 16 => try ass.parseContextDependentFloat(16),
759 32 => try ass.parseContextDependentFloat(32),
760 64 => try ass.parseContextDependentFloat(64),
761 else => return ass.fail(tok.start, "cannot parse {}-bit info literal", .{info.bits}),
759762 }
760763 }
761764 }
762765
763 return self.fail(tok.start, "cannot parse literal constant", .{});
766 return ass.fail(tok.start, "cannot parse literal constant", .{});
764767}
765768
766fn parseContextDependentInt(self: *Assembler, signedness: std.builtin.Signedness, width: u32) !void {
767 const gpa = self.cg.module.gpa;
769fn parseContextDependentInt(ass: *Assembler, signedness: std.builtin.Signedness, width: u32) !void {
770 const gpa = ass.cg.module.gpa;
768771
769 const tok = self.currentToken();
770 if (self.eatToken(.placeholder)) {
771 const name = self.tokenText(tok)[1..];
772 const value = self.value_map.get(name) orelse {
773 return self.fail(tok.start, "invalid placeholder '${s}'", .{name});
772 const tok = ass.currentToken();
773 if (ass.eatToken(.placeholder)) {
774 const name = ass.tokenText(tok)[1..];
775 const value = ass.value_map.get(name) orelse {
776 return ass.fail(tok.start, "invalid placeholder '${s}'", .{name});
774777 };
775778 switch (value) {
776779 .constant => |literal32| {
777 try self.inst.operands.append(gpa, .{ .literal32 = literal32 });
780 try ass.inst.operands.append(gpa, .{ .literal32 = literal32 });
778781 },
779782 else => {
780 return self.fail(tok.start, "value '{s}' cannot be used as placeholder", .{name});
783 return ass.fail(tok.start, "value '{s}' cannot be used as placeholder", .{name});
781784 },
782785 }
783786 return;
784787 }
785788
786 try self.expectToken(.value);
789 try ass.expectToken(.value);
787790
788791 if (width == 0 or width > 2 * @bitSizeOf(spec.Word)) {
789 return self.fail(tok.start, "cannot parse {}-bit integer literal", .{width});
792 return ass.fail(tok.start, "cannot parse {}-bit integer literal", .{width});
790793 }
791794
792 const text = self.tokenText(tok);
795 const text = ass.tokenText(tok);
793796 invalid: {
794797 // Just parse the integer as the next larger integer type, and check if it overflows afterwards.
795798 const int = std.fmt.parseInt(i128, text, 0) catch break :invalid;
......@@ -804,104 +807,104 @@ fn parseContextDependentInt(self: *Assembler, signedness: std.builtin.Signedness
804807
805808 // Note, we store the sign-extended version here.
806809 if (width <= @bitSizeOf(spec.Word)) {
807 try self.inst.operands.append(gpa, .{ .literal32 = @truncate(@as(u128, @bitCast(int))) });
810 try ass.inst.operands.append(gpa, .{ .literal32 = @truncate(@as(u128, @bitCast(int))) });
808811 } else {
809 try self.inst.operands.append(gpa, .{ .literal64 = @truncate(@as(u128, @bitCast(int))) });
812 try ass.inst.operands.append(gpa, .{ .literal64 = @truncate(@as(u128, @bitCast(int))) });
810813 }
811814 return;
812815 }
813816
814 return self.fail(tok.start, "'{s}' is not a valid {s} {}-bit int literal", .{ text, @tagName(signedness), width });
817 return ass.fail(tok.start, "'{s}' is not a valid {s} {}-bit int literal", .{ text, @tagName(signedness), width });
815818}
816819
817fn parseContextDependentFloat(self: *Assembler, comptime width: u16) !void {
818 const gpa = self.cg.module.gpa;
820fn parseContextDependentFloat(ass: *Assembler, comptime width: u16) !void {
821 const gpa = ass.cg.module.gpa;
819822
820823 const Float = std.meta.Float(width);
821824 const Int = std.meta.Int(.unsigned, width);
822825
823 const tok = self.currentToken();
824 try self.expectToken(.value);
826 const tok = ass.currentToken();
827 try ass.expectToken(.value);
825828
826 const text = self.tokenText(tok);
829 const text = ass.tokenText(tok);
827830
828831 const value = std.fmt.parseFloat(Float, text) catch {
829 return self.fail(tok.start, "'{s}' is not a valid {}-bit float literal", .{ text, width });
832 return ass.fail(tok.start, "'{s}' is not a valid {}-bit float literal", .{ text, width });
830833 };
831834
832835 const float_bits: Int = @bitCast(value);
833836 if (width <= @bitSizeOf(spec.Word)) {
834 try self.inst.operands.append(gpa, .{ .literal32 = float_bits });
837 try ass.inst.operands.append(gpa, .{ .literal32 = float_bits });
835838 } else {
836839 assert(width <= 2 * @bitSizeOf(spec.Word));
837 try self.inst.operands.append(gpa, .{ .literal64 = float_bits });
840 try ass.inst.operands.append(gpa, .{ .literal64 = float_bits });
838841 }
839842}
840843
841fn parsePhiSource(self: *Assembler) !void {
842 try self.parseRefId();
843 if (self.isAtInstructionBoundary()) {
844 return self.fail(self.currentToken().start, "missing phi block parent", .{});
844fn parsePhiSource(ass: *Assembler) !void {
845 try ass.parseRefId();
846 if (ass.isAtInstructionBoundary()) {
847 return ass.fail(ass.currentToken().start, "missing phi block parent", .{});
845848 }
846 try self.parseRefId();
849 try ass.parseRefId();
847850}
848851
849852/// Returns whether the `current_token` cursor
850853/// is currently pointing at the start of a new instruction.
851fn isAtInstructionBoundary(self: Assembler) bool {
852 return switch (self.currentToken().tag) {
854fn isAtInstructionBoundary(ass: Assembler) bool {
855 return switch (ass.currentToken().tag) {
853856 .opcode, .result_id_assign, .eof => true,
854857 else => false,
855858 };
856859}
857860
858fn expectToken(self: *Assembler, tag: Token.Tag) !void {
859 if (self.eatToken(tag))
861fn expectToken(ass: *Assembler, tag: Token.Tag) !void {
862 if (ass.eatToken(tag))
860863 return;
861864
862 return self.fail(self.currentToken().start, "unexpected {s}, expected {s}", .{
863 self.currentToken().tag.name(),
865 return ass.fail(ass.currentToken().start, "unexpected {s}, expected {s}", .{
866 ass.currentToken().tag.name(),
864867 tag.name(),
865868 });
866869}
867870
868fn eatToken(self: *Assembler, tag: Token.Tag) bool {
869 if (self.testToken(tag)) {
870 self.current_token += 1;
871fn eatToken(ass: *Assembler, tag: Token.Tag) bool {
872 if (ass.testToken(tag)) {
873 ass.current_token += 1;
871874 return true;
872875 }
873876 return false;
874877}
875878
876fn testToken(self: Assembler, tag: Token.Tag) bool {
877 return self.currentToken().tag == tag;
879fn testToken(ass: Assembler, tag: Token.Tag) bool {
880 return ass.currentToken().tag == tag;
878881}
879882
880fn currentToken(self: Assembler) Token {
881 return self.tokens.items[self.current_token];
883fn currentToken(ass: Assembler) Token {
884 return ass.tokens.items[ass.current_token];
882885}
883886
884fn tokenText(self: Assembler, tok: Token) []const u8 {
885 return self.src[tok.start..tok.end];
887fn tokenText(ass: Assembler, tok: Token) []const u8 {
888 return ass.src[tok.start..tok.end];
886889}
887890
888/// Tokenize `self.src` and put the tokens in `self.tokens`.
889/// Any errors encountered are appended to `self.errors`.
890fn tokenize(self: *Assembler) !void {
891 const gpa = self.cg.module.gpa;
891/// Tokenize `ass.src` and put the tokens in `ass.tokens`.
892/// Any errors encountered are appended to `ass.errors`.
893fn tokenize(ass: *Assembler) !void {
894 const gpa = ass.cg.module.gpa;
892895
893 self.tokens.clearRetainingCapacity();
896 ass.tokens.clearRetainingCapacity();
894897
895898 var offset: u32 = 0;
896899 while (true) {
897 const tok = try self.nextToken(offset);
900 const tok = try ass.nextToken(offset);
898901 // Resolve result-id assignment now.
899902 // NOTE: If the previous token wasn't a result-id, just ignore it,
900903 // we will catch it while parsing.
901 if (tok.tag == .equals and self.tokens.items[self.tokens.items.len - 1].tag == .result_id) {
902 self.tokens.items[self.tokens.items.len - 1].tag = .result_id_assign;
904 if (tok.tag == .equals and ass.tokens.items[ass.tokens.items.len - 1].tag == .result_id) {
905 ass.tokens.items[ass.tokens.items.len - 1].tag = .result_id_assign;
903906 }
904 try self.tokens.append(gpa, tok);
907 try ass.tokens.append(gpa, tok);
905908 if (tok.tag == .eof)
906909 break;
907910 offset = tok.end;
......@@ -943,8 +946,8 @@ const Token = struct {
943946 /// These can be used in place of a normal `value`.
944947 placeholder,
945948
946 fn name(self: Tag) []const u8 {
947 return switch (self) {
949 fn name(tag: Tag) []const u8 {
950 return switch (tag) {
948951 .eof => "<end of input>",
949952 .result_id => "<result-id>",
950953 .result_id_assign => "<assigned result-id>",
......@@ -963,7 +966,7 @@ const Token = struct {
963966/// that the token is surrounded by whitespace if required, but will not
964967/// interpret the token yet.
965968/// NOTE: This function doesn't handle .result_id_assign - this is handled in tokenize().
966fn nextToken(self: *Assembler, start_offset: u32) !Token {
969fn nextToken(ass: *Assembler, start_offset: u32) !Token {
967970 // We generally separate the input into the following types:
968971 // - Whitespace. Generally ignored, but also used as delimiter for some
969972 // tokens.
......@@ -989,8 +992,8 @@ fn nextToken(self: *Assembler, start_offset: u32) !Token {
989992 var token_start = start_offset;
990993 var offset = start_offset;
991994 var tag = Token.Tag.eof;
992 while (offset < self.src.len) : (offset += 1) {
993 const c = self.src[offset];
995 while (offset < ass.src.len) : (offset += 1) {
996 const c = ass.src[offset];
994997 switch (state) {
995998 .start => switch (c) {
996999 ' ', '\t', '\r', '\n' => token_start = offset + 1,
......@@ -1023,7 +1026,7 @@ fn nextToken(self: *Assembler, start_offset: u32) !Token {
10231026 },
10241027 .value => switch (c) {
10251028 '"' => {
1026 try self.addError(offset, "unexpected string literal", .{});
1029 try ass.addError(offset, "unexpected string literal", .{});
10271030 // The user most likely just forgot a delimiter here - keep
10281031 // the tag as value.
10291032 break;
......@@ -1035,7 +1038,7 @@ fn nextToken(self: *Assembler, start_offset: u32) !Token {
10351038 '_', 'a'...'z', 'A'...'Z', '0'...'9' => {},
10361039 ' ', '\t', '\r', '\n', '=', '|' => break,
10371040 else => {
1038 try self.addError(offset, "illegal character in result-id or placeholder", .{});
1041 try ass.addError(offset, "illegal character in result-id or placeholder", .{});
10391042 // Again, probably a forgotten delimiter here.
10401043 break;
10411044 },
......@@ -1048,7 +1051,7 @@ fn nextToken(self: *Assembler, start_offset: u32) !Token {
10481051 .string_end => switch (c) {
10491052 ' ', '\t', '\r', '\n', '=', '|' => break,
10501053 else => {
1051 try self.addError(offset, "unexpected character after string literal", .{});
1054 try ass.addError(offset, "unexpected character after string literal", .{});
10521055 // The token is still unmistakibly a string.
10531056 break;
10541057 },
......@@ -1066,13 +1069,13 @@ fn nextToken(self: *Assembler, start_offset: u32) !Token {
10661069
10671070 switch (state) {
10681071 .string, .escape => {
1069 try self.addError(token_start, "unterminated string", .{});
1072 try ass.addError(token_start, "unterminated string", .{});
10701073 },
10711074 .result_id => if (offset - token_start == 1) {
1072 try self.addError(token_start, "result-id must have at least one name character", .{});
1075 try ass.addError(token_start, "result-id must have at least one name character", .{});
10731076 },
10741077 .value => {
1075 const text = self.tokenText(tok);
1078 const text = ass.tokenText(tok);
10761079 const prefix = "Op";
10771080 const looks_like_opcode = text.len > prefix.len and
10781081 std.mem.startsWith(u8, text, prefix) and
src/codegen/spirv/CodeGen.zig+310-290
......@@ -144,36 +144,28 @@ const ControlFlow = union(enum) {
144144
145145pt: Zcu.PerThread,
146146air: Air,
147/// Note: If the declaration is not a function, this value will be undefined!
148147liveness: Air.Liveness,
149148owner_nav: InternPool.Nav.Index,
150149module: *Module,
151150control_flow: ControlFlow,
152151base_line: u32,
153152block_label: Id = .none,
154/// The base offset of the current decl, which is what `dbg_stmt` is relative to.
155/// An array of function argument result-ids. Each index corresponds with the
156/// function argument of the same index.
157args: std.ArrayListUnmanaged(Id) = .empty,
158/// A counter to keep track of how many `arg` instructions we've seen yet.
159153next_arg_index: u32 = 0,
160/// A map keeping track of which instruction generated which result-id.
154args: std.ArrayListUnmanaged(Id) = .empty,
161155inst_results: std.AutoHashMapUnmanaged(Air.Inst.Index, Id) = .empty,
162file_path_id: Id = .none,
156id_scratch: std.ArrayListUnmanaged(Id) = .empty,
163157prologue: Section = .{},
164158body: Section = .{},
165decl_deps: std.AutoArrayHashMapUnmanaged(Decl.Index, void) = .empty,
166159error_msg: ?*Zcu.ErrorMsg = null,
167160
168/// Free resources owned by the CodeGen.
169161pub fn deinit(cg: *CodeGen) void {
170162 const gpa = cg.module.gpa;
163 cg.control_flow.deinit(gpa);
171164 cg.args.deinit(gpa);
172165 cg.inst_results.deinit(gpa);
173 cg.control_flow.deinit(gpa);
166 cg.id_scratch.deinit(gpa);
174167 cg.prologue.deinit(gpa);
175168 cg.body.deinit(gpa);
176 cg.decl_deps.deinit(gpa);
177169}
178170
179171const Error = error{ CodegenFail, OutOfMemory };
......@@ -191,9 +183,11 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void {
191183 if (!do_codegen and !ty.hasRuntimeBits(zcu)) return;
192184
193185 const spv_decl_index = try cg.module.resolveNav(ip, cg.owner_nav);
194 const result_id = cg.module.declPtr(spv_decl_index).result_id;
186 const decl = cg.module.declPtr(spv_decl_index);
187 const result_id = decl.result_id;
188 decl.begin_dep = cg.module.decl_deps.items.len;
195189
196 switch (cg.module.declPtr(spv_decl_index).kind) {
190 switch (decl.kind) {
197191 .func => {
198192 const fn_info = zcu.typeToFunc(ty).?;
199193 const return_ty_id = try cg.resolveFnReturnType(.fromInterned(fn_info.return_type));
......@@ -201,7 +195,7 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void {
201195
202196 const func_result_id = if (is_test) cg.module.allocId() else result_id;
203197 const prototype_ty_id = try cg.resolveType(ty, .direct);
204 try cg.prologue.emit(cg.module.gpa, .OpFunction, .{
198 try cg.prologue.emit(gpa, .OpFunction, .{
205199 .id_result_type = return_ty_id,
206200 .id_result = func_result_id,
207201 .function_type = prototype_ty_id,
......@@ -218,7 +212,7 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void {
218212
219213 const param_type_id = try cg.resolveType(param_ty, .direct);
220214 const arg_result_id = cg.module.allocId();
221 try cg.prologue.emit(cg.module.gpa, .OpFunctionParameter, .{
215 try cg.prologue.emit(gpa, .OpFunctionParameter, .{
222216 .id_result_type = param_type_id,
223217 .id_result = arg_result_id,
224218 });
......@@ -230,7 +224,7 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void {
230224
231225 // The root block of a function declaration should appear before OpVariable instructions,
232226 // so it is generated into the function's prologue.
233 try cg.prologue.emit(cg.module.gpa, .OpLabel, .{
227 try cg.prologue.emit(gpa, .OpLabel, .{
234228 .id_result = root_block_id,
235229 });
236230 cg.block_label = root_block_id;
......@@ -241,23 +235,22 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void {
241235 _ = try cg.genStructuredBody(.selection, main_body);
242236 // We always expect paths to here to end, but we still need the block
243237 // to act as a dummy merge block.
244 try cg.body.emit(cg.module.gpa, .OpUnreachable, {});
238 try cg.body.emit(gpa, .OpUnreachable, {});
245239 },
246240 .unstructured => {
247241 try cg.genBody(main_body);
248242 },
249243 }
250 try cg.body.emit(cg.module.gpa, .OpFunctionEnd, {});
244 try cg.body.emit(gpa, .OpFunctionEnd, {});
251245 // Append the actual code into the functions section.
252 try cg.module.sections.functions.append(cg.module.gpa, cg.prologue);
253 try cg.module.sections.functions.append(cg.module.gpa, cg.body);
246 try cg.module.sections.functions.append(gpa, cg.prologue);
247 try cg.module.sections.functions.append(gpa, cg.body);
254248
255249 // Temporarily generate a test kernel declaration if this is a test function.
256250 if (is_test) {
257251 try cg.generateTestEntryPoint(nav.fqn.toSlice(ip), spv_decl_index, func_result_id);
258252 }
259253
260 try cg.module.declareDeclDeps(spv_decl_index, cg.decl_deps.keys());
261254 try cg.module.debugName(func_result_id, nav.fqn.toSlice(ip));
262255 },
263256 .global => {
......@@ -275,7 +268,7 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void {
275268 const ty_id = try cg.resolveType(ty, .indirect);
276269 const ptr_ty_id = try cg.module.ptrType(ty_id, storage_class);
277270
278 try cg.module.sections.globals.emit(cg.module.gpa, .OpVariable, .{
271 try cg.module.sections.globals.emit(gpa, .OpVariable, .{
279272 .id_result_type = ptr_ty_id,
280273 .id_result = result_id,
281274 .storage_class = storage_class,
......@@ -307,7 +300,6 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void {
307300 }
308301
309302 try cg.module.debugName(result_id, nav.fqn.toSlice(ip));
310 try cg.module.declareDeclDeps(spv_decl_index, &.{});
311303 },
312304 .invocation_global => {
313305 const maybe_init_val: ?Value = switch (ip.indexToKey(val.toIntern())) {
......@@ -317,8 +309,6 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void {
317309 else => val,
318310 };
319311
320 try cg.module.declareDeclDeps(spv_decl_index, &.{});
321
322312 const ty_id = try cg.resolveType(ty, .indirect);
323313 const ptr_ty_id = try cg.module.ptrType(ty_id, .function);
324314
......@@ -328,7 +318,7 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void {
328318 const initializer_proto_ty_id = try cg.module.functionType(void_ty_id, &.{});
329319
330320 const initializer_id = cg.module.allocId();
331 try cg.prologue.emit(cg.module.gpa, .OpFunction, .{
321 try cg.prologue.emit(gpa, .OpFunction, .{
332322 .id_result_type = try cg.resolveType(.void, .direct),
333323 .id_result = initializer_id,
334324 .function_control = .{},
......@@ -336,26 +326,25 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void {
336326 });
337327
338328 const root_block_id = cg.module.allocId();
339 try cg.prologue.emit(cg.module.gpa, .OpLabel, .{
329 try cg.prologue.emit(gpa, .OpLabel, .{
340330 .id_result = root_block_id,
341331 });
342332 cg.block_label = root_block_id;
343333
344334 const val_id = try cg.constant(ty, init_val, .indirect);
345 try cg.body.emit(cg.module.gpa, .OpStore, .{
335 try cg.body.emit(gpa, .OpStore, .{
346336 .pointer = result_id,
347337 .object = val_id,
348338 });
349339
350 try cg.body.emit(cg.module.gpa, .OpReturn, {});
351 try cg.body.emit(cg.module.gpa, .OpFunctionEnd, {});
352 try cg.module.sections.functions.append(cg.module.gpa, cg.prologue);
353 try cg.module.sections.functions.append(cg.module.gpa, cg.body);
354 try cg.module.declareDeclDeps(spv_decl_index, cg.decl_deps.keys());
340 try cg.body.emit(gpa, .OpReturn, {});
341 try cg.body.emit(gpa, .OpFunctionEnd, {});
342 try cg.module.sections.functions.append(gpa, cg.prologue);
343 try cg.module.sections.functions.append(gpa, cg.body);
355344
356345 try cg.module.debugNameFmt(initializer_id, "initializer of {f}", .{nav.fqn.fmt(ip)});
357346
358 try cg.module.sections.globals.emit(cg.module.gpa, .OpExtInst, .{
347 try cg.module.sections.globals.emit(gpa, .OpExtInst, .{
359348 .id_result_type = ptr_ty_id,
360349 .id_result = result_id,
361350 .set = try cg.module.importInstructionSet(.zig),
......@@ -363,7 +352,7 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void {
363352 .id_ref_4 = &.{initializer_id},
364353 });
365354 } else {
366 try cg.module.sections.globals.emit(cg.module.gpa, .OpExtInst, .{
355 try cg.module.sections.globals.emit(gpa, .OpExtInst, .{
367356 .id_result_type = ptr_ty_id,
368357 .id_result = result_id,
369358 .set = try cg.module.importInstructionSet(.zig),
......@@ -373,6 +362,8 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void {
373362 }
374363 },
375364 }
365
366 cg.module.declPtr(spv_decl_index).end_dep = cg.module.decl_deps.items.len;
376367}
377368
378369pub fn fail(cg: *CodeGen, comptime format: []const u8, args: anytype) Error {
......@@ -413,7 +404,7 @@ fn resolve(cg: *CodeGen, inst: Air.Inst.Ref) !Id {
413404 else => unreachable,
414405 };
415406 const spv_decl_index = try cg.module.resolveNav(ip, fn_nav);
416 try cg.decl_deps.put(cg.module.gpa, spv_decl_index, {});
407 try cg.module.decl_deps.append(cg.module.gpa, spv_decl_index);
417408 return cg.module.declPtr(spv_decl_index).result_id;
418409 }
419410
......@@ -433,7 +424,7 @@ fn resolveUav(cg: *CodeGen, val: InternPool.Index) !Id {
433424 const ty_id = try cg.resolveType(ty, .indirect);
434425
435426 const spv_decl_index = blk: {
436 const entry = try cg.module.uav_link.getOrPut(cg.module.gpa, .{ val, .function });
427 const entry = try cg.module.uav_link.getOrPut(gpa, .{ val, .function });
437428 if (entry.found_existing) {
438429 try cg.addFunctionDep(entry.value_ptr.*, .function);
439430 return cg.module.declPtr(entry.value_ptr.*).result_id;
......@@ -458,57 +449,52 @@ fn resolveUav(cg: *CodeGen, val: InternPool.Index) !Id {
458449 // TODO: This should probably be made a little more robust.
459450 const func_prologue = cg.prologue;
460451 const func_body = cg.body;
461 const func_deps = cg.decl_deps;
462452 const block_label = cg.block_label;
463453 defer {
464454 cg.prologue = func_prologue;
465455 cg.body = func_body;
466 cg.decl_deps = func_deps;
467456 cg.block_label = block_label;
468457 }
469458
470459 cg.prologue = .{};
471460 cg.body = .{};
472 cg.decl_deps = .{};
473461 defer {
474462 cg.prologue.deinit(gpa);
475463 cg.body.deinit(gpa);
476 cg.decl_deps.deinit(gpa);
477464 }
478465
479466 const void_ty_id = try cg.resolveType(.void, .direct);
480467 const initializer_proto_ty_id = try cg.module.functionType(void_ty_id, &.{});
481468
482469 const initializer_id = cg.module.allocId();
483 try cg.prologue.emit(cg.module.gpa, .OpFunction, .{
470 try cg.prologue.emit(gpa, .OpFunction, .{
484471 .id_result_type = try cg.resolveType(.void, .direct),
485472 .id_result = initializer_id,
486473 .function_control = .{},
487474 .function_type = initializer_proto_ty_id,
488475 });
489476 const root_block_id = cg.module.allocId();
490 try cg.prologue.emit(cg.module.gpa, .OpLabel, .{
477 try cg.prologue.emit(gpa, .OpLabel, .{
491478 .id_result = root_block_id,
492479 });
493480 cg.block_label = root_block_id;
494481
495482 const val_id = try cg.constant(ty, .fromInterned(val), .indirect);
496 try cg.body.emit(cg.module.gpa, .OpStore, .{
483 try cg.body.emit(gpa, .OpStore, .{
497484 .pointer = result_id,
498485 .object = val_id,
499486 });
500487
501 try cg.body.emit(cg.module.gpa, .OpReturn, {});
502 try cg.body.emit(cg.module.gpa, .OpFunctionEnd, {});
488 try cg.body.emit(gpa, .OpReturn, {});
489 try cg.body.emit(gpa, .OpFunctionEnd, {});
503490
504 try cg.module.sections.functions.append(cg.module.gpa, cg.prologue);
505 try cg.module.sections.functions.append(cg.module.gpa, cg.body);
506 try cg.module.declareDeclDeps(spv_decl_index, cg.decl_deps.keys());
491 try cg.module.sections.functions.append(gpa, cg.prologue);
492 try cg.module.sections.functions.append(gpa, cg.body);
507493
508494 try cg.module.debugNameFmt(initializer_id, "initializer of __anon_{d}", .{@intFromEnum(val)});
509495
510496 const fn_decl_ptr_ty_id = try cg.module.ptrType(ty_id, .function);
511 try cg.module.sections.globals.emit(cg.module.gpa, .OpExtInst, .{
497 try cg.module.sections.globals.emit(gpa, .OpExtInst, .{
512498 .id_result_type = fn_decl_ptr_ty_id,
513499 .id_result = result_id,
514500 .set = try cg.module.importInstructionSet(.zig),
......@@ -521,13 +507,14 @@ fn resolveUav(cg: *CodeGen, val: InternPool.Index) !Id {
521507}
522508
523509fn addFunctionDep(cg: *CodeGen, decl_index: Module.Decl.Index, storage_class: StorageClass) !void {
510 const gpa = cg.module.gpa;
524511 const target = cg.module.zcu.getTarget();
525512 if (target.cpu.has(.spirv, .v1_4)) {
526 try cg.decl_deps.put(cg.module.gpa, decl_index, {});
513 try cg.module.decl_deps.append(gpa, decl_index);
527514 } else {
528515 // Before version 1.4, the interface’s storage classes are limited to the Input and Output
529516 if (storage_class == .input or storage_class == .output) {
530 try cg.decl_deps.put(cg.module.gpa, decl_index, {});
517 try cg.module.decl_deps.append(gpa, decl_index);
531518 }
532519 }
533520}
......@@ -752,8 +739,10 @@ fn constructCompositeSplat(cg: *CodeGen, ty: Type, constituent: Id) !Id {
752739 const zcu = cg.module.zcu;
753740 const n: usize = @intCast(ty.arrayLen(zcu));
754741
755 const constituents = try gpa.alloc(Id, n);
756 defer gpa.free(constituents);
742 const scratch_top = cg.id_scratch.items.len;
743 defer cg.id_scratch.shrinkRetainingCapacity(scratch_top);
744
745 const constituents = try cg.id_scratch.addManyAsSlice(gpa, n);
757746 @memset(constituents, constituent);
758747
759748 const result_ty_id = try cg.resolveType(ty, .direct);
......@@ -928,8 +917,9 @@ fn constant(cg: *CodeGen, ty: Type, val: Value, repr: Repr) Error!Id {
928917 inline .array_type, .vector_type => |array_type, tag| {
929918 const elem_ty: Type = .fromInterned(array_type.child);
930919
931 const constituents = try gpa.alloc(Id, @intCast(ty.arrayLenIncludingSentinel(zcu)));
932 defer gpa.free(constituents);
920 const scratch_top = cg.id_scratch.items.len;
921 defer cg.id_scratch.shrinkRetainingCapacity(scratch_top);
922 const constituents = try cg.id_scratch.addManyAsSlice(gpa, @intCast(ty.arrayLenIncludingSentinel(zcu)));
933923
934924 const child_repr: Repr = switch (tag) {
935925 .array_type => .indirect,
......@@ -1044,6 +1034,7 @@ fn constantPtr(cg: *CodeGen, ptr_val: Value) !Id {
10441034}
10451035
10461036fn derivePtr(cg: *CodeGen, derivation: Value.PointerDeriveStep) !Id {
1037 const gpa = cg.module.gpa;
10471038 const pt = cg.pt;
10481039 const zcu = cg.module.zcu;
10491040 switch (derivation) {
......@@ -1055,7 +1046,7 @@ fn derivePtr(cg: *CodeGen, derivation: Value.PointerDeriveStep) !Id {
10551046 // as a runtime operation.
10561047 const result_ptr_id = cg.module.allocId();
10571048 const value_id = try cg.constInt(.usize, int.addr);
1058 try cg.body.emit(cg.module.gpa, .OpConvertUToPtr, .{
1049 try cg.body.emit(gpa, .OpConvertUToPtr, .{
10591050 .id_result_type = result_ty_id,
10601051 .id_result = result_ptr_id,
10611052 .integer_value = value_id,
......@@ -1103,7 +1094,7 @@ fn derivePtr(cg: *CodeGen, derivation: Value.PointerDeriveStep) !Id {
11031094 // Allow changing the pointer type child only to restructure arrays.
11041095 // e.g. [3][2]T to T is fine, as is [2]T -> [2][1]T.
11051096 const result_ptr_id = cg.module.allocId();
1106 try cg.body.emit(cg.module.gpa, .OpBitcast, .{
1097 try cg.body.emit(gpa, .OpBitcast, .{
11071098 .id_result_type = result_ty_id,
11081099 .id_result = result_ptr_id,
11091100 .operand = parent_ptr_id,
......@@ -1191,6 +1182,7 @@ fn constantNavRef(cg: *CodeGen, ty: Type, nav_index: InternPool.Nav.Index) !Id {
11911182
11921183 const spv_decl_index = try cg.module.resolveNav(ip, nav_index);
11931184 const spv_decl = cg.module.declPtr(spv_decl_index);
1185 const spv_decl_result_id = spv_decl.result_id;
11941186 assert(spv_decl.kind != .func);
11951187
11961188 const storage_class = cg.module.storageClass(nav.getAddrspace());
......@@ -1205,12 +1197,12 @@ fn constantNavRef(cg: *CodeGen, ty: Type, nav_index: InternPool.Nav.Index) !Id {
12051197 try cg.body.emit(cg.module.gpa, .OpBitcast, .{
12061198 .id_result_type = ty_id,
12071199 .id_result = casted_ptr_id,
1208 .operand = spv_decl.result_id,
1200 .operand = spv_decl_result_id,
12091201 });
12101202 return casted_ptr_id;
12111203 }
12121204
1213 return spv_decl.result_id;
1205 return spv_decl_result_id;
12141206}
12151207
12161208// Turn a Zig type's name into a cache reference.
......@@ -1430,8 +1422,11 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id {
14301422 }
14311423
14321424 const return_ty_id = try cg.resolveFnReturnType(.fromInterned(fn_info.return_type));
1433 const param_ty_ids = try gpa.alloc(Id, fn_info.param_types.len);
1434 defer gpa.free(param_ty_ids);
1425
1426 const scratch_top = cg.id_scratch.items.len;
1427 defer cg.id_scratch.shrinkRetainingCapacity(scratch_top);
1428 const param_ty_ids = try cg.id_scratch.addManyAsSlice(gpa, fn_info.param_types.len);
1429
14351430 var param_index: usize = 0;
14361431 for (fn_info.param_types.get(ip)) |param_ty_index| {
14371432 const param_ty: Type = .fromInterned(param_ty_index);
......@@ -1472,8 +1467,9 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id {
14721467 .@"struct" => {
14731468 const struct_type = switch (ip.indexToKey(ty.toIntern())) {
14741469 .tuple_type => |tuple| {
1475 const member_types = try gpa.alloc(Id, tuple.values.len);
1476 defer gpa.free(member_types);
1470 const scratch_top = cg.id_scratch.items.len;
1471 defer cg.id_scratch.shrinkRetainingCapacity(scratch_top);
1472 const member_types = try cg.id_scratch.addManyAsSlice(gpa, tuple.values.len);
14771473
14781474 var member_index: usize = 0;
14791475 for (tuple.types.get(ip), tuple.values.get(ip)) |field_ty, field_val| {
......@@ -1755,11 +1751,14 @@ const Temporary = struct {
17551751 .exploded_vector => |range| {
17561752 assert(temp.ty.isVector(zcu));
17571753 assert(temp.ty.vectorLen(zcu) == range.len);
1758 const constituents = try gpa.alloc(Id, range.len);
1759 defer gpa.free(constituents);
1754
1755 const scratch_top = cg.id_scratch.items.len;
1756 defer cg.id_scratch.shrinkRetainingCapacity(scratch_top);
1757 const constituents = try cg.id_scratch.addManyAsSlice(gpa, range.len);
17601758 for (constituents, 0..range.len) |*id, i| {
17611759 id.* = range.at(i);
17621760 }
1761
17631762 const result_ty_id = try cg.resolveType(temp.ty, .direct);
17641763 return cg.constructComposite(result_ty_id, constituents);
17651764 },
......@@ -2039,14 +2038,12 @@ fn buildFma(cg: *CodeGen, a: Temporary, b: Temporary, c: Temporary) !Temporary {
20392038 const op_c = try v.prepare(cg, c);
20402039
20412040 const set = try cg.importExtendedSet();
2042
2043 // TODO: Put these numbers in some definition
2044 const instruction: u32 = switch (target.os.tag) {
2045 .opencl => 26, // fma
2041 const opcode: u32 = switch (target.os.tag) {
2042 .opencl => @intFromEnum(spec.OpenClOpcode.fma),
20462043 // NOTE: Vulkan's FMA instruction does *NOT* produce the right values!
2047 // its precision guarantees do NOT match zigs and it does NOT match OpenCLs!
2048 // it needs to be emulated!
2049 .vulkan, .opengl => return cg.todo("implement fma operation for {s} os", .{@tagName(target.os.tag)}),
2044 // its precision guarantees do NOT match zigs and it does NOT match OpenCLs!
2045 // it needs to be emulated!
2046 .vulkan, .opengl => @intFromEnum(spec.GlslOpcode.Fma),
20502047 else => unreachable,
20512048 };
20522049
......@@ -2055,7 +2052,7 @@ fn buildFma(cg: *CodeGen, a: Temporary, b: Temporary, c: Temporary) !Temporary {
20552052 .id_result_type = op_result_ty_id,
20562053 .id_result = results.at(i),
20572054 .set = set,
2058 .instruction = .{ .inst = instruction },
2055 .instruction = .{ .inst = opcode },
20592056 .id_ref_4 = &.{ op_a.at(i), op_b.at(i), op_c.at(i) },
20602057 });
20612058 }
......@@ -2138,6 +2135,44 @@ const UnaryOp = enum {
21382135 log,
21392136 log2,
21402137 log10,
2138
2139 pub fn extInstOpcode(op: UnaryOp, target: *const std.Target) ?u32 {
2140 return switch (target.os.tag) {
2141 .opencl => @intFromEnum(@as(spec.OpenClOpcode, switch (op) {
2142 .i_abs => .s_abs,
2143 .f_abs => .fabs,
2144 .clz => .clz,
2145 .ctz => .ctz,
2146 .floor => .floor,
2147 .ceil => .ceil,
2148 .trunc => .trunc,
2149 .round => .round,
2150 .sqrt => .sqrt,
2151 .sin => .sin,
2152 .cos => .cos,
2153 .tan => .tan,
2154 .exp => .exp,
2155 .exp2 => .exp2,
2156 .log => .log,
2157 .log2 => .log2,
2158 .log10 => .log10,
2159 else => return null,
2160 })),
2161 // Note: We'll need to check these for floating point accuracy
2162 // Vulkan does not put tight requirements on these, for correction
2163 // we might want to emulate them at some point.
2164 .vulkan, .opengl => @intFromEnum(@as(spec.GlslOpcode, switch (op) {
2165 .i_abs => .SAbs,
2166 .f_abs => .FAbs,
2167 .floor => .Floor,
2168 .ceil => .Ceil,
2169 .trunc => .Trunc,
2170 .round => .Round,
2171 else => return null,
2172 })),
2173 else => unreachable,
2174 };
2175 }
21412176};
21422177
21432178fn buildUnary(cg: *CodeGen, op: UnaryOp, operand: Temporary) !Temporary {
......@@ -2149,84 +2184,36 @@ fn buildUnary(cg: *CodeGen, op: UnaryOp, operand: Temporary) !Temporary {
21492184 const op_result_ty = operand.ty.scalarType(zcu);
21502185 const op_result_ty_id = try cg.resolveType(op_result_ty, .direct);
21512186 const result_ty = try v.resultType(cg, operand.ty);
2152
21532187 const op_operand = try v.prepare(cg, operand);
21542188
2155 if (switch (op) {
2156 .l_not => .OpLogicalNot,
2157 .bit_not => .OpNot,
2158 .i_neg => .OpSNegate,
2159 .f_neg => .OpFNegate,
2160 else => @as(?Opcode, null),
2161 }) |opcode| {
2162 for (0..ops) |i| {
2163 try cg.body.emitRaw(cg.module.gpa, opcode, 3);
2164 cg.body.writeOperand(Id, op_result_ty_id);
2165 cg.body.writeOperand(Id, results.at(i));
2166 cg.body.writeOperand(Id, op_operand.at(i));
2167 }
2168 } else {
2189 if (op.extInstOpcode(target)) |opcode| {
21692190 const set = try cg.importExtendedSet();
2170 const extinst: u32 = switch (target.os.tag) {
2171 .opencl => switch (op) {
2172 .i_abs => 141, // s_abs
2173 .f_abs => 23, // fabs
2174 .clz => 151, // clz
2175 .ctz => 152, // ctz
2176 .floor => 25, // floor
2177 .ceil => 12, // ceil
2178 .trunc => 66, // trunc
2179 .round => 55, // round
2180 .sqrt => 61, // sqrt
2181 .sin => 57, // sin
2182 .cos => 14, // cos
2183 .tan => 62, // tan
2184 .exp => 19, // exp
2185 .exp2 => 20, // exp2
2186 .log => 37, // log
2187 .log2 => 38, // log2
2188 .log10 => 39, // log10
2189 else => unreachable,
2190 },
2191 // Note: We'll need to check these for floating point accuracy
2192 // Vulkan does not put tight requirements on these, for correction
2193 // we might want to emulate them at some point.
2194 .vulkan, .opengl => switch (op) {
2195 .i_abs => 5, // SAbs
2196 .f_abs => 4, // FAbs
2197 .floor => 8, // Floor
2198 .ceil => 9, // Ceil
2199 .trunc => 3, // Trunc
2200 .round => 1, // Round
2201 .clz,
2202 .ctz,
2203 .sqrt,
2204 .sin,
2205 .cos,
2206 .tan,
2207 .exp,
2208 .exp2,
2209 .log,
2210 .log2,
2211 .log10,
2212 => return cg.todo(
2213 "implement unary operation '{s}' for {s} os",
2214 .{ @tagName(op), @tagName(target.os.tag) },
2215 ),
2216 else => unreachable,
2217 },
2218 else => unreachable,
2219 };
2220
22212191 for (0..ops) |i| {
22222192 try cg.body.emit(cg.module.gpa, .OpExtInst, .{
22232193 .id_result_type = op_result_ty_id,
22242194 .id_result = results.at(i),
22252195 .set = set,
2226 .instruction = .{ .inst = extinst },
2196 .instruction = .{ .inst = opcode },
22272197 .id_ref_4 = &.{op_operand.at(i)},
22282198 });
22292199 }
2200 } else {
2201 const opcode: Opcode = switch (op) {
2202 .l_not => .OpLogicalNot,
2203 .bit_not => .OpNot,
2204 .i_neg => .OpSNegate,
2205 .f_neg => .OpFNegate,
2206 else => return cg.todo(
2207 "implement unary operation '{s}' for {s} os",
2208 .{ @tagName(op), @tagName(target.os.tag) },
2209 ),
2210 };
2211 for (0..ops) |i| {
2212 try cg.body.emitRaw(cg.module.gpa, opcode, 3);
2213 cg.body.writeOperand(Id, op_result_ty_id);
2214 cg.body.writeOperand(Id, results.at(i));
2215 cg.body.writeOperand(Id, op_operand.at(i));
2216 }
22302217 }
22312218
22322219 return v.finalize(result_ty, results);
......@@ -2288,9 +2275,9 @@ fn buildWideMul(
22882275 // OpUMulExtended. For these we will use the OpenCL s_mul_hi to compute the high-order bits
22892276 // instead.
22902277 const set = try cg.importExtendedSet();
2291 const overflow_inst: u32 = switch (signedness) {
2292 .signed => 160, // s_mul_hi
2293 .unsigned => 203, // u_mul_hi
2278 const overflow_inst: spec.OpenClOpcode = switch (signedness) {
2279 .signed => .s_mul_hi,
2280 .unsigned => .u_mul_hi,
22942281 };
22952282
22962283 for (0..ops) |i| {
......@@ -2305,7 +2292,7 @@ fn buildWideMul(
23052292 .id_result_type = arith_op_ty_id,
23062293 .id_result = overflow_results.at(i),
23072294 .set = set,
2308 .instruction = .{ .inst = overflow_inst },
2295 .instruction = .{ .inst = @intFromEnum(overflow_inst) },
23092296 .id_ref_4 = &.{ lhs_op.at(i), rhs_op.at(i) },
23102297 });
23112298 }
......@@ -2428,7 +2415,7 @@ fn generateTestEntryPoint(
24282415 .vulkan, .opengl => {
24292416 if (cg.module.error_buffer == null) {
24302417 const spv_err_decl_index = try cg.module.allocDecl(.global);
2431 try cg.module.declareDeclDeps(spv_err_decl_index, &.{});
2418 const err_buf_result_id = cg.module.declPtr(spv_err_decl_index).result_id;
24322419
24332420 const buffer_struct_ty_id = try cg.module.structType(
24342421 &.{anyerror_ty_id},
......@@ -2446,14 +2433,13 @@ fn generateTestEntryPoint(
24462433 .type = buffer_struct_ty_id,
24472434 });
24482435
2449 const buffer_struct_id = cg.module.declPtr(spv_err_decl_index).result_id;
24502436 try cg.module.sections.globals.emit(gpa, .OpVariable, .{
24512437 .id_result_type = ptr_buffer_struct_ty_id,
2452 .id_result = buffer_struct_id,
2438 .id_result = err_buf_result_id,
24532439 .storage_class = cg.module.storageClass(.global),
24542440 });
2455 try cg.module.decorate(buffer_struct_id, .{ .descriptor_set = .{ .descriptor_set = 0 } });
2456 try cg.module.decorate(buffer_struct_id, .{ .binding = .{ .binding_point = 0 } });
2441 try cg.module.decorate(err_buf_result_id, .{ .descriptor_set = .{ .descriptor_set = 0 } });
2442 try cg.module.decorate(err_buf_result_id, .{ .binding = .{ .binding_point = 0 } });
24572443
24582444 cg.module.error_buffer = spv_err_decl_index;
24592445 }
......@@ -2481,7 +2467,7 @@ fn generateTestEntryPoint(
24812467
24822468 const spv_err_decl_index = cg.module.error_buffer.?;
24832469 const buffer_id = cg.module.declPtr(spv_err_decl_index).result_id;
2484 try cg.decl_deps.put(gpa, spv_err_decl_index, {});
2470 try cg.module.decl_deps.append(gpa, spv_err_decl_index);
24852471
24862472 const zero_id = try cg.constInt(.u32, 0);
24872473 try section.emit(gpa, .OpInBoundsAccessChain, .{
......@@ -2867,7 +2853,54 @@ fn airShift(cg: *CodeGen, inst: Air.Inst.Index, unsigned: Opcode, signed: Opcode
28672853 return try result.materialize(cg);
28682854}
28692855
2870const MinMax = enum { min, max };
2856const MinMax = enum {
2857 min,
2858 max,
2859
2860 pub fn extInstOpcode(
2861 op: MinMax,
2862 target: *const std.Target,
2863 info: ArithmeticTypeInfo,
2864 ) u32 {
2865 return switch (target.os.tag) {
2866 .opencl => @intFromEnum(@as(spec.OpenClOpcode, switch (info.class) {
2867 .float => switch (op) {
2868 .min => .fmin,
2869 .max => .fmax,
2870 },
2871 .integer, .strange_integer, .composite_integer => switch (info.signedness) {
2872 .signed => switch (op) {
2873 .min => .s_min,
2874 .max => .s_max,
2875 },
2876 .unsigned => switch (op) {
2877 .min => .u_min,
2878 .max => .u_max,
2879 },
2880 },
2881 .bool => unreachable,
2882 })),
2883 .vulkan, .opengl => @intFromEnum(@as(spec.GlslOpcode, switch (info.class) {
2884 .float => switch (op) {
2885 .min => .FMin,
2886 .max => .FMax,
2887 },
2888 .integer, .strange_integer, .composite_integer => switch (info.signedness) {
2889 .signed => switch (op) {
2890 .min => .SMin,
2891 .max => .SMax,
2892 },
2893 .unsigned => switch (op) {
2894 .min => .UMin,
2895 .max => .UMax,
2896 },
2897 },
2898 .bool => unreachable,
2899 })),
2900 else => unreachable,
2901 };
2902 }
2903};
28712904
28722905fn airMinMax(cg: *CodeGen, inst: Air.Inst.Index, op: MinMax) !?Id {
28732906 const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
......@@ -2895,57 +2928,14 @@ fn minMax(cg: *CodeGen, lhs: Temporary, rhs: Temporary, op: MinMax) !Temporary {
28952928 const op_lhs = try v.prepare(cg, lhs);
28962929 const op_rhs = try v.prepare(cg, rhs);
28972930
2898 const ext_inst: u32 = switch (target.os.tag) {
2899 .opencl => switch (info.class) {
2900 .float => switch (op) {
2901 .min => 28, // fmin
2902 .max => 27, // fmax
2903 },
2904 .integer,
2905 .strange_integer,
2906 .composite_integer,
2907 => switch (info.signedness) {
2908 .signed => switch (op) {
2909 .min => 158, // s_min
2910 .max => 156, // s_max
2911 },
2912 .unsigned => switch (op) {
2913 .min => 159, // u_min
2914 .max => 157, // u_max
2915 },
2916 },
2917 .bool => unreachable,
2918 },
2919 .vulkan, .opengl => switch (info.class) {
2920 .float => switch (op) {
2921 .min => 37, // FMin
2922 .max => 40, // FMax
2923 },
2924 .integer,
2925 .strange_integer,
2926 .composite_integer,
2927 => switch (info.signedness) {
2928 .signed => switch (op) {
2929 .min => 39, // SMin
2930 .max => 42, // SMax
2931 },
2932 .unsigned => switch (op) {
2933 .min => 38, // UMin
2934 .max => 41, // UMax
2935 },
2936 },
2937 .bool => unreachable,
2938 },
2939 else => unreachable,
2940 };
2941
29422931 const set = try cg.importExtendedSet();
2932 const opcode = op.extInstOpcode(target, info);
29432933 for (0..ops) |i| {
29442934 try cg.body.emit(cg.module.gpa, .OpExtInst, .{
29452935 .id_result_type = op_result_ty_id,
29462936 .id_result = results.at(i),
29472937 .set = set,
2948 .instruction = .{ .inst = ext_inst },
2938 .instruction = .{ .inst = opcode },
29492939 .id_ref_4 = &.{ op_lhs.at(i), op_rhs.at(i) },
29502940 });
29512941 }
......@@ -3562,8 +3552,9 @@ fn airShuffleOne(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
35623552 const elem_ty = result_ty.childType(zcu);
35633553 const operand = try cg.resolve(unwrapped.operand);
35643554
3565 const constituents = try gpa.alloc(Id, mask.len);
3566 defer gpa.free(constituents);
3555 const scratch_top = cg.id_scratch.items.len;
3556 defer cg.id_scratch.shrinkRetainingCapacity(scratch_top);
3557 const constituents = try cg.id_scratch.addManyAsSlice(gpa, mask.len);
35673558
35683559 for (constituents, mask) |*id, mask_elem| {
35693560 id.* = switch (mask_elem.unwrap()) {
......@@ -3588,8 +3579,9 @@ fn airShuffleTwo(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
35883579 const operand_a = try cg.resolve(unwrapped.operand_a);
35893580 const operand_b = try cg.resolve(unwrapped.operand_b);
35903581
3591 const constituents = try gpa.alloc(Id, mask.len);
3592 defer gpa.free(constituents);
3582 const scratch_top = cg.id_scratch.items.len;
3583 defer cg.id_scratch.shrinkRetainingCapacity(scratch_top);
3584 const constituents = try cg.id_scratch.addManyAsSlice(gpa, mask.len);
35933585
35943586 for (constituents, mask) |*id, mask_elem| {
35953587 id.* = switch (mask_elem.unwrap()) {
......@@ -3603,17 +3595,6 @@ fn airShuffleTwo(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
36033595 return try cg.constructComposite(result_ty_id, constituents);
36043596}
36053597
3606fn indicesToIds(cg: *CodeGen, indices: []const u32) ![]Id {
3607 const gpa = cg.module.gpa;
3608 const ids = try gpa.alloc(Id, indices.len);
3609 errdefer gpa.free(ids);
3610 for (indices, ids) |index, *id| {
3611 id.* = try cg.constInt(.u32, index);
3612 }
3613
3614 return ids;
3615}
3616
36173598fn accessChainId(
36183599 cg: *CodeGen,
36193600 result_ty_id: Id,
......@@ -3641,8 +3622,12 @@ fn accessChain(
36413622 indices: []const u32,
36423623) !Id {
36433624 const gpa = cg.module.gpa;
3644 const ids = try cg.indicesToIds(indices);
3645 defer gpa.free(ids);
3625 const scratch_top = cg.id_scratch.items.len;
3626 defer cg.id_scratch.shrinkRetainingCapacity(scratch_top);
3627 const ids = try cg.id_scratch.addManyAsSlice(gpa, indices.len);
3628 for (indices, ids) |index, *id| {
3629 id.* = try cg.constInt(.u32, index);
3630 }
36463631 return try cg.accessChainId(result_ty_id, base, ids);
36473632}
36483633
......@@ -3655,13 +3640,18 @@ fn ptrAccessChain(
36553640) !Id {
36563641 const gpa = cg.module.gpa;
36573642 const target = cg.module.zcu.getTarget();
3658 const ids = try cg.indicesToIds(indices);
3659 defer gpa.free(ids);
3643
3644 const scratch_top = cg.id_scratch.items.len;
3645 defer cg.id_scratch.shrinkRetainingCapacity(scratch_top);
3646 const ids = try cg.id_scratch.addManyAsSlice(gpa, indices.len);
3647 for (indices, ids) |index, *id| {
3648 id.* = try cg.constInt(.u32, index);
3649 }
36603650
36613651 const result_id = cg.module.allocId();
36623652 switch (target.os.tag) {
36633653 .opencl, .amdhsa => {
3664 try cg.body.emit(cg.module.gpa, .OpInBoundsPtrAccessChain, .{
3654 try cg.body.emit(gpa, .OpInBoundsPtrAccessChain, .{
36653655 .id_result_type = result_ty_id,
36663656 .id_result = result_id,
36673657 .base = base,
......@@ -3669,8 +3659,8 @@ fn ptrAccessChain(
36693659 .indexes = ids,
36703660 });
36713661 },
3672 else => {
3673 try cg.body.emit(cg.module.gpa, .OpPtrAccessChain, .{
3662 .vulkan, .opengl => {
3663 try cg.body.emit(gpa, .OpPtrAccessChain, .{
36743664 .id_result_type = result_ty_id,
36753665 .id_result = result_id,
36763666 .base = base,
......@@ -3678,6 +3668,7 @@ fn ptrAccessChain(
36783668 .indexes = ids,
36793669 });
36803670 },
3671 else => unreachable,
36813672 }
36823673 return result_id;
36833674}
......@@ -3739,6 +3730,7 @@ fn cmp(
37393730 lhs: Temporary,
37403731 rhs: Temporary,
37413732) !Temporary {
3733 const gpa = cg.module.gpa;
37423734 const pt = cg.pt;
37433735 const zcu = cg.module.zcu;
37443736 const ip = &zcu.intern_pool;
......@@ -3771,14 +3763,14 @@ fn cmp(
37713763 const usize_ty_id = try cg.resolveType(.usize, .direct);
37723764
37733765 const lhs_int_id = cg.module.allocId();
3774 try cg.body.emit(cg.module.gpa, .OpConvertPtrToU, .{
3766 try cg.body.emit(gpa, .OpConvertPtrToU, .{
37753767 .id_result_type = usize_ty_id,
37763768 .id_result = lhs_int_id,
37773769 .pointer = try lhs.materialize(cg),
37783770 });
37793771
37803772 const rhs_int_id = cg.module.allocId();
3781 try cg.body.emit(cg.module.gpa, .OpConvertPtrToU, .{
3773 try cg.body.emit(gpa, .OpConvertPtrToU, .{
37823774 .id_result_type = usize_ty_id,
37833775 .id_result = rhs_int_id,
37843776 .pointer = try rhs.materialize(cg),
......@@ -3937,6 +3929,7 @@ fn bitCast(
39373929 src_ty: Type,
39383930 src_id: Id,
39393931) !Id {
3932 const gpa = cg.module.gpa;
39403933 const zcu = cg.module.zcu;
39413934 const src_ty_id = try cg.resolveType(src_ty, .direct);
39423935 const dst_ty_id = try cg.resolveType(dst_ty, .direct);
......@@ -3949,7 +3942,7 @@ fn bitCast(
39493942
39503943 if (src_ty.zigTypeTag(zcu) == .int and dst_ty.isPtrAtRuntime(zcu)) {
39513944 const result_id = cg.module.allocId();
3952 try cg.body.emit(cg.module.gpa, .OpConvertUToPtr, .{
3945 try cg.body.emit(gpa, .OpConvertUToPtr, .{
39533946 .id_result_type = dst_ty_id,
39543947 .id_result = result_id,
39553948 .integer_value = src_id,
......@@ -3963,7 +3956,7 @@ fn bitCast(
39633956 const can_bitcast = (src_ty.isNumeric(zcu) and dst_ty.isNumeric(zcu)) or (src_ty.isPtrAtRuntime(zcu) and dst_ty.isPtrAtRuntime(zcu));
39643957 if (can_bitcast) {
39653958 const result_id = cg.module.allocId();
3966 try cg.body.emit(cg.module.gpa, .OpBitcast, .{
3959 try cg.body.emit(gpa, .OpBitcast, .{
39673960 .id_result_type = dst_ty_id,
39683961 .id_result = result_id,
39693962 .operand = src_id,
......@@ -3977,7 +3970,7 @@ fn bitCast(
39773970 const tmp_id = try cg.alloc(src_ty, .{ .storage_class = .function });
39783971 try cg.store(src_ty, tmp_id, src_id, .{});
39793972 const casted_ptr_id = cg.module.allocId();
3980 try cg.body.emit(cg.module.gpa, .OpBitcast, .{
3973 try cg.body.emit(gpa, .OpBitcast, .{
39813974 .id_result_type = dst_ptr_ty_id,
39823975 .id_result = casted_ptr_id,
39833976 .operand = tmp_id,
......@@ -4057,16 +4050,17 @@ fn airFloatFromInt(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
40574050}
40584051
40594052fn floatFromInt(cg: *CodeGen, result_ty: Type, operand_ty: Type, operand_id: Id) !Id {
4053 const gpa = cg.module.gpa;
40604054 const operand_info = cg.arithmeticTypeInfo(operand_ty);
40614055 const result_id = cg.module.allocId();
40624056 const result_ty_id = try cg.resolveType(result_ty, .direct);
40634057 switch (operand_info.signedness) {
4064 .signed => try cg.body.emit(cg.module.gpa, .OpConvertSToF, .{
4058 .signed => try cg.body.emit(gpa, .OpConvertSToF, .{
40654059 .id_result_type = result_ty_id,
40664060 .id_result = result_id,
40674061 .signed_value = operand_id,
40684062 }),
4069 .unsigned => try cg.body.emit(cg.module.gpa, .OpConvertUToF, .{
4063 .unsigned => try cg.body.emit(gpa, .OpConvertUToF, .{
40704064 .id_result_type = result_ty_id,
40714065 .id_result = result_id,
40724066 .unsigned_value = operand_id,
......@@ -4083,16 +4077,17 @@ fn airIntFromFloat(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
40834077}
40844078
40854079fn intFromFloat(cg: *CodeGen, result_ty: Type, operand_id: Id) !Id {
4080 const gpa = cg.module.gpa;
40864081 const result_info = cg.arithmeticTypeInfo(result_ty);
40874082 const result_ty_id = try cg.resolveType(result_ty, .direct);
40884083 const result_id = cg.module.allocId();
40894084 switch (result_info.signedness) {
4090 .signed => try cg.body.emit(cg.module.gpa, .OpConvertFToS, .{
4085 .signed => try cg.body.emit(gpa, .OpConvertFToS, .{
40914086 .id_result_type = result_ty_id,
40924087 .id_result = result_id,
40934088 .float_value = operand_id,
40944089 }),
4095 .unsigned => try cg.body.emit(cg.module.gpa, .OpConvertFToU, .{
4090 .unsigned => try cg.body.emit(gpa, .OpConvertFToU, .{
40964091 .id_result_type = result_ty_id,
40974092 .id_result = result_id,
40984093 .float_value = operand_id,
......@@ -4214,10 +4209,13 @@ fn airAggregateInit(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
42144209 return running_int_id;
42154210 }
42164211
4212 const scratch_top = cg.id_scratch.items.len;
4213 defer cg.id_scratch.shrinkRetainingCapacity(scratch_top);
4214 const constituents = try cg.id_scratch.addManyAsSlice(gpa, elements.len);
4215
42174216 const types = try gpa.alloc(Type, elements.len);
42184217 defer gpa.free(types);
4219 const constituents = try gpa.alloc(Id, elements.len);
4220 defer gpa.free(constituents);
4218
42214219 var index: usize = 0;
42224220
42234221 switch (ip.indexToKey(result_ty.toIntern())) {
......@@ -4255,8 +4253,9 @@ fn airAggregateInit(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
42554253 },
42564254 .vector => {
42574255 const n_elems = result_ty.vectorLen(zcu);
4258 const elem_ids = try gpa.alloc(Id, n_elems);
4259 defer gpa.free(elem_ids);
4256 const scratch_top = cg.id_scratch.items.len;
4257 defer cg.id_scratch.shrinkRetainingCapacity(scratch_top);
4258 const elem_ids = try cg.id_scratch.addManyAsSlice(gpa, n_elems);
42604259
42614260 for (elements, 0..) |element, i| {
42624261 elem_ids[i] = try cg.resolve(element);
......@@ -4268,8 +4267,9 @@ fn airAggregateInit(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
42684267 .array => {
42694268 const array_info = result_ty.arrayInfo(zcu);
42704269 const n_elems: usize = @intCast(result_ty.arrayLenIncludingSentinel(zcu));
4271 const elem_ids = try gpa.alloc(Id, n_elems);
4272 defer gpa.free(elem_ids);
4270 const scratch_top = cg.id_scratch.items.len;
4271 defer cg.id_scratch.shrinkRetainingCapacity(scratch_top);
4272 const elem_ids = try cg.id_scratch.addManyAsSlice(gpa, n_elems);
42734273
42744274 for (elements, 0..) |element, i| {
42754275 const id = try cg.resolve(element);
......@@ -4407,6 +4407,7 @@ fn airPtrElemPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
44074407}
44084408
44094409fn airArrayElemVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
4410 const gpa = cg.module.gpa;
44104411 const zcu = cg.module.zcu;
44114412 const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
44124413 const array_ty = cg.typeOf(bin_op.lhs);
......@@ -4427,13 +4428,13 @@ fn airArrayElemVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
44274428 const ptr_elem_ty_id = try cg.module.ptrType(elem_ty_id, .function);
44284429
44294430 const tmp_id = cg.module.allocId();
4430 try cg.prologue.emit(cg.module.gpa, .OpVariable, .{
4431 try cg.prologue.emit(gpa, .OpVariable, .{
44314432 .id_result_type = ptr_array_ty_id,
44324433 .id_result = tmp_id,
44334434 .storage_class = .function,
44344435 });
44354436
4436 try cg.body.emit(cg.module.gpa, .OpStore, .{
4437 try cg.body.emit(gpa, .OpStore, .{
44374438 .pointer = tmp_id,
44384439 .object = array_id,
44394440 });
......@@ -4441,7 +4442,7 @@ fn airArrayElemVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
44414442 const elem_ptr_id = try cg.accessChainId(ptr_elem_ty_id, tmp_id, &.{index_id});
44424443
44434444 const result_id = cg.module.allocId();
4444 try cg.body.emit(cg.module.gpa, .OpLoad, .{
4445 try cg.body.emit(gpa, .OpLoad, .{
44454446 .id_result_type = try cg.resolveType(elem_ty, elem_repr),
44464447 .id_result = result_id,
44474448 .pointer = elem_ptr_id,
......@@ -4914,7 +4915,7 @@ fn structuredBreak(cg: *CodeGen, target_block: Id) !void {
49144915 .loop => unreachable,
49154916 };
49164917
4917 try cg.body.emitBranch(cg.module.gpa, merge_block);
4918 try cg.body.emit(gpa, .OpBranch, .{ .target_label = merge_block });
49184919}
49194920
49204921/// Generate a body in a way that exits the body using only structured constructs.
......@@ -4997,7 +4998,8 @@ fn genStructuredBody(
49974998 while (i > 0) {
49984999 i -= 1;
49995000 const step = merge_stack[i];
5000 try cg.body.emitBranch(cg.module.gpa, step.merge_block);
5001
5002 try cg.body.emit(gpa, .OpBranch, .{ .target_label = step.merge_block });
50015003 try cg.beginSpvBlock(step.merge_block);
50025004 const next_block = try cg.structuredNextBlock(&.{ incoming, step.incoming });
50035005 incoming = .{
......@@ -5010,7 +5012,8 @@ fn genStructuredBody(
50105012 },
50115013 .loop => |merge| {
50125014 // Close the loop by jumping to the continue label
5013 try cg.body.emitBranch(cg.module.gpa, block_merge_type.loop.continue_label);
5015
5016 try cg.body.emit(gpa, .OpBranch, .{ .target_label = block_merge_type.loop.continue_label });
50145017 // For blocks we must simple merge all the incoming blocks to get the next block.
50155018 try cg.beginSpvBlock(merge.merge_block);
50165019 return try cg.structuredNextBlock(merge.merges.items);
......@@ -5064,7 +5067,7 @@ fn lowerBlock(cg: *CodeGen, inst: Air.Inst.Index, body: []const Air.Inst.Index)
50645067 const result_type_id = try cg.resolveType(ty, .direct);
50655068
50665069 try cg.body.emitRaw(
5067 cg.module.gpa,
5070 gpa,
50685071 .OpPhi,
50695072 // result type + result + variable/parent...
50705073 2 + @as(u16, @intCast(block.incoming_blocks.items.len * 2)),
......@@ -5100,7 +5103,7 @@ fn lowerBlock(cg: *CodeGen, inst: Air.Inst.Index, body: []const Air.Inst.Index)
51005103 const this_block = try cg.constInt(.u32, @intFromEnum(inst));
51015104 const jump_to_this_block_id = cg.module.allocId();
51025105 const bool_ty_id = try cg.resolveType(.bool, .direct);
5103 try cg.body.emit(cg.module.gpa, .OpIEqual, .{
5106 try cg.body.emit(gpa, .OpIEqual, .{
51045107 .id_result_type = bool_ty_id,
51055108 .id_result = jump_to_this_block_id,
51065109 .operand_1 = next_block,
......@@ -5120,11 +5123,11 @@ fn lowerBlock(cg: *CodeGen, inst: Air.Inst.Index, body: []const Air.Inst.Index)
51205123 // generate a conditional branch to there and to the instructions following this block.
51215124 const merge_label = cg.module.allocId();
51225125 const then_label = cg.module.allocId();
5123 try cg.body.emit(cg.module.gpa, .OpSelectionMerge, .{
5126 try cg.body.emit(gpa, .OpSelectionMerge, .{
51245127 .merge_block = merge_label,
51255128 .selection_control = .{},
51265129 });
5127 try cg.body.emit(cg.module.gpa, .OpBranchConditional, .{
5130 try cg.body.emit(gpa, .OpBranchConditional, .{
51285131 .condition = jump_to_this_block_id,
51295132 .true_label = then_label,
51305133 .false_label = merge_label,
......@@ -5143,7 +5146,7 @@ fn lowerBlock(cg: *CodeGen, inst: Air.Inst.Index, body: []const Air.Inst.Index)
51435146 // To jump out of a loop block, generate a conditional that exits the block
51445147 // to the loop merge if the target ID is not the one of this block.
51455148 const continue_label = cg.module.allocId();
5146 try cg.body.emit(cg.module.gpa, .OpBranchConditional, .{
5149 try cg.body.emit(gpa, .OpBranchConditional, .{
51475150 .condition = jump_to_this_block_id,
51485151 .true_label = continue_label,
51495152 .false_label = merge.merge_block,
......@@ -5197,12 +5200,13 @@ fn airBr(cg: *CodeGen, inst: Air.Inst.Index) !void {
51975200 block.label = cg.module.allocId();
51985201 }
51995202
5200 try cg.body.emitBranch(cg.module.gpa, block.label.?);
5203 try cg.body.emit(gpa, .OpBranch, .{ .target_label = block.label.? });
52015204 },
52025205 }
52035206}
52045207
52055208fn airCondBr(cg: *CodeGen, inst: Air.Inst.Index) !void {
5209 const gpa = cg.module.gpa;
52065210 const pl_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].pl_op;
52075211 const cond_br = cg.air.extraData(Air.CondBr, pl_op.payload);
52085212 const then_body: []const Air.Inst.Index = @ptrCast(cg.air.extra.items[cond_br.end..][0..cond_br.data.then_body_len]);
......@@ -5216,11 +5220,11 @@ fn airCondBr(cg: *CodeGen, inst: Air.Inst.Index) !void {
52165220 .structured => {
52175221 const merge_label = cg.module.allocId();
52185222
5219 try cg.body.emit(cg.module.gpa, .OpSelectionMerge, .{
5223 try cg.body.emit(gpa, .OpSelectionMerge, .{
52205224 .merge_block = merge_label,
52215225 .selection_control = .{},
52225226 });
5223 try cg.body.emit(cg.module.gpa, .OpBranchConditional, .{
5227 try cg.body.emit(gpa, .OpBranchConditional, .{
52245228 .condition = condition_id,
52255229 .true_label = then_label,
52265230 .false_label = else_label,
......@@ -5232,7 +5236,8 @@ fn airCondBr(cg: *CodeGen, inst: Air.Inst.Index) !void {
52325236 .src_label = cg.block_label,
52335237 .next_block = then_next,
52345238 };
5235 try cg.body.emitBranch(cg.module.gpa, merge_label);
5239
5240 try cg.body.emit(gpa, .OpBranch, .{ .target_label = merge_label });
52365241
52375242 try cg.beginSpvBlock(else_label);
52385243 const else_next = try cg.genStructuredBody(.selection, else_body);
......@@ -5240,7 +5245,8 @@ fn airCondBr(cg: *CodeGen, inst: Air.Inst.Index) !void {
52405245 .src_label = cg.block_label,
52415246 .next_block = else_next,
52425247 };
5243 try cg.body.emitBranch(cg.module.gpa, merge_label);
5248
5249 try cg.body.emit(gpa, .OpBranch, .{ .target_label = merge_label });
52445250
52455251 try cg.beginSpvBlock(merge_label);
52465252 const next_block = try cg.structuredNextBlock(&.{ then_incoming, else_incoming });
......@@ -5248,7 +5254,7 @@ fn airCondBr(cg: *CodeGen, inst: Air.Inst.Index) !void {
52485254 try cg.structuredBreak(next_block);
52495255 },
52505256 .unstructured => {
5251 try cg.body.emit(cg.module.gpa, .OpBranchConditional, .{
5257 try cg.body.emit(gpa, .OpBranchConditional, .{
52525258 .condition = condition_id,
52535259 .true_label = then_label,
52545260 .false_label = else_label,
......@@ -5263,6 +5269,7 @@ fn airCondBr(cg: *CodeGen, inst: Air.Inst.Index) !void {
52635269}
52645270
52655271fn airLoop(cg: *CodeGen, inst: Air.Inst.Index) !void {
5272 const gpa = cg.module.gpa;
52665273 const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
52675274 const loop = cg.air.extraData(Air.Block, ty_pl.payload);
52685275 const body: []const Air.Inst.Index = @ptrCast(cg.air.extra.items[loop.end..][0..loop.data.body_len]);
......@@ -5278,16 +5285,18 @@ fn airLoop(cg: *CodeGen, inst: Air.Inst.Index) !void {
52785285 // The back-edge must point to the loop header, so generate a separate block for the
52795286 // loop header so that we don't accidentally include some instructions from there
52805287 // in the loop.
5281 try cg.body.emitBranch(cg.module.gpa, header_label);
5288
5289 try cg.body.emit(gpa, .OpBranch, .{ .target_label = header_label });
52825290 try cg.beginSpvBlock(header_label);
52835291
52845292 // Emit loop header and jump to loop body
5285 try cg.body.emit(cg.module.gpa, .OpLoopMerge, .{
5293 try cg.body.emit(gpa, .OpLoopMerge, .{
52865294 .merge_block = merge_label,
52875295 .continue_target = continue_label,
52885296 .loop_control = .{},
52895297 });
5290 try cg.body.emitBranch(cg.module.gpa, body_label);
5298
5299 try cg.body.emit(gpa, .OpBranch, .{ .target_label = body_label });
52915300
52925301 try cg.beginSpvBlock(body_label);
52935302
......@@ -5298,13 +5307,15 @@ fn airLoop(cg: *CodeGen, inst: Air.Inst.Index) !void {
52985307 try cg.structuredBreak(next_block);
52995308
53005309 try cg.beginSpvBlock(continue_label);
5301 try cg.body.emitBranch(cg.module.gpa, header_label);
5310
5311 try cg.body.emit(gpa, .OpBranch, .{ .target_label = header_label });
53025312 },
53035313 .unstructured => {
5304 try cg.body.emitBranch(cg.module.gpa, body_label);
5314 try cg.body.emit(gpa, .OpBranch, .{ .target_label = body_label });
53055315 try cg.beginSpvBlock(body_label);
53065316 try cg.genBody(body);
5307 try cg.body.emitBranch(cg.module.gpa, body_label);
5317
5318 try cg.body.emit(gpa, .OpBranch, .{ .target_label = body_label });
53085319 },
53095320 }
53105321}
......@@ -5332,6 +5343,7 @@ fn airStore(cg: *CodeGen, inst: Air.Inst.Index) !void {
53325343}
53335344
53345345fn airRet(cg: *CodeGen, inst: Air.Inst.Index) !void {
5346 const gpa = cg.module.gpa;
53355347 const zcu = cg.module.zcu;
53365348 const operand = cg.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
53375349 const ret_ty = cg.typeOf(operand);
......@@ -5342,17 +5354,18 @@ fn airRet(cg: *CodeGen, inst: Air.Inst.Index) !void {
53425354 // return type and return zero so they can be function pointers coerced
53435355 // to functions that return anyerror.
53445356 const no_err_id = try cg.constInt(.anyerror, 0);
5345 return try cg.body.emit(cg.module.gpa, .OpReturnValue, .{ .value = no_err_id });
5357 return try cg.body.emit(gpa, .OpReturnValue, .{ .value = no_err_id });
53465358 } else {
5347 return try cg.body.emit(cg.module.gpa, .OpReturn, {});
5359 return try cg.body.emit(gpa, .OpReturn, {});
53485360 }
53495361 }
53505362
53515363 const operand_id = try cg.resolve(operand);
5352 try cg.body.emit(cg.module.gpa, .OpReturnValue, .{ .value = operand_id });
5364 try cg.body.emit(gpa, .OpReturnValue, .{ .value = operand_id });
53535365}
53545366
53555367fn airRetLoad(cg: *CodeGen, inst: Air.Inst.Index) !void {
5368 const gpa = cg.module.gpa;
53565369 const zcu = cg.module.zcu;
53575370 const un_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
53585371 const ptr_ty = cg.typeOf(un_op);
......@@ -5365,20 +5378,21 @@ fn airRetLoad(cg: *CodeGen, inst: Air.Inst.Index) !void {
53655378 // return type and return zero so they can be function pointers coerced
53665379 // to functions that return anyerror.
53675380 const no_err_id = try cg.constInt(.anyerror, 0);
5368 return try cg.body.emit(cg.module.gpa, .OpReturnValue, .{ .value = no_err_id });
5381 return try cg.body.emit(gpa, .OpReturnValue, .{ .value = no_err_id });
53695382 } else {
5370 return try cg.body.emit(cg.module.gpa, .OpReturn, {});
5383 return try cg.body.emit(gpa, .OpReturn, {});
53715384 }
53725385 }
53735386
53745387 const ptr = try cg.resolve(un_op);
53755388 const value = try cg.load(ret_ty, ptr, .{ .is_volatile = ptr_ty.isVolatilePtr(zcu) });
5376 try cg.body.emit(cg.module.gpa, .OpReturnValue, .{
5389 try cg.body.emit(gpa, .OpReturnValue, .{
53775390 .value = value,
53785391 });
53795392}
53805393
53815394fn airTry(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
5395 const gpa = cg.module.gpa;
53825396 const zcu = cg.module.zcu;
53835397 const pl_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].pl_op;
53845398 const err_union_id = try cg.resolve(pl_op.operand);
......@@ -5400,7 +5414,7 @@ fn airTry(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
54005414
54015415 const zero_id = try cg.constInt(.anyerror, 0);
54025416 const is_err_id = cg.module.allocId();
5403 try cg.body.emit(cg.module.gpa, .OpINotEqual, .{
5417 try cg.body.emit(gpa, .OpINotEqual, .{
54045418 .id_result_type = bool_ty_id,
54055419 .id_result = is_err_id,
54065420 .operand_1 = err_id,
......@@ -5420,7 +5434,7 @@ fn airTry(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
54205434 // to not break and end in a return instruction. Thus,
54215435 // for structured control flow, we can just naively use
54225436 // the ok block as the merge block here.
5423 try cg.body.emit(cg.module.gpa, .OpSelectionMerge, .{
5437 try cg.body.emit(gpa, .OpSelectionMerge, .{
54245438 .merge_block = ok_block,
54255439 .selection_control = .{},
54265440 });
......@@ -5428,7 +5442,7 @@ fn airTry(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
54285442 .unstructured => {},
54295443 }
54305444
5431 try cg.body.emit(cg.module.gpa, .OpBranchConditional, .{
5445 try cg.body.emit(gpa, .OpBranchConditional, .{
54325446 .condition = is_err_id,
54335447 .true_label = err_block,
54345448 .false_label = ok_block,
......@@ -5768,14 +5782,14 @@ fn airSwitchBr(cg: *CodeGen, inst: Air.Inst.Index) !void {
57685782 };
57695783
57705784 if (cg.control_flow == .structured) {
5771 try cg.body.emit(cg.module.gpa, .OpSelectionMerge, .{
5785 try cg.body.emit(gpa, .OpSelectionMerge, .{
57725786 .merge_block = merge_label.?,
57735787 .selection_control = .{},
57745788 });
57755789 }
57765790
57775791 // Emit the instruction before generating the blocks.
5778 try cg.body.emitRaw(cg.module.gpa, .OpSwitch, 2 + (cond_words + 1) * num_conditions);
5792 try cg.body.emitRaw(gpa, .OpSwitch, 2 + (cond_words + 1) * num_conditions);
57795793 cg.body.writeOperand(Id, cond_indirect);
57805794 cg.body.writeOperand(Id, default);
57815795
......@@ -5830,7 +5844,8 @@ fn airSwitchBr(cg: *CodeGen, inst: Air.Inst.Index) !void {
58305844 .src_label = cg.block_label,
58315845 .next_block = next_block,
58325846 });
5833 try cg.body.emitBranch(cg.module.gpa, merge_label.?);
5847
5848 try cg.body.emit(gpa, .OpBranch, .{ .target_label = merge_label.? });
58345849 },
58355850 .unstructured => {
58365851 try cg.genBody(case.body);
......@@ -5848,14 +5863,15 @@ fn airSwitchBr(cg: *CodeGen, inst: Air.Inst.Index) !void {
58485863 .src_label = cg.block_label,
58495864 .next_block = next_block,
58505865 });
5851 try cg.body.emitBranch(cg.module.gpa, merge_label.?);
5866
5867 try cg.body.emit(gpa, .OpBranch, .{ .target_label = merge_label.? });
58525868 },
58535869 .unstructured => {
58545870 try cg.genBody(else_body);
58555871 },
58565872 }
58575873 } else {
5858 try cg.body.emit(cg.module.gpa, .OpUnreachable, {});
5874 try cg.body.emit(gpa, .OpUnreachable, {});
58595875 }
58605876
58615877 if (cg.control_flow == .structured) {
......@@ -5921,8 +5937,8 @@ fn airAssembly(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
59215937 return cg.todo("implement inline asm with more than 1 output", .{});
59225938 }
59235939
5924 var as: Assembler = .{ .cg = cg };
5925 defer as.deinit();
5940 var ass: Assembler = .{ .cg = cg };
5941 defer ass.deinit();
59265942
59275943 var output_extra_i = extra_i;
59285944 for (outputs) |output| {
......@@ -5974,8 +5990,8 @@ fn airAssembly(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
59745990
59755991 .undef => return cg.fail("assembly input with 'c' constraint cannot be undefined", .{}),
59765992
5977 .int => try as.value_map.put(gpa, name, .{ .constant = @intCast(val.toUnsignedInt(zcu)) }),
5978 .enum_literal => |str| try as.value_map.put(gpa, name, .{ .string = str.toSlice(ip) }),
5993 .int => try ass.value_map.put(gpa, name, .{ .constant = @intCast(val.toUnsignedInt(zcu)) }),
5994 .enum_literal => |str| try ass.value_map.put(gpa, name, .{ .string = str.toSlice(ip) }),
59795995
59805996 else => unreachable, // TODO
59815997 }
......@@ -5986,10 +6002,10 @@ fn airAssembly(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
59866002 // That's fine for now, just make sure to resolve it as such.
59876003 const val = (try cg.air.value(input, cg.pt)).?;
59886004 const ty_id = try cg.resolveType(val.toType(), .direct);
5989 try as.value_map.put(gpa, name, .{ .ty = ty_id });
6005 try ass.value_map.put(gpa, name, .{ .ty = ty_id });
59906006 } else {
59916007 const ty_id = try cg.resolveType(input_ty, .direct);
5992 try as.value_map.put(gpa, name, .{ .ty = ty_id });
6008 try ass.value_map.put(gpa, name, .{ .ty = ty_id });
59936009 }
59946010 } else {
59956011 if (input_ty.zigTypeTag(zcu) == .type) {
......@@ -5997,7 +6013,7 @@ fn airAssembly(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
59976013 }
59986014
59996015 const val_id = try cg.resolve(input);
6000 try as.value_map.put(gpa, name, .{ .value = val_id });
6016 try ass.value_map.put(gpa, name, .{ .value = val_id });
60016017 }
60026018 }
60036019
......@@ -6006,17 +6022,17 @@ fn airAssembly(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
60066022
60076023 const asm_source = std.mem.sliceAsBytes(cg.air.extra.items[extra_i..])[0..extra.data.source_len];
60086024
6009 as.assemble(asm_source) catch |err| switch (err) {
6025 ass.assemble(asm_source) catch |err| switch (err) {
60106026 error.AssembleFail => {
60116027 // TODO: For now the compiler only supports a single error message per decl,
60126028 // so to translate the possible multiple errors from the assembler, emit
60136029 // them as notes here.
60146030 // TODO: Translate proper error locations.
6015 assert(as.errors.items.len != 0);
6031 assert(ass.errors.items.len != 0);
60166032 assert(cg.error_msg == null);
60176033 const src_loc = zcu.navSrcLoc(cg.owner_nav);
60186034 cg.error_msg = try Zcu.ErrorMsg.create(zcu.gpa, src_loc, "failed to assemble SPIR-V inline assembly", .{});
6019 const notes = try zcu.gpa.alloc(Zcu.ErrorMsg, as.errors.items.len);
6035 const notes = try zcu.gpa.alloc(Zcu.ErrorMsg, ass.errors.items.len);
60206036
60216037 // Sub-scope to prevent `return error.CodegenFail` from running the errdefers.
60226038 {
......@@ -6026,8 +6042,8 @@ fn airAssembly(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
60266042 note.deinit(zcu.gpa);
60276043 };
60286044
6029 while (i < as.errors.items.len) : (i += 1) {
6030 notes[i] = try Zcu.ErrorMsg.init(zcu.gpa, src_loc, "{s}", .{as.errors.items[i].msg});
6045 while (i < ass.errors.items.len) : (i += 1) {
6046 notes[i] = try Zcu.ErrorMsg.init(zcu.gpa, src_loc, "{s}", .{ass.errors.items[i].msg});
60316047 }
60326048 }
60336049 cg.error_msg.?.notes = notes;
......@@ -6043,7 +6059,7 @@ fn airAssembly(cg: *CodeGen, inst: Air.Inst.Index) !?Id {
60436059 const name = std.mem.sliceTo(extra_bytes[constraint.len + 1 ..], 0);
60446060 output_extra_i += (constraint.len + name.len + (2 + 3)) / 4;
60456061
6046 const result = as.value_map.get(name) orelse return {
6062 const result = ass.value_map.get(name) orelse return {
60476063 return cg.fail("invalid asm output '{s}'", .{name});
60486064 };
60496065
......@@ -6083,8 +6099,11 @@ fn airCall(cg: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModifie
60836099 const callee_id = try cg.resolve(pl_op.operand);
60846100
60856101 comptime assert(zig_call_abi_ver == 3);
6086 const params = try gpa.alloc(Id, args.len);
6087 defer gpa.free(params);
6102
6103 const scratch_top = cg.id_scratch.items.len;
6104 defer cg.id_scratch.shrinkRetainingCapacity(scratch_top);
6105 const params = try cg.id_scratch.addManyAsSlice(gpa, args.len);
6106
60886107 var n_params: usize = 0;
60896108 for (args) |arg| {
60906109 // Note: resolve() might emit instructions, so we need to call it
......@@ -6098,7 +6117,7 @@ fn airCall(cg: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModifie
60986117 n_params += 1;
60996118 }
61006119
6101 try cg.body.emit(cg.module.gpa, .OpFunctionCall, .{
6120 try cg.body.emit(gpa, .OpFunctionCall, .{
61026121 .id_result_type = result_type_id,
61036122 .id_result = result_id,
61046123 .function = callee_id,
......@@ -6119,15 +6138,16 @@ fn builtin3D(
61196138 dimension: u32,
61206139 out_of_range_value: anytype,
61216140) !Id {
6141 const gpa = cg.module.gpa;
61226142 if (dimension >= 3) return try cg.constInt(result_ty, out_of_range_value);
61236143 const u32_ty_id = try cg.module.intType(.unsigned, 32);
61246144 const vec_ty_id = try cg.module.vectorType(3, u32_ty_id);
61256145 const ptr_ty_id = try cg.module.ptrType(vec_ty_id, .input);
61266146 const spv_decl_index = try cg.module.builtin(ptr_ty_id, builtin, .input);
6127 try cg.decl_deps.put(cg.module.gpa, spv_decl_index, {});
6147 try cg.module.decl_deps.append(gpa, spv_decl_index);
61286148 const ptr_id = cg.module.declPtr(spv_decl_index).result_id;
61296149 const vec_id = cg.module.allocId();
6130 try cg.body.emit(cg.module.gpa, .OpLoad, .{
6150 try cg.body.emit(gpa, .OpLoad, .{
61316151 .id_result_type = vec_ty_id,
61326152 .id_result = vec_id,
61336153 .pointer = ptr_id,
src/codegen/spirv/Module.zig+6-20
......@@ -125,9 +125,9 @@ pub const Decl = struct {
125125 /// - For `invocation_global`, this is the result-id of the associated InvocationGlobal instruction.
126126 result_id: Id,
127127 /// The offset of the first dependency of this decl in the `decl_deps` array.
128 begin_dep: u32,
128 begin_dep: usize = 0,
129129 /// The past-end offset of the dependencies of this decl in the `decl_deps` array.
130 end_dep: u32,
130 end_dep: usize = 0,
131131};
132132
133133/// This models a kernel entry point.
......@@ -258,7 +258,6 @@ pub fn resolveNav(module: *Module, ip: *InternPool, nav_index: InternPool.Nav.In
258258 .generic => .invocation_global,
259259 else => .global,
260260 };
261
262261 entry.value_ptr.* = try module.allocDecl(kind);
263262 }
264263
......@@ -782,15 +781,15 @@ pub fn builtin(
782781 const gop = try module.cache.builtins.getOrPut(module.gpa, .{ spirv_builtin, storage_class });
783782 if (!gop.found_existing) {
784783 const decl_index = try module.allocDecl(.global);
785 const result_id = module.declPtr(decl_index).result_id;
784 const decl = module.declPtr(decl_index);
785
786786 gop.value_ptr.* = decl_index;
787787 try module.sections.globals.emit(module.gpa, .OpVariable, .{
788788 .id_result_type = result_ty_id,
789 .id_result = result_id,
789 .id_result = decl.result_id,
790790 .storage_class = storage_class,
791791 });
792 try module.decorate(result_id, .{ .built_in = .{ .built_in = spirv_builtin } });
793 try module.declareDeclDeps(decl_index, &.{});
792 try module.decorate(decl.result_id, .{ .built_in = .{ .built_in = spirv_builtin } });
794793 }
795794 return gop.value_ptr.*;
796795}
......@@ -847,8 +846,6 @@ pub fn allocDecl(module: *Module, kind: Decl.Kind) !Decl.Index {
847846 try module.decls.append(module.gpa, .{
848847 .kind = kind,
849848 .result_id = module.allocId(),
850 .begin_dep = undefined,
851 .end_dep = undefined,
852849 });
853850
854851 return @as(Decl.Index, @enumFromInt(@as(u32, @intCast(module.decls.items.len - 1))));
......@@ -858,17 +855,6 @@ pub fn declPtr(module: *Module, index: Decl.Index) *Decl {
858855 return &module.decls.items[@intFromEnum(index)];
859856}
860857
861/// Declare ALL dependencies for a decl.
862pub fn declareDeclDeps(module: *Module, decl_index: Decl.Index, deps: []const Decl.Index) !void {
863 const begin_dep: u32 = @intCast(module.decl_deps.items.len);
864 try module.decl_deps.appendSlice(module.gpa, deps);
865 const end_dep: u32 = @intCast(module.decl_deps.items.len);
866
867 const decl = module.declPtr(decl_index);
868 decl.begin_dep = begin_dep;
869 decl.end_dep = end_dep;
870}
871
872858/// Declare a SPIR-V function as an entry point. This causes an extra wrapper
873859/// function to be generated, which is then exported as the real entry point. The purpose of this
874860/// wrapper is to allocate and initialize the structure holding the instance globals.
src/codegen/spirv/Section.zig+1-11
......@@ -21,7 +21,7 @@ pub fn deinit(section: *Section, allocator: Allocator) void {
2121}
2222
2323pub fn reset(section: *Section) void {
24 section.instructions.items.len = 0;
24 section.instructions.clearRetainingCapacity();
2525}
2626
2727pub fn toWords(section: Section) []Word {
......@@ -86,16 +86,6 @@ pub fn emit(
8686 section.writeOperands(opcode.Operands(), operands);
8787}
8888
89pub fn emitBranch(
90 section: *Section,
91 allocator: Allocator,
92 target_label: spec.Id,
93) !void {
94 try section.emit(allocator, .OpBranch, .{
95 .target_label = target_label,
96 });
97}
98
9989pub fn writeWord(section: *Section, word: Word) void {
10090 section.instructions.appendAssumeCapacity(word);
10191}
src/codegen/spirv/spec.zig+783-3529
......@@ -191,25 +191,6 @@ pub const OperandKind = enum {
191191 pair_id_ref_literal_integer,
192192 pair_id_ref_id_ref,
193193 tensor_operands,
194 debug_info_debug_info_flags,
195 debug_info_debug_base_type_attribute_encoding,
196 debug_info_debug_composite_type,
197 debug_info_debug_type_qualifier,
198 debug_info_debug_operation,
199 open_cl_debug_info_100_debug_info_flags,
200 open_cl_debug_info_100_debug_base_type_attribute_encoding,
201 open_cl_debug_info_100_debug_composite_type,
202 open_cl_debug_info_100_debug_type_qualifier,
203 open_cl_debug_info_100_debug_operation,
204 open_cl_debug_info_100_debug_imported_entity,
205 non_semantic_clspv_reflection_6_kernel_property_flags,
206 non_semantic_shader_debug_info_100_debug_info_flags,
207 non_semantic_shader_debug_info_100_build_identifier_flags,
208 non_semantic_shader_debug_info_100_debug_base_type_attribute_encoding,
209 non_semantic_shader_debug_info_100_debug_composite_type,
210 non_semantic_shader_debug_info_100_debug_type_qualifier,
211 non_semantic_shader_debug_info_100_debug_operation,
212 non_semantic_shader_debug_info_100_debug_imported_entity,
213194
214195 pub fn category(self: OperandKind) OperandCategory {
215196 return switch (self) {
......@@ -285,25 +266,6 @@ pub const OperandKind = enum {
285266 .pair_id_ref_literal_integer => .composite,
286267 .pair_id_ref_id_ref => .composite,
287268 .tensor_operands => .bit_enum,
288 .debug_info_debug_info_flags => .bit_enum,
289 .debug_info_debug_base_type_attribute_encoding => .value_enum,
290 .debug_info_debug_composite_type => .value_enum,
291 .debug_info_debug_type_qualifier => .value_enum,
292 .debug_info_debug_operation => .value_enum,
293 .open_cl_debug_info_100_debug_info_flags => .bit_enum,
294 .open_cl_debug_info_100_debug_base_type_attribute_encoding => .value_enum,
295 .open_cl_debug_info_100_debug_composite_type => .value_enum,
296 .open_cl_debug_info_100_debug_type_qualifier => .value_enum,
297 .open_cl_debug_info_100_debug_operation => .value_enum,
298 .open_cl_debug_info_100_debug_imported_entity => .value_enum,
299 .non_semantic_clspv_reflection_6_kernel_property_flags => .bit_enum,
300 .non_semantic_shader_debug_info_100_debug_info_flags => .bit_enum,
301 .non_semantic_shader_debug_info_100_build_identifier_flags => .bit_enum,
302 .non_semantic_shader_debug_info_100_debug_base_type_attribute_encoding => .value_enum,
303 .non_semantic_shader_debug_info_100_debug_composite_type => .value_enum,
304 .non_semantic_shader_debug_info_100_debug_type_qualifier => .value_enum,
305 .non_semantic_shader_debug_info_100_debug_operation => .value_enum,
306 .non_semantic_shader_debug_info_100_debug_imported_entity => .value_enum,
307269 };
308270 }
309271 pub fn enumerants(self: OperandKind) []const Enumerant {
......@@ -1475,178 +1437,10 @@ pub const OperandKind = enum {
14751437 .{ .name = "MakeElementVisibleARM", .value = 0x0008, .parameters = &.{.id_ref} },
14761438 .{ .name = "NonPrivateElementARM", .value = 0x0010, .parameters = &.{} },
14771439 },
1478 .debug_info_debug_info_flags => &.{
1479 .{ .name = "FlagIsProtected", .value = 0x01, .parameters = &.{} },
1480 .{ .name = "FlagIsPrivate", .value = 0x02, .parameters = &.{} },
1481 .{ .name = "FlagIsPublic", .value = 0x03, .parameters = &.{} },
1482 .{ .name = "FlagIsLocal", .value = 0x04, .parameters = &.{} },
1483 .{ .name = "FlagIsDefinition", .value = 0x08, .parameters = &.{} },
1484 .{ .name = "FlagFwdDecl", .value = 0x10, .parameters = &.{} },
1485 .{ .name = "FlagArtificial", .value = 0x20, .parameters = &.{} },
1486 .{ .name = "FlagExplicit", .value = 0x40, .parameters = &.{} },
1487 .{ .name = "FlagPrototyped", .value = 0x80, .parameters = &.{} },
1488 .{ .name = "FlagObjectPointer", .value = 0x100, .parameters = &.{} },
1489 .{ .name = "FlagStaticMember", .value = 0x200, .parameters = &.{} },
1490 .{ .name = "FlagIndirectVariable", .value = 0x400, .parameters = &.{} },
1491 .{ .name = "FlagLValueReference", .value = 0x800, .parameters = &.{} },
1492 .{ .name = "FlagRValueReference", .value = 0x1000, .parameters = &.{} },
1493 .{ .name = "FlagIsOptimized", .value = 0x2000, .parameters = &.{} },
1494 },
1495 .debug_info_debug_base_type_attribute_encoding => &.{
1496 .{ .name = "Unspecified", .value = 0, .parameters = &.{} },
1497 .{ .name = "Address", .value = 1, .parameters = &.{} },
1498 .{ .name = "Boolean", .value = 2, .parameters = &.{} },
1499 .{ .name = "Float", .value = 4, .parameters = &.{} },
1500 .{ .name = "Signed", .value = 5, .parameters = &.{} },
1501 .{ .name = "SignedChar", .value = 6, .parameters = &.{} },
1502 .{ .name = "Unsigned", .value = 7, .parameters = &.{} },
1503 .{ .name = "UnsignedChar", .value = 8, .parameters = &.{} },
1504 },
1505 .debug_info_debug_composite_type => &.{
1506 .{ .name = "Class", .value = 0, .parameters = &.{} },
1507 .{ .name = "Structure", .value = 1, .parameters = &.{} },
1508 .{ .name = "Union", .value = 2, .parameters = &.{} },
1509 },
1510 .debug_info_debug_type_qualifier => &.{
1511 .{ .name = "ConstType", .value = 0, .parameters = &.{} },
1512 .{ .name = "VolatileType", .value = 1, .parameters = &.{} },
1513 .{ .name = "RestrictType", .value = 2, .parameters = &.{} },
1514 },
1515 .debug_info_debug_operation => &.{
1516 .{ .name = "Deref", .value = 0, .parameters = &.{} },
1517 .{ .name = "Plus", .value = 1, .parameters = &.{} },
1518 .{ .name = "Minus", .value = 2, .parameters = &.{} },
1519 .{ .name = "PlusUconst", .value = 3, .parameters = &.{.literal_integer} },
1520 .{ .name = "BitPiece", .value = 4, .parameters = &.{ .literal_integer, .literal_integer } },
1521 .{ .name = "Swap", .value = 5, .parameters = &.{} },
1522 .{ .name = "Xderef", .value = 6, .parameters = &.{} },
1523 .{ .name = "StackValue", .value = 7, .parameters = &.{} },
1524 .{ .name = "Constu", .value = 8, .parameters = &.{.literal_integer} },
1525 },
1526 .open_cl_debug_info_100_debug_info_flags => &.{
1527 .{ .name = "FlagIsProtected", .value = 0x01, .parameters = &.{} },
1528 .{ .name = "FlagIsPrivate", .value = 0x02, .parameters = &.{} },
1529 .{ .name = "FlagIsPublic", .value = 0x03, .parameters = &.{} },
1530 .{ .name = "FlagIsLocal", .value = 0x04, .parameters = &.{} },
1531 .{ .name = "FlagIsDefinition", .value = 0x08, .parameters = &.{} },
1532 .{ .name = "FlagFwdDecl", .value = 0x10, .parameters = &.{} },
1533 .{ .name = "FlagArtificial", .value = 0x20, .parameters = &.{} },
1534 .{ .name = "FlagExplicit", .value = 0x40, .parameters = &.{} },
1535 .{ .name = "FlagPrototyped", .value = 0x80, .parameters = &.{} },
1536 .{ .name = "FlagObjectPointer", .value = 0x100, .parameters = &.{} },
1537 .{ .name = "FlagStaticMember", .value = 0x200, .parameters = &.{} },
1538 .{ .name = "FlagIndirectVariable", .value = 0x400, .parameters = &.{} },
1539 .{ .name = "FlagLValueReference", .value = 0x800, .parameters = &.{} },
1540 .{ .name = "FlagRValueReference", .value = 0x1000, .parameters = &.{} },
1541 .{ .name = "FlagIsOptimized", .value = 0x2000, .parameters = &.{} },
1542 .{ .name = "FlagIsEnumClass", .value = 0x4000, .parameters = &.{} },
1543 .{ .name = "FlagTypePassByValue", .value = 0x8000, .parameters = &.{} },
1544 .{ .name = "FlagTypePassByReference", .value = 0x10000, .parameters = &.{} },
1545 },
1546 .open_cl_debug_info_100_debug_base_type_attribute_encoding => &.{
1547 .{ .name = "Unspecified", .value = 0, .parameters = &.{} },
1548 .{ .name = "Address", .value = 1, .parameters = &.{} },
1549 .{ .name = "Boolean", .value = 2, .parameters = &.{} },
1550 .{ .name = "Float", .value = 3, .parameters = &.{} },
1551 .{ .name = "Signed", .value = 4, .parameters = &.{} },
1552 .{ .name = "SignedChar", .value = 5, .parameters = &.{} },
1553 .{ .name = "Unsigned", .value = 6, .parameters = &.{} },
1554 .{ .name = "UnsignedChar", .value = 7, .parameters = &.{} },
1555 },
1556 .open_cl_debug_info_100_debug_composite_type => &.{
1557 .{ .name = "Class", .value = 0, .parameters = &.{} },
1558 .{ .name = "Structure", .value = 1, .parameters = &.{} },
1559 .{ .name = "Union", .value = 2, .parameters = &.{} },
1560 },
1561 .open_cl_debug_info_100_debug_type_qualifier => &.{
1562 .{ .name = "ConstType", .value = 0, .parameters = &.{} },
1563 .{ .name = "VolatileType", .value = 1, .parameters = &.{} },
1564 .{ .name = "RestrictType", .value = 2, .parameters = &.{} },
1565 .{ .name = "AtomicType", .value = 3, .parameters = &.{} },
1566 },
1567 .open_cl_debug_info_100_debug_operation => &.{
1568 .{ .name = "Deref", .value = 0, .parameters = &.{} },
1569 .{ .name = "Plus", .value = 1, .parameters = &.{} },
1570 .{ .name = "Minus", .value = 2, .parameters = &.{} },
1571 .{ .name = "PlusUconst", .value = 3, .parameters = &.{.literal_integer} },
1572 .{ .name = "BitPiece", .value = 4, .parameters = &.{ .literal_integer, .literal_integer } },
1573 .{ .name = "Swap", .value = 5, .parameters = &.{} },
1574 .{ .name = "Xderef", .value = 6, .parameters = &.{} },
1575 .{ .name = "StackValue", .value = 7, .parameters = &.{} },
1576 .{ .name = "Constu", .value = 8, .parameters = &.{.literal_integer} },
1577 .{ .name = "Fragment", .value = 9, .parameters = &.{ .literal_integer, .literal_integer } },
1578 },
1579 .open_cl_debug_info_100_debug_imported_entity => &.{
1580 .{ .name = "ImportedModule", .value = 0, .parameters = &.{} },
1581 .{ .name = "ImportedDeclaration", .value = 1, .parameters = &.{} },
1582 },
1583 .non_semantic_clspv_reflection_6_kernel_property_flags => &.{
1584 .{ .name = "MayUsePrintf", .value = 0x1, .parameters = &.{} },
1585 },
1586 .non_semantic_shader_debug_info_100_debug_info_flags => &.{
1587 .{ .name = "FlagIsProtected", .value = 0x01, .parameters = &.{} },
1588 .{ .name = "FlagIsPrivate", .value = 0x02, .parameters = &.{} },
1589 .{ .name = "FlagIsPublic", .value = 0x03, .parameters = &.{} },
1590 .{ .name = "FlagIsLocal", .value = 0x04, .parameters = &.{} },
1591 .{ .name = "FlagIsDefinition", .value = 0x08, .parameters = &.{} },
1592 .{ .name = "FlagFwdDecl", .value = 0x10, .parameters = &.{} },
1593 .{ .name = "FlagArtificial", .value = 0x20, .parameters = &.{} },
1594 .{ .name = "FlagExplicit", .value = 0x40, .parameters = &.{} },
1595 .{ .name = "FlagPrototyped", .value = 0x80, .parameters = &.{} },
1596 .{ .name = "FlagObjectPointer", .value = 0x100, .parameters = &.{} },
1597 .{ .name = "FlagStaticMember", .value = 0x200, .parameters = &.{} },
1598 .{ .name = "FlagIndirectVariable", .value = 0x400, .parameters = &.{} },
1599 .{ .name = "FlagLValueReference", .value = 0x800, .parameters = &.{} },
1600 .{ .name = "FlagRValueReference", .value = 0x1000, .parameters = &.{} },
1601 .{ .name = "FlagIsOptimized", .value = 0x2000, .parameters = &.{} },
1602 .{ .name = "FlagIsEnumClass", .value = 0x4000, .parameters = &.{} },
1603 .{ .name = "FlagTypePassByValue", .value = 0x8000, .parameters = &.{} },
1604 .{ .name = "FlagTypePassByReference", .value = 0x10000, .parameters = &.{} },
1605 .{ .name = "FlagUnknownPhysicalLayout", .value = 0x20000, .parameters = &.{} },
1606 },
1607 .non_semantic_shader_debug_info_100_build_identifier_flags => &.{
1608 .{ .name = "IdentifierPossibleDuplicates", .value = 0x01, .parameters = &.{} },
1609 },
1610 .non_semantic_shader_debug_info_100_debug_base_type_attribute_encoding => &.{
1611 .{ .name = "Unspecified", .value = 0, .parameters = &.{} },
1612 .{ .name = "Address", .value = 1, .parameters = &.{} },
1613 .{ .name = "Boolean", .value = 2, .parameters = &.{} },
1614 .{ .name = "Float", .value = 3, .parameters = &.{} },
1615 .{ .name = "Signed", .value = 4, .parameters = &.{} },
1616 .{ .name = "SignedChar", .value = 5, .parameters = &.{} },
1617 .{ .name = "Unsigned", .value = 6, .parameters = &.{} },
1618 .{ .name = "UnsignedChar", .value = 7, .parameters = &.{} },
1619 },
1620 .non_semantic_shader_debug_info_100_debug_composite_type => &.{
1621 .{ .name = "Class", .value = 0, .parameters = &.{} },
1622 .{ .name = "Structure", .value = 1, .parameters = &.{} },
1623 .{ .name = "Union", .value = 2, .parameters = &.{} },
1624 },
1625 .non_semantic_shader_debug_info_100_debug_type_qualifier => &.{
1626 .{ .name = "ConstType", .value = 0, .parameters = &.{} },
1627 .{ .name = "VolatileType", .value = 1, .parameters = &.{} },
1628 .{ .name = "RestrictType", .value = 2, .parameters = &.{} },
1629 .{ .name = "AtomicType", .value = 3, .parameters = &.{} },
1630 },
1631 .non_semantic_shader_debug_info_100_debug_operation => &.{
1632 .{ .name = "Deref", .value = 0, .parameters = &.{} },
1633 .{ .name = "Plus", .value = 1, .parameters = &.{} },
1634 .{ .name = "Minus", .value = 2, .parameters = &.{} },
1635 .{ .name = "PlusUconst", .value = 3, .parameters = &.{.id_ref} },
1636 .{ .name = "BitPiece", .value = 4, .parameters = &.{ .id_ref, .id_ref } },
1637 .{ .name = "Swap", .value = 5, .parameters = &.{} },
1638 .{ .name = "Xderef", .value = 6, .parameters = &.{} },
1639 .{ .name = "StackValue", .value = 7, .parameters = &.{} },
1640 .{ .name = "Constu", .value = 8, .parameters = &.{.id_ref} },
1641 .{ .name = "Fragment", .value = 9, .parameters = &.{ .id_ref, .id_ref } },
1642 },
1643 .non_semantic_shader_debug_info_100_debug_imported_entity => &.{
1644 .{ .name = "ImportedModule", .value = 0, .parameters = &.{} },
1645 .{ .name = "ImportedDeclaration", .value = 1, .parameters = &.{} },
1646 },
16471440 };
16481441 }
16491442};
1443
16501444pub const Opcode = enum(u16) {
16511445 OpNop = 0,
16521446 OpUndef = 1,
......@@ -3533,6 +3327,259 @@ pub const Opcode = enum(u16) {
35333327 };
35343328 }
35353329};
3330
3331pub const GlslOpcode = enum(u16) {
3332 Round = 1,
3333 RoundEven = 2,
3334 Trunc = 3,
3335 FAbs = 4,
3336 SAbs = 5,
3337 FSign = 6,
3338 SSign = 7,
3339 Floor = 8,
3340 Ceil = 9,
3341 Fract = 10,
3342 Radians = 11,
3343 Degrees = 12,
3344 Sin = 13,
3345 Cos = 14,
3346 Tan = 15,
3347 Asin = 16,
3348 Acos = 17,
3349 Atan = 18,
3350 Sinh = 19,
3351 Cosh = 20,
3352 Tanh = 21,
3353 Asinh = 22,
3354 Acosh = 23,
3355 Atanh = 24,
3356 Atan2 = 25,
3357 Pow = 26,
3358 Exp = 27,
3359 Log = 28,
3360 Exp2 = 29,
3361 Log2 = 30,
3362 Sqrt = 31,
3363 InverseSqrt = 32,
3364 Determinant = 33,
3365 MatrixInverse = 34,
3366 Modf = 35,
3367 ModfStruct = 36,
3368 FMin = 37,
3369 UMin = 38,
3370 SMin = 39,
3371 FMax = 40,
3372 UMax = 41,
3373 SMax = 42,
3374 FClamp = 43,
3375 UClamp = 44,
3376 SClamp = 45,
3377 FMix = 46,
3378 IMix = 47,
3379 Step = 48,
3380 SmoothStep = 49,
3381 Fma = 50,
3382 Frexp = 51,
3383 FrexpStruct = 52,
3384 Ldexp = 53,
3385 PackSnorm4x8 = 54,
3386 PackUnorm4x8 = 55,
3387 PackSnorm2x16 = 56,
3388 PackUnorm2x16 = 57,
3389 PackHalf2x16 = 58,
3390 PackDouble2x32 = 59,
3391 UnpackSnorm2x16 = 60,
3392 UnpackUnorm2x16 = 61,
3393 UnpackHalf2x16 = 62,
3394 UnpackSnorm4x8 = 63,
3395 UnpackUnorm4x8 = 64,
3396 UnpackDouble2x32 = 65,
3397 Length = 66,
3398 Distance = 67,
3399 Cross = 68,
3400 Normalize = 69,
3401 FaceForward = 70,
3402 Reflect = 71,
3403 Refract = 72,
3404 FindILsb = 73,
3405 FindSMsb = 74,
3406 FindUMsb = 75,
3407 InterpolateAtCentroid = 76,
3408 InterpolateAtSample = 77,
3409 InterpolateAtOffset = 78,
3410 NMin = 79,
3411 NMax = 80,
3412 NClamp = 81,
3413};
3414
3415pub const OpenClOpcode = enum(u16) {
3416 acos = 0,
3417 acosh = 1,
3418 acospi = 2,
3419 asin = 3,
3420 asinh = 4,
3421 asinpi = 5,
3422 atan = 6,
3423 atan2 = 7,
3424 atanh = 8,
3425 atanpi = 9,
3426 atan2pi = 10,
3427 cbrt = 11,
3428 ceil = 12,
3429 copysign = 13,
3430 cos = 14,
3431 cosh = 15,
3432 cospi = 16,
3433 erfc = 17,
3434 erf = 18,
3435 exp = 19,
3436 exp2 = 20,
3437 exp10 = 21,
3438 expm1 = 22,
3439 fabs = 23,
3440 fdim = 24,
3441 floor = 25,
3442 fma = 26,
3443 fmax = 27,
3444 fmin = 28,
3445 fmod = 29,
3446 fract = 30,
3447 frexp = 31,
3448 hypot = 32,
3449 ilogb = 33,
3450 ldexp = 34,
3451 lgamma = 35,
3452 lgamma_r = 36,
3453 log = 37,
3454 log2 = 38,
3455 log10 = 39,
3456 log1p = 40,
3457 logb = 41,
3458 mad = 42,
3459 maxmag = 43,
3460 minmag = 44,
3461 modf = 45,
3462 nan = 46,
3463 nextafter = 47,
3464 pow = 48,
3465 pown = 49,
3466 powr = 50,
3467 remainder = 51,
3468 remquo = 52,
3469 rint = 53,
3470 rootn = 54,
3471 round = 55,
3472 rsqrt = 56,
3473 sin = 57,
3474 sincos = 58,
3475 sinh = 59,
3476 sinpi = 60,
3477 sqrt = 61,
3478 tan = 62,
3479 tanh = 63,
3480 tanpi = 64,
3481 tgamma = 65,
3482 trunc = 66,
3483 half_cos = 67,
3484 half_divide = 68,
3485 half_exp = 69,
3486 half_exp2 = 70,
3487 half_exp10 = 71,
3488 half_log = 72,
3489 half_log2 = 73,
3490 half_log10 = 74,
3491 half_powr = 75,
3492 half_recip = 76,
3493 half_rsqrt = 77,
3494 half_sin = 78,
3495 half_sqrt = 79,
3496 half_tan = 80,
3497 native_cos = 81,
3498 native_divide = 82,
3499 native_exp = 83,
3500 native_exp2 = 84,
3501 native_exp10 = 85,
3502 native_log = 86,
3503 native_log2 = 87,
3504 native_log10 = 88,
3505 native_powr = 89,
3506 native_recip = 90,
3507 native_rsqrt = 91,
3508 native_sin = 92,
3509 native_sqrt = 93,
3510 native_tan = 94,
3511 fclamp = 95,
3512 degrees = 96,
3513 fmax_common = 97,
3514 fmin_common = 98,
3515 mix = 99,
3516 radians = 100,
3517 step = 101,
3518 smoothstep = 102,
3519 sign = 103,
3520 cross = 104,
3521 distance = 105,
3522 length = 106,
3523 normalize = 107,
3524 fast_distance = 108,
3525 fast_length = 109,
3526 fast_normalize = 110,
3527 s_abs = 141,
3528 s_abs_diff = 142,
3529 s_add_sat = 143,
3530 u_add_sat = 144,
3531 s_hadd = 145,
3532 u_hadd = 146,
3533 s_rhadd = 147,
3534 u_rhadd = 148,
3535 s_clamp = 149,
3536 u_clamp = 150,
3537 clz = 151,
3538 ctz = 152,
3539 s_mad_hi = 153,
3540 u_mad_sat = 154,
3541 s_mad_sat = 155,
3542 s_max = 156,
3543 u_max = 157,
3544 s_min = 158,
3545 u_min = 159,
3546 s_mul_hi = 160,
3547 rotate = 161,
3548 s_sub_sat = 162,
3549 u_sub_sat = 163,
3550 u_upsample = 164,
3551 s_upsample = 165,
3552 popcount = 166,
3553 s_mad24 = 167,
3554 u_mad24 = 168,
3555 s_mul24 = 169,
3556 u_mul24 = 170,
3557 vloadn = 171,
3558 vstoren = 172,
3559 vload_half = 173,
3560 vload_halfn = 174,
3561 vstore_half = 175,
3562 vstore_half_r = 176,
3563 vstore_halfn = 177,
3564 vstore_halfn_r = 178,
3565 vloada_halfn = 179,
3566 vstorea_halfn = 180,
3567 vstorea_halfn_r = 181,
3568 shuffle = 182,
3569 shuffle2 = 183,
3570 printf = 184,
3571 prefetch = 185,
3572 bitselect = 186,
3573 select = 187,
3574 u_abs = 201,
3575 u_abs_diff = 202,
3576 u_mul_hi = 203,
3577 u_mad_hi = 204,
3578};
3579
3580pub const Zig = enum(u16) {
3581 InvocationGlobal = 0,
3582};
35363583pub const ImageOperands = packed struct {
35373584 bias: bool = false,
35383585 lod: bool = false,
......@@ -5494,335 +5541,10 @@ pub const TensorOperands = packed struct {
54945541 _reserved_bit_31: bool = false,
54955542 };
54965543};
5497pub const @"DebugInfo.DebugInfoFlags" = packed struct {
5498 flag_is_protected: bool = false,
5499 flag_is_private: bool = false,
5500 flag_is_local: bool = false,
5501 flag_is_definition: bool = false,
5502 flag_fwd_decl: bool = false,
5503 flag_artificial: bool = false,
5504 flag_explicit: bool = false,
5505 flag_prototyped: bool = false,
5506 flag_object_pointer: bool = false,
5507 flag_static_member: bool = false,
5508 flag_indirect_variable: bool = false,
5509 flag_l_value_reference: bool = false,
5510 flag_r_value_reference: bool = false,
5511 flag_is_optimized: bool = false,
5512 _reserved_bit_14: bool = false,
5513 _reserved_bit_15: bool = false,
5514 _reserved_bit_16: bool = false,
5515 _reserved_bit_17: bool = false,
5516 _reserved_bit_18: bool = false,
5517 _reserved_bit_19: bool = false,
5518 _reserved_bit_20: bool = false,
5519 _reserved_bit_21: bool = false,
5520 _reserved_bit_22: bool = false,
5521 _reserved_bit_23: bool = false,
5522 _reserved_bit_24: bool = false,
5523 _reserved_bit_25: bool = false,
5524 _reserved_bit_26: bool = false,
5525 _reserved_bit_27: bool = false,
5526 _reserved_bit_28: bool = false,
5527 _reserved_bit_29: bool = false,
5528 _reserved_bit_30: bool = false,
5529 _reserved_bit_31: bool = false,
5530};
5531pub const @"DebugInfo.DebugBaseTypeAttributeEncoding" = enum(u32) {
5532 unspecified = 0,
5533 address = 1,
5534 boolean = 2,
5535 float = 4,
5536 signed = 5,
5537 signed_char = 6,
5538 unsigned = 7,
5539 unsigned_char = 8,
5540};
5541pub const @"DebugInfo.DebugCompositeType" = enum(u32) {
5542 class = 0,
5543 structure = 1,
5544 @"union" = 2,
5545};
5546pub const @"DebugInfo.DebugTypeQualifier" = enum(u32) {
5547 const_type = 0,
5548 volatile_type = 1,
5549 restrict_type = 2,
5550};
5551pub const @"DebugInfo.DebugOperation" = enum(u32) {
5552 deref = 0,
5553 plus = 1,
5554 minus = 2,
5555 plus_uconst = 3,
5556 bit_piece = 4,
5557 swap = 5,
5558 xderef = 6,
5559 stack_value = 7,
5560 constu = 8,
5561
5562 pub const Extended = union(@"DebugInfo.DebugOperation") {
5563 deref,
5564 plus,
5565 minus,
5566 plus_uconst: struct { literal_integer: LiteralInteger },
5567 bit_piece: struct { literal_integer_0: LiteralInteger, literal_integer_1: LiteralInteger },
5568 swap,
5569 xderef,
5570 stack_value,
5571 constu: struct { literal_integer: LiteralInteger },
5572 };
5573};
5574pub const @"OpenCL.DebugInfo.100.DebugInfoFlags" = packed struct {
5575 flag_is_protected: bool = false,
5576 flag_is_private: bool = false,
5577 flag_is_local: bool = false,
5578 flag_is_definition: bool = false,
5579 flag_fwd_decl: bool = false,
5580 flag_artificial: bool = false,
5581 flag_explicit: bool = false,
5582 flag_prototyped: bool = false,
5583 flag_object_pointer: bool = false,
5584 flag_static_member: bool = false,
5585 flag_indirect_variable: bool = false,
5586 flag_l_value_reference: bool = false,
5587 flag_r_value_reference: bool = false,
5588 flag_is_optimized: bool = false,
5589 flag_is_enum_class: bool = false,
5590 flag_type_pass_by_value: bool = false,
5591 flag_type_pass_by_reference: bool = false,
5592 _reserved_bit_17: bool = false,
5593 _reserved_bit_18: bool = false,
5594 _reserved_bit_19: bool = false,
5595 _reserved_bit_20: bool = false,
5596 _reserved_bit_21: bool = false,
5597 _reserved_bit_22: bool = false,
5598 _reserved_bit_23: bool = false,
5599 _reserved_bit_24: bool = false,
5600 _reserved_bit_25: bool = false,
5601 _reserved_bit_26: bool = false,
5602 _reserved_bit_27: bool = false,
5603 _reserved_bit_28: bool = false,
5604 _reserved_bit_29: bool = false,
5605 _reserved_bit_30: bool = false,
5606 _reserved_bit_31: bool = false,
5607};
5608pub const @"OpenCL.DebugInfo.100.DebugBaseTypeAttributeEncoding" = enum(u32) {
5609 unspecified = 0,
5610 address = 1,
5611 boolean = 2,
5612 float = 3,
5613 signed = 4,
5614 signed_char = 5,
5615 unsigned = 6,
5616 unsigned_char = 7,
5617};
5618pub const @"OpenCL.DebugInfo.100.DebugCompositeType" = enum(u32) {
5619 class = 0,
5620 structure = 1,
5621 @"union" = 2,
5622};
5623pub const @"OpenCL.DebugInfo.100.DebugTypeQualifier" = enum(u32) {
5624 const_type = 0,
5625 volatile_type = 1,
5626 restrict_type = 2,
5627 atomic_type = 3,
5628};
5629pub const @"OpenCL.DebugInfo.100.DebugOperation" = enum(u32) {
5630 deref = 0,
5631 plus = 1,
5632 minus = 2,
5633 plus_uconst = 3,
5634 bit_piece = 4,
5635 swap = 5,
5636 xderef = 6,
5637 stack_value = 7,
5638 constu = 8,
5639 fragment = 9,
5640
5641 pub const Extended = union(@"OpenCL.DebugInfo.100.DebugOperation") {
5642 deref,
5643 plus,
5644 minus,
5645 plus_uconst: struct { literal_integer: LiteralInteger },
5646 bit_piece: struct { literal_integer_0: LiteralInteger, literal_integer_1: LiteralInteger },
5647 swap,
5648 xderef,
5649 stack_value,
5650 constu: struct { literal_integer: LiteralInteger },
5651 fragment: struct { literal_integer_0: LiteralInteger, literal_integer_1: LiteralInteger },
5652 };
5653};
5654pub const @"OpenCL.DebugInfo.100.DebugImportedEntity" = enum(u32) {
5655 imported_module = 0,
5656 imported_declaration = 1,
5657};
5658pub const @"NonSemantic.ClspvReflection.6.KernelPropertyFlags" = packed struct {
5659 may_use_printf: bool = false,
5660 _reserved_bit_1: bool = false,
5661 _reserved_bit_2: bool = false,
5662 _reserved_bit_3: bool = false,
5663 _reserved_bit_4: bool = false,
5664 _reserved_bit_5: bool = false,
5665 _reserved_bit_6: bool = false,
5666 _reserved_bit_7: bool = false,
5667 _reserved_bit_8: bool = false,
5668 _reserved_bit_9: bool = false,
5669 _reserved_bit_10: bool = false,
5670 _reserved_bit_11: bool = false,
5671 _reserved_bit_12: bool = false,
5672 _reserved_bit_13: bool = false,
5673 _reserved_bit_14: bool = false,
5674 _reserved_bit_15: bool = false,
5675 _reserved_bit_16: bool = false,
5676 _reserved_bit_17: bool = false,
5677 _reserved_bit_18: bool = false,
5678 _reserved_bit_19: bool = false,
5679 _reserved_bit_20: bool = false,
5680 _reserved_bit_21: bool = false,
5681 _reserved_bit_22: bool = false,
5682 _reserved_bit_23: bool = false,
5683 _reserved_bit_24: bool = false,
5684 _reserved_bit_25: bool = false,
5685 _reserved_bit_26: bool = false,
5686 _reserved_bit_27: bool = false,
5687 _reserved_bit_28: bool = false,
5688 _reserved_bit_29: bool = false,
5689 _reserved_bit_30: bool = false,
5690 _reserved_bit_31: bool = false,
5691};
5692pub const @"NonSemantic.Shader.DebugInfo.100.DebugInfoFlags" = packed struct {
5693 flag_is_protected: bool = false,
5694 flag_is_private: bool = false,
5695 flag_is_local: bool = false,
5696 flag_is_definition: bool = false,
5697 flag_fwd_decl: bool = false,
5698 flag_artificial: bool = false,
5699 flag_explicit: bool = false,
5700 flag_prototyped: bool = false,
5701 flag_object_pointer: bool = false,
5702 flag_static_member: bool = false,
5703 flag_indirect_variable: bool = false,
5704 flag_l_value_reference: bool = false,
5705 flag_r_value_reference: bool = false,
5706 flag_is_optimized: bool = false,
5707 flag_is_enum_class: bool = false,
5708 flag_type_pass_by_value: bool = false,
5709 flag_type_pass_by_reference: bool = false,
5710 flag_unknown_physical_layout: bool = false,
5711 _reserved_bit_18: bool = false,
5712 _reserved_bit_19: bool = false,
5713 _reserved_bit_20: bool = false,
5714 _reserved_bit_21: bool = false,
5715 _reserved_bit_22: bool = false,
5716 _reserved_bit_23: bool = false,
5717 _reserved_bit_24: bool = false,
5718 _reserved_bit_25: bool = false,
5719 _reserved_bit_26: bool = false,
5720 _reserved_bit_27: bool = false,
5721 _reserved_bit_28: bool = false,
5722 _reserved_bit_29: bool = false,
5723 _reserved_bit_30: bool = false,
5724 _reserved_bit_31: bool = false,
5725};
5726pub const @"NonSemantic.Shader.DebugInfo.100.BuildIdentifierFlags" = packed struct {
5727 identifier_possible_duplicates: bool = false,
5728 _reserved_bit_1: bool = false,
5729 _reserved_bit_2: bool = false,
5730 _reserved_bit_3: bool = false,
5731 _reserved_bit_4: bool = false,
5732 _reserved_bit_5: bool = false,
5733 _reserved_bit_6: bool = false,
5734 _reserved_bit_7: bool = false,
5735 _reserved_bit_8: bool = false,
5736 _reserved_bit_9: bool = false,
5737 _reserved_bit_10: bool = false,
5738 _reserved_bit_11: bool = false,
5739 _reserved_bit_12: bool = false,
5740 _reserved_bit_13: bool = false,
5741 _reserved_bit_14: bool = false,
5742 _reserved_bit_15: bool = false,
5743 _reserved_bit_16: bool = false,
5744 _reserved_bit_17: bool = false,
5745 _reserved_bit_18: bool = false,
5746 _reserved_bit_19: bool = false,
5747 _reserved_bit_20: bool = false,
5748 _reserved_bit_21: bool = false,
5749 _reserved_bit_22: bool = false,
5750 _reserved_bit_23: bool = false,
5751 _reserved_bit_24: bool = false,
5752 _reserved_bit_25: bool = false,
5753 _reserved_bit_26: bool = false,
5754 _reserved_bit_27: bool = false,
5755 _reserved_bit_28: bool = false,
5756 _reserved_bit_29: bool = false,
5757 _reserved_bit_30: bool = false,
5758 _reserved_bit_31: bool = false,
5759};
5760pub const @"NonSemantic.Shader.DebugInfo.100.DebugBaseTypeAttributeEncoding" = enum(u32) {
5761 unspecified = 0,
5762 address = 1,
5763 boolean = 2,
5764 float = 3,
5765 signed = 4,
5766 signed_char = 5,
5767 unsigned = 6,
5768 unsigned_char = 7,
5769};
5770pub const @"NonSemantic.Shader.DebugInfo.100.DebugCompositeType" = enum(u32) {
5771 class = 0,
5772 structure = 1,
5773 @"union" = 2,
5774};
5775pub const @"NonSemantic.Shader.DebugInfo.100.DebugTypeQualifier" = enum(u32) {
5776 const_type = 0,
5777 volatile_type = 1,
5778 restrict_type = 2,
5779 atomic_type = 3,
5780};
5781pub const @"NonSemantic.Shader.DebugInfo.100.DebugOperation" = enum(u32) {
5782 deref = 0,
5783 plus = 1,
5784 minus = 2,
5785 plus_uconst = 3,
5786 bit_piece = 4,
5787 swap = 5,
5788 xderef = 6,
5789 stack_value = 7,
5790 constu = 8,
5791 fragment = 9,
5792
5793 pub const Extended = union(@"NonSemantic.Shader.DebugInfo.100.DebugOperation") {
5794 deref,
5795 plus,
5796 minus,
5797 plus_uconst: struct { id_ref: Id },
5798 bit_piece: struct { id_ref_0: Id, id_ref_1: Id },
5799 swap,
5800 xderef,
5801 stack_value,
5802 constu: struct { id_ref: Id },
5803 fragment: struct { id_ref_0: Id, id_ref_1: Id },
5804 };
5805};
5806pub const @"NonSemantic.Shader.DebugInfo.100.DebugImportedEntity" = enum(u32) {
5807 imported_module = 0,
5808 imported_declaration = 1,
5809};
58105544pub const InstructionSet = enum {
58115545 core,
5812 SPV_AMD_shader_trinary_minmax,
5813 SPV_EXT_INST_TYPE_TOSA_001000_1,
5814 @"NonSemantic.VkspReflection",
5815 SPV_AMD_shader_explicit_vertex_parameter,
5816 DebugInfo,
5817 @"NonSemantic.DebugBreak",
5818 @"OpenCL.DebugInfo.100",
5819 @"NonSemantic.ClspvReflection.6",
58205546 @"GLSL.std.450",
5821 SPV_AMD_shader_ballot,
5822 @"NonSemantic.DebugPrintf",
5823 SPV_AMD_gcn_shader,
58245547 @"OpenCL.std",
5825 @"NonSemantic.Shader.DebugInfo.100",
58265548 zig,
58275549
58285550 pub fn instructions(self: InstructionSet) []const Instruction {
......@@ -14088,480 +13810,321 @@ pub const InstructionSet = enum {
1408813810 },
1408913811 },
1409013812 },
14091 .SPV_AMD_shader_trinary_minmax => &.{
13813 .@"GLSL.std.450" => &.{
1409213814 .{
14093 .name = "FMin3AMD",
13815 .name = "Round",
1409413816 .opcode = 1,
1409513817 .operands = &.{
1409613818 .{ .kind = .id_ref, .quantifier = .required },
14097 .{ .kind = .id_ref, .quantifier = .required },
14098 .{ .kind = .id_ref, .quantifier = .required },
1409913819 },
1410013820 },
1410113821 .{
14102 .name = "UMin3AMD",
13822 .name = "RoundEven",
1410313823 .opcode = 2,
1410413824 .operands = &.{
1410513825 .{ .kind = .id_ref, .quantifier = .required },
14106 .{ .kind = .id_ref, .quantifier = .required },
14107 .{ .kind = .id_ref, .quantifier = .required },
1410813826 },
1410913827 },
1411013828 .{
14111 .name = "SMin3AMD",
13829 .name = "Trunc",
1411213830 .opcode = 3,
1411313831 .operands = &.{
1411413832 .{ .kind = .id_ref, .quantifier = .required },
14115 .{ .kind = .id_ref, .quantifier = .required },
14116 .{ .kind = .id_ref, .quantifier = .required },
1411713833 },
1411813834 },
1411913835 .{
14120 .name = "FMax3AMD",
13836 .name = "FAbs",
1412113837 .opcode = 4,
1412213838 .operands = &.{
1412313839 .{ .kind = .id_ref, .quantifier = .required },
14124 .{ .kind = .id_ref, .quantifier = .required },
14125 .{ .kind = .id_ref, .quantifier = .required },
1412613840 },
1412713841 },
1412813842 .{
14129 .name = "UMax3AMD",
13843 .name = "SAbs",
1413013844 .opcode = 5,
1413113845 .operands = &.{
1413213846 .{ .kind = .id_ref, .quantifier = .required },
14133 .{ .kind = .id_ref, .quantifier = .required },
14134 .{ .kind = .id_ref, .quantifier = .required },
1413513847 },
1413613848 },
1413713849 .{
14138 .name = "SMax3AMD",
13850 .name = "FSign",
1413913851 .opcode = 6,
1414013852 .operands = &.{
1414113853 .{ .kind = .id_ref, .quantifier = .required },
14142 .{ .kind = .id_ref, .quantifier = .required },
14143 .{ .kind = .id_ref, .quantifier = .required },
1414413854 },
1414513855 },
1414613856 .{
14147 .name = "FMid3AMD",
13857 .name = "SSign",
1414813858 .opcode = 7,
1414913859 .operands = &.{
1415013860 .{ .kind = .id_ref, .quantifier = .required },
14151 .{ .kind = .id_ref, .quantifier = .required },
14152 .{ .kind = .id_ref, .quantifier = .required },
1415313861 },
1415413862 },
1415513863 .{
14156 .name = "UMid3AMD",
13864 .name = "Floor",
1415713865 .opcode = 8,
1415813866 .operands = &.{
1415913867 .{ .kind = .id_ref, .quantifier = .required },
14160 .{ .kind = .id_ref, .quantifier = .required },
14161 .{ .kind = .id_ref, .quantifier = .required },
1416213868 },
1416313869 },
1416413870 .{
14165 .name = "SMid3AMD",
13871 .name = "Ceil",
1416613872 .opcode = 9,
1416713873 .operands = &.{
1416813874 .{ .kind = .id_ref, .quantifier = .required },
14169 .{ .kind = .id_ref, .quantifier = .required },
14170 .{ .kind = .id_ref, .quantifier = .required },
1417113875 },
1417213876 },
14173 },
14174 .SPV_EXT_INST_TYPE_TOSA_001000_1 => &.{
1417513877 .{
14176 .name = "ARGMAX",
14177 .opcode = 0,
13878 .name = "Fract",
13879 .opcode = 10,
1417813880 .operands = &.{
1417913881 .{ .kind = .id_ref, .quantifier = .required },
14180 .{ .kind = .id_ref, .quantifier = .required },
14181 .{ .kind = .id_ref, .quantifier = .required },
1418213882 },
1418313883 },
1418413884 .{
14185 .name = "AVG_POOL2D",
14186 .opcode = 1,
13885 .name = "Radians",
13886 .opcode = 11,
1418713887 .operands = &.{
1418813888 .{ .kind = .id_ref, .quantifier = .required },
14189 .{ .kind = .id_ref, .quantifier = .required },
14190 .{ .kind = .id_ref, .quantifier = .required },
14191 .{ .kind = .id_ref, .quantifier = .required },
14192 .{ .kind = .id_ref, .quantifier = .required },
14193 .{ .kind = .id_ref, .quantifier = .required },
14194 .{ .kind = .id_ref, .quantifier = .required },
1419513889 },
1419613890 },
1419713891 .{
14198 .name = "CONV2D",
14199 .opcode = 2,
13892 .name = "Degrees",
13893 .opcode = 12,
1420013894 .operands = &.{
1420113895 .{ .kind = .id_ref, .quantifier = .required },
14202 .{ .kind = .id_ref, .quantifier = .required },
14203 .{ .kind = .id_ref, .quantifier = .required },
14204 .{ .kind = .id_ref, .quantifier = .required },
14205 .{ .kind = .id_ref, .quantifier = .required },
14206 .{ .kind = .id_ref, .quantifier = .required },
14207 .{ .kind = .id_ref, .quantifier = .required },
14208 .{ .kind = .id_ref, .quantifier = .required },
14209 .{ .kind = .id_ref, .quantifier = .required },
14210 .{ .kind = .id_ref, .quantifier = .required },
1421113896 },
1421213897 },
1421313898 .{
14214 .name = "CONV3D",
14215 .opcode = 3,
13899 .name = "Sin",
13900 .opcode = 13,
1421613901 .operands = &.{
1421713902 .{ .kind = .id_ref, .quantifier = .required },
14218 .{ .kind = .id_ref, .quantifier = .required },
14219 .{ .kind = .id_ref, .quantifier = .required },
14220 .{ .kind = .id_ref, .quantifier = .required },
14221 .{ .kind = .id_ref, .quantifier = .required },
14222 .{ .kind = .id_ref, .quantifier = .required },
14223 .{ .kind = .id_ref, .quantifier = .required },
14224 .{ .kind = .id_ref, .quantifier = .required },
14225 .{ .kind = .id_ref, .quantifier = .required },
14226 .{ .kind = .id_ref, .quantifier = .required },
1422713903 },
1422813904 },
1422913905 .{
14230 .name = "DEPTHWISE_CONV2D",
14231 .opcode = 4,
13906 .name = "Cos",
13907 .opcode = 14,
1423213908 .operands = &.{
1423313909 .{ .kind = .id_ref, .quantifier = .required },
14234 .{ .kind = .id_ref, .quantifier = .required },
14235 .{ .kind = .id_ref, .quantifier = .required },
14236 .{ .kind = .id_ref, .quantifier = .required },
14237 .{ .kind = .id_ref, .quantifier = .required },
14238 .{ .kind = .id_ref, .quantifier = .required },
14239 .{ .kind = .id_ref, .quantifier = .required },
14240 .{ .kind = .id_ref, .quantifier = .required },
14241 .{ .kind = .id_ref, .quantifier = .required },
14242 .{ .kind = .id_ref, .quantifier = .required },
1424313910 },
1424413911 },
1424513912 .{
14246 .name = "FFT2D",
14247 .opcode = 5,
13913 .name = "Tan",
13914 .opcode = 15,
1424813915 .operands = &.{
1424913916 .{ .kind = .id_ref, .quantifier = .required },
14250 .{ .kind = .id_ref, .quantifier = .required },
14251 .{ .kind = .id_ref, .quantifier = .required },
14252 .{ .kind = .id_ref, .quantifier = .required },
1425313917 },
1425413918 },
1425513919 .{
14256 .name = "MATMUL",
14257 .opcode = 6,
13920 .name = "Asin",
13921 .opcode = 16,
1425813922 .operands = &.{
1425913923 .{ .kind = .id_ref, .quantifier = .required },
14260 .{ .kind = .id_ref, .quantifier = .required },
14261 .{ .kind = .id_ref, .quantifier = .required },
14262 .{ .kind = .id_ref, .quantifier = .required },
1426313924 },
1426413925 },
1426513926 .{
14266 .name = "MAX_POOL2D",
14267 .opcode = 7,
13927 .name = "Acos",
13928 .opcode = 17,
1426813929 .operands = &.{
1426913930 .{ .kind = .id_ref, .quantifier = .required },
14270 .{ .kind = .id_ref, .quantifier = .required },
14271 .{ .kind = .id_ref, .quantifier = .required },
14272 .{ .kind = .id_ref, .quantifier = .required },
14273 .{ .kind = .id_ref, .quantifier = .required },
14274 },
14275 },
14276 .{
14277 .name = "RFFT2D",
14278 .opcode = 8,
14279 .operands = &.{
14280 .{ .kind = .id_ref, .quantifier = .required },
14281 .{ .kind = .id_ref, .quantifier = .required },
14282 },
14283 },
14284 .{
14285 .name = "TRANSPOSE_CONV2D",
14286 .opcode = 9,
14287 .operands = &.{
14288 .{ .kind = .id_ref, .quantifier = .required },
14289 .{ .kind = .id_ref, .quantifier = .required },
14290 .{ .kind = .id_ref, .quantifier = .required },
14291 .{ .kind = .id_ref, .quantifier = .required },
14292 .{ .kind = .id_ref, .quantifier = .required },
14293 .{ .kind = .id_ref, .quantifier = .required },
14294 .{ .kind = .id_ref, .quantifier = .required },
14295 .{ .kind = .id_ref, .quantifier = .required },
14296 .{ .kind = .id_ref, .quantifier = .required },
14297 },
14298 },
14299 .{
14300 .name = "CLAMP",
14301 .opcode = 10,
14302 .operands = &.{
14303 .{ .kind = .id_ref, .quantifier = .required },
14304 .{ .kind = .id_ref, .quantifier = .required },
14305 .{ .kind = .id_ref, .quantifier = .required },
14306 .{ .kind = .id_ref, .quantifier = .required },
14307 },
14308 },
14309 .{
14310 .name = "ERF",
14311 .opcode = 11,
14312 .operands = &.{
14313 .{ .kind = .id_ref, .quantifier = .required },
14314 },
14315 },
14316 .{
14317 .name = "SIGMOID",
14318 .opcode = 12,
14319 .operands = &.{
14320 .{ .kind = .id_ref, .quantifier = .required },
14321 },
14322 },
14323 .{
14324 .name = "TANH",
14325 .opcode = 13,
14326 .operands = &.{
14327 .{ .kind = .id_ref, .quantifier = .required },
14328 },
14329 },
14330 .{
14331 .name = "ADD",
14332 .opcode = 14,
14333 .operands = &.{
14334 .{ .kind = .id_ref, .quantifier = .required },
14335 .{ .kind = .id_ref, .quantifier = .required },
14336 },
14337 },
14338 .{
14339 .name = "ARITHMETIC_RIGHT_SHIFT",
14340 .opcode = 15,
14341 .operands = &.{
14342 .{ .kind = .id_ref, .quantifier = .required },
14343 .{ .kind = .id_ref, .quantifier = .required },
14344 .{ .kind = .id_ref, .quantifier = .required },
14345 },
14346 },
14347 .{
14348 .name = "BITWISE_AND",
14349 .opcode = 16,
14350 .operands = &.{
14351 .{ .kind = .id_ref, .quantifier = .required },
14352 .{ .kind = .id_ref, .quantifier = .required },
1435313931 },
1435413932 },
1435513933 .{
14356 .name = "BITWISE_OR",
14357 .opcode = 17,
14358 .operands = &.{
14359 .{ .kind = .id_ref, .quantifier = .required },
14360 .{ .kind = .id_ref, .quantifier = .required },
14361 },
14362 },
14363 .{
14364 .name = "BITWISE_XOR",
13934 .name = "Atan",
1436513935 .opcode = 18,
1436613936 .operands = &.{
1436713937 .{ .kind = .id_ref, .quantifier = .required },
14368 .{ .kind = .id_ref, .quantifier = .required },
1436913938 },
1437013939 },
1437113940 .{
14372 .name = "INTDIV",
13941 .name = "Sinh",
1437313942 .opcode = 19,
1437413943 .operands = &.{
1437513944 .{ .kind = .id_ref, .quantifier = .required },
14376 .{ .kind = .id_ref, .quantifier = .required },
1437713945 },
1437813946 },
1437913947 .{
14380 .name = "LOGICAL_AND",
13948 .name = "Cosh",
1438113949 .opcode = 20,
1438213950 .operands = &.{
1438313951 .{ .kind = .id_ref, .quantifier = .required },
14384 .{ .kind = .id_ref, .quantifier = .required },
1438513952 },
1438613953 },
1438713954 .{
14388 .name = "LOGICAL_LEFT_SHIFT",
13955 .name = "Tanh",
1438913956 .opcode = 21,
1439013957 .operands = &.{
1439113958 .{ .kind = .id_ref, .quantifier = .required },
14392 .{ .kind = .id_ref, .quantifier = .required },
1439313959 },
1439413960 },
1439513961 .{
14396 .name = "LOGICAL_RIGHT_SHIFT",
13962 .name = "Asinh",
1439713963 .opcode = 22,
1439813964 .operands = &.{
1439913965 .{ .kind = .id_ref, .quantifier = .required },
14400 .{ .kind = .id_ref, .quantifier = .required },
1440113966 },
1440213967 },
1440313968 .{
14404 .name = "LOGICAL_OR",
13969 .name = "Acosh",
1440513970 .opcode = 23,
1440613971 .operands = &.{
1440713972 .{ .kind = .id_ref, .quantifier = .required },
14408 .{ .kind = .id_ref, .quantifier = .required },
1440913973 },
1441013974 },
1441113975 .{
14412 .name = "LOGICAL_XOR",
13976 .name = "Atanh",
1441313977 .opcode = 24,
1441413978 .operands = &.{
1441513979 .{ .kind = .id_ref, .quantifier = .required },
14416 .{ .kind = .id_ref, .quantifier = .required },
1441713980 },
1441813981 },
1441913982 .{
14420 .name = "MAXIMUM",
13983 .name = "Atan2",
1442113984 .opcode = 25,
1442213985 .operands = &.{
1442313986 .{ .kind = .id_ref, .quantifier = .required },
1442413987 .{ .kind = .id_ref, .quantifier = .required },
14425 .{ .kind = .id_ref, .quantifier = .required },
1442613988 },
1442713989 },
1442813990 .{
14429 .name = "MINIMUM",
13991 .name = "Pow",
1443013992 .opcode = 26,
1443113993 .operands = &.{
1443213994 .{ .kind = .id_ref, .quantifier = .required },
1443313995 .{ .kind = .id_ref, .quantifier = .required },
14434 .{ .kind = .id_ref, .quantifier = .required },
1443513996 },
1443613997 },
1443713998 .{
14438 .name = "MUL",
13999 .name = "Exp",
1443914000 .opcode = 27,
1444014001 .operands = &.{
1444114002 .{ .kind = .id_ref, .quantifier = .required },
14442 .{ .kind = .id_ref, .quantifier = .required },
14443 .{ .kind = .id_ref, .quantifier = .required },
1444414003 },
1444514004 },
1444614005 .{
14447 .name = "POW",
14006 .name = "Log",
1444814007 .opcode = 28,
1444914008 .operands = &.{
1445014009 .{ .kind = .id_ref, .quantifier = .required },
14451 .{ .kind = .id_ref, .quantifier = .required },
1445214010 },
1445314011 },
1445414012 .{
14455 .name = "SUB",
14013 .name = "Exp2",
1445614014 .opcode = 29,
1445714015 .operands = &.{
1445814016 .{ .kind = .id_ref, .quantifier = .required },
14459 .{ .kind = .id_ref, .quantifier = .required },
1446014017 },
1446114018 },
1446214019 .{
14463 .name = "TABLE",
14020 .name = "Log2",
1446414021 .opcode = 30,
1446514022 .operands = &.{
1446614023 .{ .kind = .id_ref, .quantifier = .required },
14467 .{ .kind = .id_ref, .quantifier = .required },
1446814024 },
1446914025 },
1447014026 .{
14471 .name = "ABS",
14027 .name = "Sqrt",
1447214028 .opcode = 31,
1447314029 .operands = &.{
1447414030 .{ .kind = .id_ref, .quantifier = .required },
1447514031 },
1447614032 },
1447714033 .{
14478 .name = "BITWISE_NOT",
14034 .name = "InverseSqrt",
1447914035 .opcode = 32,
1448014036 .operands = &.{
1448114037 .{ .kind = .id_ref, .quantifier = .required },
1448214038 },
1448314039 },
1448414040 .{
14485 .name = "CEIL",
14041 .name = "Determinant",
1448614042 .opcode = 33,
1448714043 .operands = &.{
1448814044 .{ .kind = .id_ref, .quantifier = .required },
1448914045 },
1449014046 },
1449114047 .{
14492 .name = "CLZ",
14048 .name = "MatrixInverse",
1449314049 .opcode = 34,
1449414050 .operands = &.{
1449514051 .{ .kind = .id_ref, .quantifier = .required },
1449614052 },
1449714053 },
1449814054 .{
14499 .name = "COS",
14055 .name = "Modf",
1450014056 .opcode = 35,
1450114057 .operands = &.{
1450214058 .{ .kind = .id_ref, .quantifier = .required },
14059 .{ .kind = .id_ref, .quantifier = .required },
1450314060 },
1450414061 },
1450514062 .{
14506 .name = "EXP",
14063 .name = "ModfStruct",
1450714064 .opcode = 36,
1450814065 .operands = &.{
1450914066 .{ .kind = .id_ref, .quantifier = .required },
1451014067 },
1451114068 },
1451214069 .{
14513 .name = "FLOOR",
14070 .name = "FMin",
1451414071 .opcode = 37,
1451514072 .operands = &.{
1451614073 .{ .kind = .id_ref, .quantifier = .required },
14074 .{ .kind = .id_ref, .quantifier = .required },
1451714075 },
1451814076 },
1451914077 .{
14520 .name = "LOG",
14078 .name = "UMin",
1452114079 .opcode = 38,
1452214080 .operands = &.{
1452314081 .{ .kind = .id_ref, .quantifier = .required },
14082 .{ .kind = .id_ref, .quantifier = .required },
1452414083 },
1452514084 },
1452614085 .{
14527 .name = "LOGICAL_NOT",
14086 .name = "SMin",
1452814087 .opcode = 39,
1452914088 .operands = &.{
1453014089 .{ .kind = .id_ref, .quantifier = .required },
14090 .{ .kind = .id_ref, .quantifier = .required },
1453114091 },
1453214092 },
1453314093 .{
14534 .name = "NEGATE",
14094 .name = "FMax",
1453514095 .opcode = 40,
1453614096 .operands = &.{
1453714097 .{ .kind = .id_ref, .quantifier = .required },
1453814098 .{ .kind = .id_ref, .quantifier = .required },
14539 .{ .kind = .id_ref, .quantifier = .required },
1454014099 },
1454114100 },
1454214101 .{
14543 .name = "RECIPROCAL",
14102 .name = "UMax",
1454414103 .opcode = 41,
1454514104 .operands = &.{
1454614105 .{ .kind = .id_ref, .quantifier = .required },
14106 .{ .kind = .id_ref, .quantifier = .required },
1454714107 },
1454814108 },
1454914109 .{
14550 .name = "RSQRT",
14110 .name = "SMax",
1455114111 .opcode = 42,
1455214112 .operands = &.{
1455314113 .{ .kind = .id_ref, .quantifier = .required },
14114 .{ .kind = .id_ref, .quantifier = .required },
1455414115 },
1455514116 },
1455614117 .{
14557 .name = "SIN",
14118 .name = "FClamp",
1455814119 .opcode = 43,
1455914120 .operands = &.{
1456014121 .{ .kind = .id_ref, .quantifier = .required },
14122 .{ .kind = .id_ref, .quantifier = .required },
14123 .{ .kind = .id_ref, .quantifier = .required },
1456114124 },
1456214125 },
1456314126 .{
14564 .name = "SELECT",
14127 .name = "UClamp",
1456514128 .opcode = 44,
1456614129 .operands = &.{
1456714130 .{ .kind = .id_ref, .quantifier = .required },
......@@ -14570,31 +14133,34 @@ pub const InstructionSet = enum {
1457014133 },
1457114134 },
1457214135 .{
14573 .name = "EQUAL",
14136 .name = "SClamp",
1457414137 .opcode = 45,
1457514138 .operands = &.{
1457614139 .{ .kind = .id_ref, .quantifier = .required },
1457714140 .{ .kind = .id_ref, .quantifier = .required },
14141 .{ .kind = .id_ref, .quantifier = .required },
1457814142 },
1457914143 },
1458014144 .{
14581 .name = "GREATER",
14145 .name = "FMix",
1458214146 .opcode = 46,
1458314147 .operands = &.{
1458414148 .{ .kind = .id_ref, .quantifier = .required },
1458514149 .{ .kind = .id_ref, .quantifier = .required },
14150 .{ .kind = .id_ref, .quantifier = .required },
1458614151 },
1458714152 },
1458814153 .{
14589 .name = "GREATER_EQUAL",
14154 .name = "IMix",
1459014155 .opcode = 47,
1459114156 .operands = &.{
1459214157 .{ .kind = .id_ref, .quantifier = .required },
1459314158 .{ .kind = .id_ref, .quantifier = .required },
14159 .{ .kind = .id_ref, .quantifier = .required },
1459414160 },
1459514161 },
1459614162 .{
14597 .name = "REDUCE_ALL",
14163 .name = "Step",
1459814164 .opcode = 48,
1459914165 .operands = &.{
1460014166 .{ .kind = .id_ref, .quantifier = .required },
......@@ -14602,15 +14168,16 @@ pub const InstructionSet = enum {
1460214168 },
1460314169 },
1460414170 .{
14605 .name = "REDUCE_ANY",
14171 .name = "SmoothStep",
1460614172 .opcode = 49,
1460714173 .operands = &.{
1460814174 .{ .kind = .id_ref, .quantifier = .required },
1460914175 .{ .kind = .id_ref, .quantifier = .required },
14176 .{ .kind = .id_ref, .quantifier = .required },
1461014177 },
1461114178 },
1461214179 .{
14613 .name = "REDUCE_MAX",
14180 .name = "Fma",
1461414181 .opcode = 50,
1461514182 .operands = &.{
1461614183 .{ .kind = .id_ref, .quantifier = .required },
......@@ -14619,24 +14186,22 @@ pub const InstructionSet = enum {
1461914186 },
1462014187 },
1462114188 .{
14622 .name = "REDUCE_MIN",
14189 .name = "Frexp",
1462314190 .opcode = 51,
1462414191 .operands = &.{
1462514192 .{ .kind = .id_ref, .quantifier = .required },
1462614193 .{ .kind = .id_ref, .quantifier = .required },
14627 .{ .kind = .id_ref, .quantifier = .required },
1462814194 },
1462914195 },
1463014196 .{
14631 .name = "REDUCE_PRODUCT",
14197 .name = "FrexpStruct",
1463214198 .opcode = 52,
1463314199 .operands = &.{
1463414200 .{ .kind = .id_ref, .quantifier = .required },
14635 .{ .kind = .id_ref, .quantifier = .required },
1463614201 },
1463714202 },
1463814203 .{
14639 .name = "REDUCE_SUM",
14204 .name = "Ldexp",
1464014205 .opcode = 53,
1464114206 .operands = &.{
1464214207 .{ .kind = .id_ref, .quantifier = .required },
......@@ -14644,3368 +14209,1112 @@ pub const InstructionSet = enum {
1464414209 },
1464514210 },
1464614211 .{
14647 .name = "CONCAT",
14212 .name = "PackSnorm4x8",
1464814213 .opcode = 54,
1464914214 .operands = &.{
1465014215 .{ .kind = .id_ref, .quantifier = .required },
14651 .{ .kind = .id_ref, .quantifier = .variadic },
1465214216 },
1465314217 },
1465414218 .{
14655 .name = "PAD",
14219 .name = "PackUnorm4x8",
1465614220 .opcode = 55,
1465714221 .operands = &.{
1465814222 .{ .kind = .id_ref, .quantifier = .required },
14659 .{ .kind = .id_ref, .quantifier = .required },
14660 .{ .kind = .id_ref, .quantifier = .required },
1466114223 },
1466214224 },
1466314225 .{
14664 .name = "RESHAPE",
14226 .name = "PackSnorm2x16",
1466514227 .opcode = 56,
1466614228 .operands = &.{
1466714229 .{ .kind = .id_ref, .quantifier = .required },
14668 .{ .kind = .id_ref, .quantifier = .required },
1466914230 },
1467014231 },
1467114232 .{
14672 .name = "REVERSE",
14233 .name = "PackUnorm2x16",
1467314234 .opcode = 57,
1467414235 .operands = &.{
1467514236 .{ .kind = .id_ref, .quantifier = .required },
14676 .{ .kind = .id_ref, .quantifier = .required },
1467714237 },
1467814238 },
1467914239 .{
14680 .name = "SLICE",
14240 .name = "PackHalf2x16",
1468114241 .opcode = 58,
1468214242 .operands = &.{
1468314243 .{ .kind = .id_ref, .quantifier = .required },
14684 .{ .kind = .id_ref, .quantifier = .required },
14685 .{ .kind = .id_ref, .quantifier = .required },
1468614244 },
1468714245 },
1468814246 .{
14689 .name = "TILE",
14247 .name = "PackDouble2x32",
1469014248 .opcode = 59,
1469114249 .operands = &.{
1469214250 .{ .kind = .id_ref, .quantifier = .required },
14693 .{ .kind = .id_ref, .quantifier = .required },
1469414251 },
1469514252 },
1469614253 .{
14697 .name = "TRANSPOSE",
14254 .name = "UnpackSnorm2x16",
1469814255 .opcode = 60,
1469914256 .operands = &.{
1470014257 .{ .kind = .id_ref, .quantifier = .required },
14701 .{ .kind = .id_ref, .quantifier = .required },
1470214258 },
1470314259 },
1470414260 .{
14705 .name = "GATHER",
14261 .name = "UnpackUnorm2x16",
1470614262 .opcode = 61,
1470714263 .operands = &.{
1470814264 .{ .kind = .id_ref, .quantifier = .required },
14709 .{ .kind = .id_ref, .quantifier = .required },
1471014265 },
1471114266 },
1471214267 .{
14713 .name = "SCATTER",
14268 .name = "UnpackHalf2x16",
1471414269 .opcode = 62,
1471514270 .operands = &.{
1471614271 .{ .kind = .id_ref, .quantifier = .required },
14717 .{ .kind = .id_ref, .quantifier = .required },
14718 .{ .kind = .id_ref, .quantifier = .required },
1471914272 },
1472014273 },
1472114274 .{
14722 .name = "RESIZE",
14275 .name = "UnpackSnorm4x8",
1472314276 .opcode = 63,
1472414277 .operands = &.{
1472514278 .{ .kind = .id_ref, .quantifier = .required },
14726 .{ .kind = .id_ref, .quantifier = .required },
14727 .{ .kind = .id_ref, .quantifier = .required },
14728 .{ .kind = .id_ref, .quantifier = .required },
14729 .{ .kind = .id_ref, .quantifier = .required },
1473014279 },
1473114280 },
1473214281 .{
14733 .name = "CAST",
14282 .name = "UnpackUnorm4x8",
1473414283 .opcode = 64,
1473514284 .operands = &.{
1473614285 .{ .kind = .id_ref, .quantifier = .required },
1473714286 },
1473814287 },
1473914288 .{
14740 .name = "RESCALE",
14289 .name = "UnpackDouble2x32",
1474114290 .opcode = 65,
1474214291 .operands = &.{
1474314292 .{ .kind = .id_ref, .quantifier = .required },
14293 },
14294 },
14295 .{
14296 .name = "Length",
14297 .opcode = 66,
14298 .operands = &.{
1474414299 .{ .kind = .id_ref, .quantifier = .required },
14300 },
14301 },
14302 .{
14303 .name = "Distance",
14304 .opcode = 67,
14305 .operands = &.{
1474514306 .{ .kind = .id_ref, .quantifier = .required },
1474614307 .{ .kind = .id_ref, .quantifier = .required },
14747 .{ .kind = .id_ref, .quantifier = .required },
14748 .{ .kind = .id_ref, .quantifier = .required },
14749 .{ .kind = .id_ref, .quantifier = .required },
14750 .{ .kind = .id_ref, .quantifier = .required },
14308 },
14309 },
14310 .{
14311 .name = "Cross",
14312 .opcode = 68,
14313 .operands = &.{
1475114314 .{ .kind = .id_ref, .quantifier = .required },
1475214315 .{ .kind = .id_ref, .quantifier = .required },
1475314316 },
1475414317 },
14755 },
14756 .@"NonSemantic.VkspReflection" => &.{
1475714318 .{
14758 .name = "Configuration",
14759 .opcode = 1,
14319 .name = "Normalize",
14320 .opcode = 69,
1476014321 .operands = &.{
1476114322 .{ .kind = .id_ref, .quantifier = .required },
14323 },
14324 },
14325 .{
14326 .name = "FaceForward",
14327 .opcode = 70,
14328 .operands = &.{
1476214329 .{ .kind = .id_ref, .quantifier = .required },
1476314330 .{ .kind = .id_ref, .quantifier = .required },
1476414331 .{ .kind = .id_ref, .quantifier = .required },
14332 },
14333 },
14334 .{
14335 .name = "Reflect",
14336 .opcode = 71,
14337 .operands = &.{
1476514338 .{ .kind = .id_ref, .quantifier = .required },
1476614339 .{ .kind = .id_ref, .quantifier = .required },
14340 },
14341 },
14342 .{
14343 .name = "Refract",
14344 .opcode = 72,
14345 .operands = &.{
1476714346 .{ .kind = .id_ref, .quantifier = .required },
1476814347 .{ .kind = .id_ref, .quantifier = .required },
1476914348 .{ .kind = .id_ref, .quantifier = .required },
1477014349 },
1477114350 },
1477214351 .{
14773 .name = "StartCounter",
14774 .opcode = 2,
14352 .name = "FindILsb",
14353 .opcode = 73,
1477514354 .operands = &.{
1477614355 .{ .kind = .id_ref, .quantifier = .required },
1477714356 },
1477814357 },
1477914358 .{
14780 .name = "StopCounter",
14781 .opcode = 3,
14359 .name = "FindSMsb",
14360 .opcode = 74,
1478214361 .operands = &.{
1478314362 .{ .kind = .id_ref, .quantifier = .required },
1478414363 },
1478514364 },
1478614365 .{
14787 .name = "PushConstants",
14788 .opcode = 4,
14366 .name = "FindUMsb",
14367 .opcode = 75,
1478914368 .operands = &.{
1479014369 .{ .kind = .id_ref, .quantifier = .required },
14370 },
14371 },
14372 .{
14373 .name = "InterpolateAtCentroid",
14374 .opcode = 76,
14375 .operands = &.{
1479114376 .{ .kind = .id_ref, .quantifier = .required },
14377 },
14378 },
14379 .{
14380 .name = "InterpolateAtSample",
14381 .opcode = 77,
14382 .operands = &.{
1479214383 .{ .kind = .id_ref, .quantifier = .required },
1479314384 .{ .kind = .id_ref, .quantifier = .required },
1479414385 },
1479514386 },
1479614387 .{
14797 .name = "SpecializationMapEntry",
14798 .opcode = 5,
14388 .name = "InterpolateAtOffset",
14389 .opcode = 78,
1479914390 .operands = &.{
1480014391 .{ .kind = .id_ref, .quantifier = .required },
1480114392 .{ .kind = .id_ref, .quantifier = .required },
14802 .{ .kind = .id_ref, .quantifier = .required },
1480314393 },
1480414394 },
1480514395 .{
14806 .name = "DescriptorSetBuffer",
14807 .opcode = 6,
14396 .name = "NMin",
14397 .opcode = 79,
1480814398 .operands = &.{
1480914399 .{ .kind = .id_ref, .quantifier = .required },
1481014400 .{ .kind = .id_ref, .quantifier = .required },
14401 },
14402 },
14403 .{
14404 .name = "NMax",
14405 .opcode = 80,
14406 .operands = &.{
1481114407 .{ .kind = .id_ref, .quantifier = .required },
1481214408 .{ .kind = .id_ref, .quantifier = .required },
14813 .{ .kind = .id_ref, .quantifier = .required },
14814 .{ .kind = .id_ref, .quantifier = .required },
14815 .{ .kind = .id_ref, .quantifier = .required },
14816 .{ .kind = .id_ref, .quantifier = .required },
14817 .{ .kind = .id_ref, .quantifier = .required },
14818 .{ .kind = .id_ref, .quantifier = .required },
14819 .{ .kind = .id_ref, .quantifier = .required },
14820 .{ .kind = .id_ref, .quantifier = .required },
14821 .{ .kind = .id_ref, .quantifier = .required },
14822 .{ .kind = .id_ref, .quantifier = .required },
14823 .{ .kind = .id_ref, .quantifier = .required },
14824 },
14825 },
14826 .{
14827 .name = "DescriptorSetImage",
14828 .opcode = 7,
14829 .operands = &.{
14830 .{ .kind = .id_ref, .quantifier = .required },
14831 .{ .kind = .id_ref, .quantifier = .required },
14832 .{ .kind = .id_ref, .quantifier = .required },
14833 .{ .kind = .id_ref, .quantifier = .required },
14834 .{ .kind = .id_ref, .quantifier = .required },
14835 .{ .kind = .id_ref, .quantifier = .required },
14836 .{ .kind = .id_ref, .quantifier = .required },
14837 .{ .kind = .id_ref, .quantifier = .required },
14838 .{ .kind = .id_ref, .quantifier = .required },
14839 .{ .kind = .id_ref, .quantifier = .required },
14840 .{ .kind = .id_ref, .quantifier = .required },
14841 .{ .kind = .id_ref, .quantifier = .required },
14842 .{ .kind = .id_ref, .quantifier = .required },
14843 .{ .kind = .id_ref, .quantifier = .required },
14844 .{ .kind = .id_ref, .quantifier = .required },
14845 .{ .kind = .id_ref, .quantifier = .required },
14846 .{ .kind = .id_ref, .quantifier = .required },
14847 .{ .kind = .id_ref, .quantifier = .required },
14848 .{ .kind = .id_ref, .quantifier = .required },
14849 .{ .kind = .id_ref, .quantifier = .required },
14850 .{ .kind = .id_ref, .quantifier = .required },
14851 .{ .kind = .id_ref, .quantifier = .required },
14852 .{ .kind = .id_ref, .quantifier = .required },
14853 .{ .kind = .id_ref, .quantifier = .required },
14854 .{ .kind = .id_ref, .quantifier = .required },
14855 .{ .kind = .id_ref, .quantifier = .required },
14856 .{ .kind = .id_ref, .quantifier = .required },
14857 .{ .kind = .id_ref, .quantifier = .required },
14858 .{ .kind = .id_ref, .quantifier = .required },
14859 .{ .kind = .id_ref, .quantifier = .required },
14860 .{ .kind = .id_ref, .quantifier = .required },
14861 .{ .kind = .id_ref, .quantifier = .required },
14862 .{ .kind = .id_ref, .quantifier = .required },
14863 },
14864 },
14865 .{
14866 .name = "DescriptorSetSampler",
14867 .opcode = 8,
14868 .operands = &.{
14869 .{ .kind = .id_ref, .quantifier = .required },
14870 .{ .kind = .id_ref, .quantifier = .required },
14871 .{ .kind = .id_ref, .quantifier = .required },
14872 .{ .kind = .id_ref, .quantifier = .required },
14873 .{ .kind = .id_ref, .quantifier = .required },
14874 .{ .kind = .id_ref, .quantifier = .required },
14875 .{ .kind = .id_ref, .quantifier = .required },
14876 .{ .kind = .id_ref, .quantifier = .required },
14877 .{ .kind = .id_ref, .quantifier = .required },
14878 .{ .kind = .id_ref, .quantifier = .required },
14879 .{ .kind = .id_ref, .quantifier = .required },
14880 .{ .kind = .id_ref, .quantifier = .required },
14881 .{ .kind = .id_ref, .quantifier = .required },
14882 .{ .kind = .id_ref, .quantifier = .required },
14883 .{ .kind = .id_ref, .quantifier = .required },
14884 .{ .kind = .id_ref, .quantifier = .required },
14409 },
14410 },
14411 .{
14412 .name = "NClamp",
14413 .opcode = 81,
14414 .operands = &.{
1488514415 .{ .kind = .id_ref, .quantifier = .required },
1488614416 .{ .kind = .id_ref, .quantifier = .required },
1488714417 .{ .kind = .id_ref, .quantifier = .required },
1488814418 },
1488914419 },
1489014420 },
14891 .SPV_AMD_shader_explicit_vertex_parameter => &.{
14421 .@"OpenCL.std" => &.{
1489214422 .{
14893 .name = "InterpolateAtVertexAMD",
14894 .opcode = 1,
14423 .name = "acos",
14424 .opcode = 0,
1489514425 .operands = &.{
1489614426 .{ .kind = .id_ref, .quantifier = .required },
14897 .{ .kind = .id_ref, .quantifier = .required },
1489814427 },
1489914428 },
14900 },
14901 .DebugInfo => &.{
14902 .{
14903 .name = "DebugInfoNone",
14904 .opcode = 0,
14905 .operands = &.{},
14906 },
1490714429 .{
14908 .name = "DebugCompilationUnit",
14430 .name = "acosh",
1490914431 .opcode = 1,
1491014432 .operands = &.{
1491114433 .{ .kind = .id_ref, .quantifier = .required },
14912 .{ .kind = .literal_integer, .quantifier = .required },
14913 .{ .kind = .literal_integer, .quantifier = .required },
1491414434 },
1491514435 },
1491614436 .{
14917 .name = "DebugTypeBasic",
14437 .name = "acospi",
1491814438 .opcode = 2,
1491914439 .operands = &.{
1492014440 .{ .kind = .id_ref, .quantifier = .required },
14921 .{ .kind = .id_ref, .quantifier = .required },
14922 .{ .kind = .debug_info_debug_base_type_attribute_encoding, .quantifier = .required },
1492314441 },
1492414442 },
1492514443 .{
14926 .name = "DebugTypePointer",
14444 .name = "asin",
1492714445 .opcode = 3,
1492814446 .operands = &.{
1492914447 .{ .kind = .id_ref, .quantifier = .required },
14930 .{ .kind = .storage_class, .quantifier = .required },
14931 .{ .kind = .debug_info_debug_info_flags, .quantifier = .required },
1493214448 },
1493314449 },
1493414450 .{
14935 .name = "DebugTypeQualifier",
14451 .name = "asinh",
1493614452 .opcode = 4,
1493714453 .operands = &.{
1493814454 .{ .kind = .id_ref, .quantifier = .required },
14939 .{ .kind = .debug_info_debug_type_qualifier, .quantifier = .required },
1494014455 },
1494114456 },
1494214457 .{
14943 .name = "DebugTypeArray",
14458 .name = "asinpi",
1494414459 .opcode = 5,
1494514460 .operands = &.{
1494614461 .{ .kind = .id_ref, .quantifier = .required },
14947 .{ .kind = .id_ref, .quantifier = .variadic },
1494814462 },
1494914463 },
1495014464 .{
14951 .name = "DebugTypeVector",
14465 .name = "atan",
1495214466 .opcode = 6,
1495314467 .operands = &.{
1495414468 .{ .kind = .id_ref, .quantifier = .required },
14955 .{ .kind = .literal_integer, .quantifier = .required },
1495614469 },
1495714470 },
1495814471 .{
14959 .name = "DebugTypedef",
14472 .name = "atan2",
1496014473 .opcode = 7,
1496114474 .operands = &.{
1496214475 .{ .kind = .id_ref, .quantifier = .required },
1496314476 .{ .kind = .id_ref, .quantifier = .required },
14964 .{ .kind = .id_ref, .quantifier = .required },
14965 .{ .kind = .literal_integer, .quantifier = .required },
14966 .{ .kind = .literal_integer, .quantifier = .required },
14967 .{ .kind = .id_ref, .quantifier = .required },
1496814477 },
1496914478 },
1497014479 .{
14971 .name = "DebugTypeFunction",
14480 .name = "atanh",
1497214481 .opcode = 8,
1497314482 .operands = &.{
1497414483 .{ .kind = .id_ref, .quantifier = .required },
14975 .{ .kind = .id_ref, .quantifier = .variadic },
1497614484 },
1497714485 },
1497814486 .{
14979 .name = "DebugTypeEnum",
14487 .name = "atanpi",
1498014488 .opcode = 9,
1498114489 .operands = &.{
1498214490 .{ .kind = .id_ref, .quantifier = .required },
14983 .{ .kind = .id_ref, .quantifier = .required },
14984 .{ .kind = .id_ref, .quantifier = .required },
14985 .{ .kind = .literal_integer, .quantifier = .required },
14986 .{ .kind = .literal_integer, .quantifier = .required },
14987 .{ .kind = .id_ref, .quantifier = .required },
14988 .{ .kind = .id_ref, .quantifier = .required },
14989 .{ .kind = .debug_info_debug_info_flags, .quantifier = .required },
14990 .{ .kind = .pair_id_ref_id_ref, .quantifier = .variadic },
1499114491 },
1499214492 },
1499314493 .{
14994 .name = "DebugTypeComposite",
14494 .name = "atan2pi",
1499514495 .opcode = 10,
1499614496 .operands = &.{
1499714497 .{ .kind = .id_ref, .quantifier = .required },
14998 .{ .kind = .debug_info_debug_composite_type, .quantifier = .required },
14999 .{ .kind = .id_ref, .quantifier = .required },
15000 .{ .kind = .literal_integer, .quantifier = .required },
15001 .{ .kind = .literal_integer, .quantifier = .required },
15002 .{ .kind = .id_ref, .quantifier = .required },
15003 .{ .kind = .id_ref, .quantifier = .required },
15004 .{ .kind = .debug_info_debug_info_flags, .quantifier = .required },
15005 .{ .kind = .id_ref, .quantifier = .variadic },
15006 },
15007 },
15008 .{
15009 .name = "DebugTypeMember",
15010 .opcode = 11,
15011 .operands = &.{
15012 .{ .kind = .id_ref, .quantifier = .required },
15013 .{ .kind = .id_ref, .quantifier = .required },
15014 .{ .kind = .id_ref, .quantifier = .required },
15015 .{ .kind = .literal_integer, .quantifier = .required },
15016 .{ .kind = .literal_integer, .quantifier = .required },
15017 .{ .kind = .id_ref, .quantifier = .required },
15018 .{ .kind = .id_ref, .quantifier = .required },
15019 .{ .kind = .id_ref, .quantifier = .required },
15020 .{ .kind = .debug_info_debug_info_flags, .quantifier = .required },
15021 .{ .kind = .id_ref, .quantifier = .optional },
15022 },
15023 },
15024 .{
15025 .name = "DebugTypeInheritance",
15026 .opcode = 12,
15027 .operands = &.{
15028 .{ .kind = .id_ref, .quantifier = .required },
15029 .{ .kind = .id_ref, .quantifier = .required },
15030 .{ .kind = .id_ref, .quantifier = .required },
15031 .{ .kind = .id_ref, .quantifier = .required },
15032 .{ .kind = .debug_info_debug_info_flags, .quantifier = .required },
15033 },
15034 },
15035 .{
15036 .name = "DebugTypePtrToMember",
15037 .opcode = 13,
15038 .operands = &.{
15039 .{ .kind = .id_ref, .quantifier = .required },
15040 .{ .kind = .id_ref, .quantifier = .required },
15041 },
15042 },
15043 .{
15044 .name = "DebugTypeTemplate",
15045 .opcode = 14,
15046 .operands = &.{
15047 .{ .kind = .id_ref, .quantifier = .required },
15048 .{ .kind = .id_ref, .quantifier = .variadic },
15049 },
15050 },
15051 .{
15052 .name = "DebugTypeTemplateParameter",
15053 .opcode = 15,
15054 .operands = &.{
15055 .{ .kind = .id_ref, .quantifier = .required },
15056 .{ .kind = .id_ref, .quantifier = .required },
15057 .{ .kind = .id_ref, .quantifier = .required },
15058 .{ .kind = .id_ref, .quantifier = .required },
15059 .{ .kind = .literal_integer, .quantifier = .required },
15060 .{ .kind = .literal_integer, .quantifier = .required },
15061 },
15062 },
15063 .{
15064 .name = "DebugTypeTemplateTemplateParameter",
15065 .opcode = 16,
15066 .operands = &.{
15067 .{ .kind = .id_ref, .quantifier = .required },
15068 .{ .kind = .id_ref, .quantifier = .required },
15069 .{ .kind = .id_ref, .quantifier = .required },
15070 .{ .kind = .literal_integer, .quantifier = .required },
15071 .{ .kind = .literal_integer, .quantifier = .required },
15072 },
15073 },
15074 .{
15075 .name = "DebugTypeTemplateParameterPack",
15076 .opcode = 17,
15077 .operands = &.{
15078 .{ .kind = .id_ref, .quantifier = .required },
15079 .{ .kind = .id_ref, .quantifier = .required },
15080 .{ .kind = .literal_integer, .quantifier = .required },
15081 .{ .kind = .literal_integer, .quantifier = .required },
15082 .{ .kind = .id_ref, .quantifier = .variadic },
15083 },
15084 },
15085 .{
15086 .name = "DebugGlobalVariable",
15087 .opcode = 18,
15088 .operands = &.{
15089 .{ .kind = .id_ref, .quantifier = .required },
15090 .{ .kind = .id_ref, .quantifier = .required },
15091 .{ .kind = .id_ref, .quantifier = .required },
15092 .{ .kind = .literal_integer, .quantifier = .required },
15093 .{ .kind = .literal_integer, .quantifier = .required },
15094 .{ .kind = .id_ref, .quantifier = .required },
15095 .{ .kind = .id_ref, .quantifier = .required },
15096 .{ .kind = .id_ref, .quantifier = .required },
15097 .{ .kind = .debug_info_debug_info_flags, .quantifier = .required },
15098 .{ .kind = .id_ref, .quantifier = .optional },
15099 },
15100 },
15101 .{
15102 .name = "DebugFunctionDeclaration",
15103 .opcode = 19,
15104 .operands = &.{
15105 .{ .kind = .id_ref, .quantifier = .required },
15106 .{ .kind = .id_ref, .quantifier = .required },
15107 .{ .kind = .id_ref, .quantifier = .required },
15108 .{ .kind = .literal_integer, .quantifier = .required },
15109 .{ .kind = .literal_integer, .quantifier = .required },
15110 .{ .kind = .id_ref, .quantifier = .required },
15111 .{ .kind = .id_ref, .quantifier = .required },
15112 .{ .kind = .debug_info_debug_info_flags, .quantifier = .required },
15113 },
15114 },
15115 .{
15116 .name = "DebugFunction",
15117 .opcode = 20,
15118 .operands = &.{
15119 .{ .kind = .id_ref, .quantifier = .required },
15120 .{ .kind = .id_ref, .quantifier = .required },
15121 .{ .kind = .id_ref, .quantifier = .required },
15122 .{ .kind = .literal_integer, .quantifier = .required },
15123 .{ .kind = .literal_integer, .quantifier = .required },
15124 .{ .kind = .id_ref, .quantifier = .required },
15125 .{ .kind = .id_ref, .quantifier = .required },
15126 .{ .kind = .debug_info_debug_info_flags, .quantifier = .required },
15127 .{ .kind = .literal_integer, .quantifier = .required },
15128 .{ .kind = .id_ref, .quantifier = .required },
15129 .{ .kind = .id_ref, .quantifier = .optional },
15130 },
15131 },
15132 .{
15133 .name = "DebugLexicalBlock",
15134 .opcode = 21,
15135 .operands = &.{
15136 .{ .kind = .id_ref, .quantifier = .required },
15137 .{ .kind = .literal_integer, .quantifier = .required },
15138 .{ .kind = .literal_integer, .quantifier = .required },
15139 .{ .kind = .id_ref, .quantifier = .required },
15140 .{ .kind = .id_ref, .quantifier = .optional },
15141 },
15142 },
15143 .{
15144 .name = "DebugLexicalBlockDiscriminator",
15145 .opcode = 22,
15146 .operands = &.{
15147 .{ .kind = .id_ref, .quantifier = .required },
15148 .{ .kind = .literal_integer, .quantifier = .required },
15149 .{ .kind = .id_ref, .quantifier = .required },
15150 },
15151 },
15152 .{
15153 .name = "DebugScope",
15154 .opcode = 23,
15155 .operands = &.{
15156 .{ .kind = .id_ref, .quantifier = .required },
15157 .{ .kind = .id_ref, .quantifier = .optional },
15158 },
15159 },
15160 .{
15161 .name = "DebugNoScope",
15162 .opcode = 24,
15163 .operands = &.{},
15164 },
15165 .{
15166 .name = "DebugInlinedAt",
15167 .opcode = 25,
15168 .operands = &.{
15169 .{ .kind = .literal_integer, .quantifier = .required },
15170 .{ .kind = .id_ref, .quantifier = .required },
15171 .{ .kind = .id_ref, .quantifier = .optional },
15172 },
15173 },
15174 .{
15175 .name = "DebugLocalVariable",
15176 .opcode = 26,
15177 .operands = &.{
15178 .{ .kind = .id_ref, .quantifier = .required },
15179 .{ .kind = .id_ref, .quantifier = .required },
15180 .{ .kind = .id_ref, .quantifier = .required },
15181 .{ .kind = .literal_integer, .quantifier = .required },
15182 .{ .kind = .literal_integer, .quantifier = .required },
15183 .{ .kind = .id_ref, .quantifier = .required },
15184 .{ .kind = .literal_integer, .quantifier = .optional },
15185 },
15186 },
15187 .{
15188 .name = "DebugInlinedVariable",
15189 .opcode = 27,
15190 .operands = &.{
15191 .{ .kind = .id_ref, .quantifier = .required },
15192 .{ .kind = .id_ref, .quantifier = .required },
15193 },
15194 },
15195 .{
15196 .name = "DebugDeclare",
15197 .opcode = 28,
15198 .operands = &.{
15199 .{ .kind = .id_ref, .quantifier = .required },
15200 .{ .kind = .id_ref, .quantifier = .required },
15201 .{ .kind = .id_ref, .quantifier = .required },
15202 },
15203 },
15204 .{
15205 .name = "DebugValue",
15206 .opcode = 29,
15207 .operands = &.{
15208 .{ .kind = .id_ref, .quantifier = .required },
15209 .{ .kind = .id_ref, .quantifier = .required },
15210 .{ .kind = .id_ref, .quantifier = .variadic },
15211 },
15212 },
15213 .{
15214 .name = "DebugOperation",
15215 .opcode = 30,
15216 .operands = &.{
15217 .{ .kind = .debug_info_debug_operation, .quantifier = .required },
15218 .{ .kind = .literal_integer, .quantifier = .variadic },
15219 },
15220 },
15221 .{
15222 .name = "DebugExpression",
15223 .opcode = 31,
15224 .operands = &.{
15225 .{ .kind = .id_ref, .quantifier = .variadic },
15226 },
15227 },
15228 .{
15229 .name = "DebugMacroDef",
15230 .opcode = 32,
15231 .operands = &.{
15232 .{ .kind = .id_ref, .quantifier = .required },
15233 .{ .kind = .literal_integer, .quantifier = .required },
15234 .{ .kind = .id_ref, .quantifier = .required },
15235 .{ .kind = .id_ref, .quantifier = .optional },
15236 },
15237 },
15238 .{
15239 .name = "DebugMacroUndef",
15240 .opcode = 33,
15241 .operands = &.{
15242 .{ .kind = .id_ref, .quantifier = .required },
15243 .{ .kind = .literal_integer, .quantifier = .required },
15244 .{ .kind = .id_ref, .quantifier = .required },
15245 },
15246 },
15247 },
15248 .@"NonSemantic.DebugBreak" => &.{
15249 .{
15250 .name = "DebugBreak",
15251 .opcode = 1,
15252 .operands = &.{},
15253 },
15254 },
15255 .@"OpenCL.DebugInfo.100" => &.{
15256 .{
15257 .name = "DebugInfoNone",
15258 .opcode = 0,
15259 .operands = &.{},
15260 },
15261 .{
15262 .name = "DebugCompilationUnit",
15263 .opcode = 1,
15264 .operands = &.{
15265 .{ .kind = .literal_integer, .quantifier = .required },
15266 .{ .kind = .literal_integer, .quantifier = .required },
15267 .{ .kind = .id_ref, .quantifier = .required },
15268 .{ .kind = .source_language, .quantifier = .required },
15269 },
15270 },
15271 .{
15272 .name = "DebugTypeBasic",
15273 .opcode = 2,
15274 .operands = &.{
15275 .{ .kind = .id_ref, .quantifier = .required },
15276 .{ .kind = .id_ref, .quantifier = .required },
15277 .{ .kind = .open_cl_debug_info_100_debug_base_type_attribute_encoding, .quantifier = .required },
15278 },
15279 },
15280 .{
15281 .name = "DebugTypePointer",
15282 .opcode = 3,
15283 .operands = &.{
15284 .{ .kind = .id_ref, .quantifier = .required },
15285 .{ .kind = .storage_class, .quantifier = .required },
15286 .{ .kind = .open_cl_debug_info_100_debug_info_flags, .quantifier = .required },
15287 },
15288 },
15289 .{
15290 .name = "DebugTypeQualifier",
15291 .opcode = 4,
15292 .operands = &.{
15293 .{ .kind = .id_ref, .quantifier = .required },
15294 .{ .kind = .open_cl_debug_info_100_debug_type_qualifier, .quantifier = .required },
15295 },
15296 },
15297 .{
15298 .name = "DebugTypeArray",
15299 .opcode = 5,
15300 .operands = &.{
15301 .{ .kind = .id_ref, .quantifier = .required },
15302 .{ .kind = .id_ref, .quantifier = .variadic },
15303 },
15304 },
15305 .{
15306 .name = "DebugTypeVector",
15307 .opcode = 6,
15308 .operands = &.{
15309 .{ .kind = .id_ref, .quantifier = .required },
15310 .{ .kind = .literal_integer, .quantifier = .required },
15311 },
15312 },
15313 .{
15314 .name = "DebugTypedef",
15315 .opcode = 7,
15316 .operands = &.{
15317 .{ .kind = .id_ref, .quantifier = .required },
15318 .{ .kind = .id_ref, .quantifier = .required },
15319 .{ .kind = .id_ref, .quantifier = .required },
15320 .{ .kind = .literal_integer, .quantifier = .required },
15321 .{ .kind = .literal_integer, .quantifier = .required },
15322 .{ .kind = .id_ref, .quantifier = .required },
15323 },
15324 },
15325 .{
15326 .name = "DebugTypeFunction",
15327 .opcode = 8,
15328 .operands = &.{
15329 .{ .kind = .open_cl_debug_info_100_debug_info_flags, .quantifier = .required },
15330 .{ .kind = .id_ref, .quantifier = .required },
15331 .{ .kind = .id_ref, .quantifier = .variadic },
15332 },
15333 },
15334 .{
15335 .name = "DebugTypeEnum",
15336 .opcode = 9,
15337 .operands = &.{
15338 .{ .kind = .id_ref, .quantifier = .required },
15339 .{ .kind = .id_ref, .quantifier = .required },
15340 .{ .kind = .id_ref, .quantifier = .required },
15341 .{ .kind = .literal_integer, .quantifier = .required },
15342 .{ .kind = .literal_integer, .quantifier = .required },
15343 .{ .kind = .id_ref, .quantifier = .required },
15344 .{ .kind = .id_ref, .quantifier = .required },
15345 .{ .kind = .open_cl_debug_info_100_debug_info_flags, .quantifier = .required },
15346 .{ .kind = .pair_id_ref_id_ref, .quantifier = .variadic },
15347 },
15348 },
15349 .{
15350 .name = "DebugTypeComposite",
15351 .opcode = 10,
15352 .operands = &.{
15353 .{ .kind = .id_ref, .quantifier = .required },
15354 .{ .kind = .open_cl_debug_info_100_debug_composite_type, .quantifier = .required },
15355 .{ .kind = .id_ref, .quantifier = .required },
15356 .{ .kind = .literal_integer, .quantifier = .required },
15357 .{ .kind = .literal_integer, .quantifier = .required },
15358 .{ .kind = .id_ref, .quantifier = .required },
15359 .{ .kind = .id_ref, .quantifier = .required },
15360 .{ .kind = .id_ref, .quantifier = .required },
15361 .{ .kind = .open_cl_debug_info_100_debug_info_flags, .quantifier = .required },
15362 .{ .kind = .id_ref, .quantifier = .variadic },
15363 },
15364 },
15365 .{
15366 .name = "DebugTypeMember",
15367 .opcode = 11,
15368 .operands = &.{
15369 .{ .kind = .id_ref, .quantifier = .required },
15370 .{ .kind = .id_ref, .quantifier = .required },
15371 .{ .kind = .id_ref, .quantifier = .required },
15372 .{ .kind = .literal_integer, .quantifier = .required },
15373 .{ .kind = .literal_integer, .quantifier = .required },
15374 .{ .kind = .id_ref, .quantifier = .required },
15375 .{ .kind = .id_ref, .quantifier = .required },
15376 .{ .kind = .id_ref, .quantifier = .required },
15377 .{ .kind = .open_cl_debug_info_100_debug_info_flags, .quantifier = .required },
15378 .{ .kind = .id_ref, .quantifier = .optional },
15379 },
15380 },
15381 .{
15382 .name = "DebugTypeInheritance",
15383 .opcode = 12,
15384 .operands = &.{
15385 .{ .kind = .id_ref, .quantifier = .required },
15386 .{ .kind = .id_ref, .quantifier = .required },
15387 .{ .kind = .id_ref, .quantifier = .required },
15388 .{ .kind = .id_ref, .quantifier = .required },
15389 .{ .kind = .open_cl_debug_info_100_debug_info_flags, .quantifier = .required },
15390 },
15391 },
15392 .{
15393 .name = "DebugTypePtrToMember",
15394 .opcode = 13,
15395 .operands = &.{
15396 .{ .kind = .id_ref, .quantifier = .required },
15397 .{ .kind = .id_ref, .quantifier = .required },
15398 },
15399 },
15400 .{
15401 .name = "DebugTypeTemplate",
15402 .opcode = 14,
15403 .operands = &.{
15404 .{ .kind = .id_ref, .quantifier = .required },
15405 .{ .kind = .id_ref, .quantifier = .variadic },
15406 },
15407 },
15408 .{
15409 .name = "DebugTypeTemplateParameter",
15410 .opcode = 15,
15411 .operands = &.{
15412 .{ .kind = .id_ref, .quantifier = .required },
15413 .{ .kind = .id_ref, .quantifier = .required },
15414 .{ .kind = .id_ref, .quantifier = .required },
15415 .{ .kind = .id_ref, .quantifier = .required },
15416 .{ .kind = .literal_integer, .quantifier = .required },
15417 .{ .kind = .literal_integer, .quantifier = .required },
15418 },
15419 },
15420 .{
15421 .name = "DebugTypeTemplateTemplateParameter",
15422 .opcode = 16,
15423 .operands = &.{
15424 .{ .kind = .id_ref, .quantifier = .required },
15425 .{ .kind = .id_ref, .quantifier = .required },
15426 .{ .kind = .id_ref, .quantifier = .required },
15427 .{ .kind = .literal_integer, .quantifier = .required },
15428 .{ .kind = .literal_integer, .quantifier = .required },
15429 },
15430 },
15431 .{
15432 .name = "DebugTypeTemplateParameterPack",
15433 .opcode = 17,
15434 .operands = &.{
15435 .{ .kind = .id_ref, .quantifier = .required },
15436 .{ .kind = .id_ref, .quantifier = .required },
15437 .{ .kind = .literal_integer, .quantifier = .required },
15438 .{ .kind = .literal_integer, .quantifier = .required },
15439 .{ .kind = .id_ref, .quantifier = .variadic },
15440 },
15441 },
15442 .{
15443 .name = "DebugGlobalVariable",
15444 .opcode = 18,
15445 .operands = &.{
15446 .{ .kind = .id_ref, .quantifier = .required },
15447 .{ .kind = .id_ref, .quantifier = .required },
15448 .{ .kind = .id_ref, .quantifier = .required },
15449 .{ .kind = .literal_integer, .quantifier = .required },
15450 .{ .kind = .literal_integer, .quantifier = .required },
15451 .{ .kind = .id_ref, .quantifier = .required },
15452 .{ .kind = .id_ref, .quantifier = .required },
15453 .{ .kind = .id_ref, .quantifier = .required },
15454 .{ .kind = .open_cl_debug_info_100_debug_info_flags, .quantifier = .required },
15455 .{ .kind = .id_ref, .quantifier = .optional },
15456 },
15457 },
15458 .{
15459 .name = "DebugFunctionDeclaration",
15460 .opcode = 19,
15461 .operands = &.{
15462 .{ .kind = .id_ref, .quantifier = .required },
15463 .{ .kind = .id_ref, .quantifier = .required },
15464 .{ .kind = .id_ref, .quantifier = .required },
15465 .{ .kind = .literal_integer, .quantifier = .required },
15466 .{ .kind = .literal_integer, .quantifier = .required },
15467 .{ .kind = .id_ref, .quantifier = .required },
15468 .{ .kind = .id_ref, .quantifier = .required },
15469 .{ .kind = .open_cl_debug_info_100_debug_info_flags, .quantifier = .required },
15470 },
15471 },
15472 .{
15473 .name = "DebugFunction",
15474 .opcode = 20,
15475 .operands = &.{
15476 .{ .kind = .id_ref, .quantifier = .required },
15477 .{ .kind = .id_ref, .quantifier = .required },
15478 .{ .kind = .id_ref, .quantifier = .required },
15479 .{ .kind = .literal_integer, .quantifier = .required },
15480 .{ .kind = .literal_integer, .quantifier = .required },
15481 .{ .kind = .id_ref, .quantifier = .required },
15482 .{ .kind = .id_ref, .quantifier = .required },
15483 .{ .kind = .open_cl_debug_info_100_debug_info_flags, .quantifier = .required },
15484 .{ .kind = .literal_integer, .quantifier = .required },
15485 .{ .kind = .id_ref, .quantifier = .required },
15486 .{ .kind = .id_ref, .quantifier = .optional },
15487 },
15488 },
15489 .{
15490 .name = "DebugLexicalBlock",
15491 .opcode = 21,
15492 .operands = &.{
15493 .{ .kind = .id_ref, .quantifier = .required },
15494 .{ .kind = .literal_integer, .quantifier = .required },
15495 .{ .kind = .literal_integer, .quantifier = .required },
15496 .{ .kind = .id_ref, .quantifier = .required },
15497 .{ .kind = .id_ref, .quantifier = .optional },
15498 },
15499 },
15500 .{
15501 .name = "DebugLexicalBlockDiscriminator",
15502 .opcode = 22,
15503 .operands = &.{
15504 .{ .kind = .id_ref, .quantifier = .required },
15505 .{ .kind = .literal_integer, .quantifier = .required },
15506 .{ .kind = .id_ref, .quantifier = .required },
15507 },
15508 },
15509 .{
15510 .name = "DebugScope",
15511 .opcode = 23,
15512 .operands = &.{
15513 .{ .kind = .id_ref, .quantifier = .required },
15514 .{ .kind = .id_ref, .quantifier = .optional },
15515 },
15516 },
15517 .{
15518 .name = "DebugNoScope",
15519 .opcode = 24,
15520 .operands = &.{},
15521 },
15522 .{
15523 .name = "DebugInlinedAt",
15524 .opcode = 25,
15525 .operands = &.{
15526 .{ .kind = .literal_integer, .quantifier = .required },
15527 .{ .kind = .id_ref, .quantifier = .required },
15528 .{ .kind = .id_ref, .quantifier = .optional },
15529 },
15530 },
15531 .{
15532 .name = "DebugLocalVariable",
15533 .opcode = 26,
15534 .operands = &.{
15535 .{ .kind = .id_ref, .quantifier = .required },
15536 .{ .kind = .id_ref, .quantifier = .required },
15537 .{ .kind = .id_ref, .quantifier = .required },
15538 .{ .kind = .literal_integer, .quantifier = .required },
15539 .{ .kind = .literal_integer, .quantifier = .required },
15540 .{ .kind = .id_ref, .quantifier = .required },
15541 .{ .kind = .open_cl_debug_info_100_debug_info_flags, .quantifier = .required },
15542 .{ .kind = .literal_integer, .quantifier = .optional },
15543 },
15544 },
15545 .{
15546 .name = "DebugInlinedVariable",
15547 .opcode = 27,
15548 .operands = &.{
15549 .{ .kind = .id_ref, .quantifier = .required },
15550 .{ .kind = .id_ref, .quantifier = .required },
15551 },
15552 },
15553 .{
15554 .name = "DebugDeclare",
15555 .opcode = 28,
15556 .operands = &.{
15557 .{ .kind = .id_ref, .quantifier = .required },
15558 .{ .kind = .id_ref, .quantifier = .required },
15559 .{ .kind = .id_ref, .quantifier = .required },
15560 },
15561 },
15562 .{
15563 .name = "DebugValue",
15564 .opcode = 29,
15565 .operands = &.{
15566 .{ .kind = .id_ref, .quantifier = .required },
15567 .{ .kind = .id_ref, .quantifier = .required },
15568 .{ .kind = .id_ref, .quantifier = .required },
15569 .{ .kind = .id_ref, .quantifier = .variadic },
15570 },
15571 },
15572 .{
15573 .name = "DebugOperation",
15574 .opcode = 30,
15575 .operands = &.{
15576 .{ .kind = .open_cl_debug_info_100_debug_operation, .quantifier = .required },
15577 .{ .kind = .literal_integer, .quantifier = .variadic },
15578 },
15579 },
15580 .{
15581 .name = "DebugExpression",
15582 .opcode = 31,
15583 .operands = &.{
15584 .{ .kind = .id_ref, .quantifier = .variadic },
15585 },
15586 },
15587 .{
15588 .name = "DebugMacroDef",
15589 .opcode = 32,
15590 .operands = &.{
15591 .{ .kind = .id_ref, .quantifier = .required },
15592 .{ .kind = .literal_integer, .quantifier = .required },
15593 .{ .kind = .id_ref, .quantifier = .required },
15594 .{ .kind = .id_ref, .quantifier = .optional },
15595 },
15596 },
15597 .{
15598 .name = "DebugMacroUndef",
15599 .opcode = 33,
15600 .operands = &.{
15601 .{ .kind = .id_ref, .quantifier = .required },
15602 .{ .kind = .literal_integer, .quantifier = .required },
15603 .{ .kind = .id_ref, .quantifier = .required },
15604 },
15605 },
15606 .{
15607 .name = "DebugImportedEntity",
15608 .opcode = 34,
15609 .operands = &.{
15610 .{ .kind = .id_ref, .quantifier = .required },
15611 .{ .kind = .open_cl_debug_info_100_debug_imported_entity, .quantifier = .required },
15612 .{ .kind = .id_ref, .quantifier = .required },
15613 .{ .kind = .id_ref, .quantifier = .required },
15614 .{ .kind = .literal_integer, .quantifier = .required },
15615 .{ .kind = .literal_integer, .quantifier = .required },
15616 .{ .kind = .id_ref, .quantifier = .required },
15617 },
15618 },
15619 .{
15620 .name = "DebugSource",
15621 .opcode = 35,
15622 .operands = &.{
15623 .{ .kind = .id_ref, .quantifier = .required },
15624 .{ .kind = .id_ref, .quantifier = .optional },
15625 },
15626 },
15627 .{
15628 .name = "DebugModuleINTEL",
15629 .opcode = 36,
15630 .operands = &.{
15631 .{ .kind = .id_ref, .quantifier = .required },
15632 .{ .kind = .id_ref, .quantifier = .required },
15633 .{ .kind = .id_ref, .quantifier = .required },
15634 .{ .kind = .literal_integer, .quantifier = .required },
15635 .{ .kind = .id_ref, .quantifier = .required },
15636 .{ .kind = .id_ref, .quantifier = .required },
15637 .{ .kind = .id_ref, .quantifier = .required },
15638 .{ .kind = .literal_integer, .quantifier = .required },
15639 },
15640 },
15641 },
15642 .@"NonSemantic.ClspvReflection.6" => &.{
15643 .{
15644 .name = "Kernel",
15645 .opcode = 1,
15646 .operands = &.{
15647 .{ .kind = .id_ref, .quantifier = .required },
15648 .{ .kind = .id_ref, .quantifier = .required },
15649 .{ .kind = .id_ref, .quantifier = .optional },
15650 .{ .kind = .id_ref, .quantifier = .optional },
15651 .{ .kind = .id_ref, .quantifier = .optional },
15652 },
15653 },
15654 .{
15655 .name = "ArgumentInfo",
15656 .opcode = 2,
15657 .operands = &.{
15658 .{ .kind = .id_ref, .quantifier = .required },
15659 .{ .kind = .id_ref, .quantifier = .optional },
15660 .{ .kind = .id_ref, .quantifier = .optional },
15661 .{ .kind = .id_ref, .quantifier = .optional },
15662 .{ .kind = .id_ref, .quantifier = .optional },
15663 },
15664 },
15665 .{
15666 .name = "ArgumentStorageBuffer",
15667 .opcode = 3,
15668 .operands = &.{
15669 .{ .kind = .id_ref, .quantifier = .required },
15670 .{ .kind = .id_ref, .quantifier = .required },
15671 .{ .kind = .id_ref, .quantifier = .required },
15672 .{ .kind = .id_ref, .quantifier = .required },
15673 .{ .kind = .id_ref, .quantifier = .optional },
15674 },
15675 },
15676 .{
15677 .name = "ArgumentUniform",
15678 .opcode = 4,
15679 .operands = &.{
15680 .{ .kind = .id_ref, .quantifier = .required },
15681 .{ .kind = .id_ref, .quantifier = .required },
15682 .{ .kind = .id_ref, .quantifier = .required },
15683 .{ .kind = .id_ref, .quantifier = .required },
15684 .{ .kind = .id_ref, .quantifier = .optional },
15685 },
15686 },
15687 .{
15688 .name = "ArgumentPodStorageBuffer",
15689 .opcode = 5,
15690 .operands = &.{
15691 .{ .kind = .id_ref, .quantifier = .required },
15692 .{ .kind = .id_ref, .quantifier = .required },
15693 .{ .kind = .id_ref, .quantifier = .required },
15694 .{ .kind = .id_ref, .quantifier = .required },
15695 .{ .kind = .id_ref, .quantifier = .required },
15696 .{ .kind = .id_ref, .quantifier = .required },
15697 .{ .kind = .id_ref, .quantifier = .optional },
15698 },
15699 },
15700 .{
15701 .name = "ArgumentPodUniform",
15702 .opcode = 6,
15703 .operands = &.{
15704 .{ .kind = .id_ref, .quantifier = .required },
15705 .{ .kind = .id_ref, .quantifier = .required },
15706 .{ .kind = .id_ref, .quantifier = .required },
15707 .{ .kind = .id_ref, .quantifier = .required },
15708 .{ .kind = .id_ref, .quantifier = .required },
15709 .{ .kind = .id_ref, .quantifier = .required },
15710 .{ .kind = .id_ref, .quantifier = .optional },
15711 },
15712 },
15713 .{
15714 .name = "ArgumentPodPushConstant",
15715 .opcode = 7,
15716 .operands = &.{
15717 .{ .kind = .id_ref, .quantifier = .required },
15718 .{ .kind = .id_ref, .quantifier = .required },
15719 .{ .kind = .id_ref, .quantifier = .required },
15720 .{ .kind = .id_ref, .quantifier = .required },
15721 .{ .kind = .id_ref, .quantifier = .optional },
15722 },
15723 },
15724 .{
15725 .name = "ArgumentSampledImage",
15726 .opcode = 8,
15727 .operands = &.{
15728 .{ .kind = .id_ref, .quantifier = .required },
15729 .{ .kind = .id_ref, .quantifier = .required },
15730 .{ .kind = .id_ref, .quantifier = .required },
15731 .{ .kind = .id_ref, .quantifier = .required },
15732 .{ .kind = .id_ref, .quantifier = .optional },
15733 },
15734 },
15735 .{
15736 .name = "ArgumentStorageImage",
15737 .opcode = 9,
15738 .operands = &.{
15739 .{ .kind = .id_ref, .quantifier = .required },
15740 .{ .kind = .id_ref, .quantifier = .required },
15741 .{ .kind = .id_ref, .quantifier = .required },
15742 .{ .kind = .id_ref, .quantifier = .required },
15743 .{ .kind = .id_ref, .quantifier = .optional },
15744 },
15745 },
15746 .{
15747 .name = "ArgumentSampler",
15748 .opcode = 10,
15749 .operands = &.{
15750 .{ .kind = .id_ref, .quantifier = .required },
15751 .{ .kind = .id_ref, .quantifier = .required },
15752 .{ .kind = .id_ref, .quantifier = .required },
15753 .{ .kind = .id_ref, .quantifier = .required },
15754 .{ .kind = .id_ref, .quantifier = .optional },
15755 },
15756 },
15757 .{
15758 .name = "ArgumentWorkgroup",
15759 .opcode = 11,
15760 .operands = &.{
15761 .{ .kind = .id_ref, .quantifier = .required },
15762 .{ .kind = .id_ref, .quantifier = .required },
15763 .{ .kind = .id_ref, .quantifier = .required },
15764 .{ .kind = .id_ref, .quantifier = .required },
15765 .{ .kind = .id_ref, .quantifier = .optional },
15766 },
15767 },
15768 .{
15769 .name = "SpecConstantWorkgroupSize",
15770 .opcode = 12,
15771 .operands = &.{
15772 .{ .kind = .id_ref, .quantifier = .required },
15773 .{ .kind = .id_ref, .quantifier = .required },
15774 .{ .kind = .id_ref, .quantifier = .required },
15775 },
15776 },
15777 .{
15778 .name = "SpecConstantGlobalOffset",
15779 .opcode = 13,
15780 .operands = &.{
15781 .{ .kind = .id_ref, .quantifier = .required },
15782 .{ .kind = .id_ref, .quantifier = .required },
15783 .{ .kind = .id_ref, .quantifier = .required },
15784 },
15785 },
15786 .{
15787 .name = "SpecConstantWorkDim",
15788 .opcode = 14,
15789 .operands = &.{
15790 .{ .kind = .id_ref, .quantifier = .required },
15791 },
15792 },
15793 .{
15794 .name = "PushConstantGlobalOffset",
15795 .opcode = 15,
15796 .operands = &.{
15797 .{ .kind = .id_ref, .quantifier = .required },
15798 .{ .kind = .id_ref, .quantifier = .required },
15799 },
15800 },
15801 .{
15802 .name = "PushConstantEnqueuedLocalSize",
15803 .opcode = 16,
15804 .operands = &.{
15805 .{ .kind = .id_ref, .quantifier = .required },
15806 .{ .kind = .id_ref, .quantifier = .required },
15807 },
15808 },
15809 .{
15810 .name = "PushConstantGlobalSize",
15811 .opcode = 17,
15812 .operands = &.{
15813 .{ .kind = .id_ref, .quantifier = .required },
15814 .{ .kind = .id_ref, .quantifier = .required },
15815 },
15816 },
15817 .{
15818 .name = "PushConstantRegionOffset",
15819 .opcode = 18,
15820 .operands = &.{
15821 .{ .kind = .id_ref, .quantifier = .required },
15822 .{ .kind = .id_ref, .quantifier = .required },
15823 },
15824 },
15825 .{
15826 .name = "PushConstantNumWorkgroups",
15827 .opcode = 19,
15828 .operands = &.{
15829 .{ .kind = .id_ref, .quantifier = .required },
15830 .{ .kind = .id_ref, .quantifier = .required },
15831 },
15832 },
15833 .{
15834 .name = "PushConstantRegionGroupOffset",
15835 .opcode = 20,
15836 .operands = &.{
15837 .{ .kind = .id_ref, .quantifier = .required },
15838 .{ .kind = .id_ref, .quantifier = .required },
15839 },
15840 },
15841 .{
15842 .name = "ConstantDataStorageBuffer",
15843 .opcode = 21,
15844 .operands = &.{
15845 .{ .kind = .id_ref, .quantifier = .required },
15846 .{ .kind = .id_ref, .quantifier = .required },
15847 .{ .kind = .id_ref, .quantifier = .required },
15848 },
15849 },
15850 .{
15851 .name = "ConstantDataUniform",
15852 .opcode = 22,
15853 .operands = &.{
15854 .{ .kind = .id_ref, .quantifier = .required },
15855 .{ .kind = .id_ref, .quantifier = .required },
15856 .{ .kind = .id_ref, .quantifier = .required },
15857 },
15858 },
15859 .{
15860 .name = "LiteralSampler",
15861 .opcode = 23,
15862 .operands = &.{
15863 .{ .kind = .id_ref, .quantifier = .required },
15864 .{ .kind = .id_ref, .quantifier = .required },
15865 .{ .kind = .id_ref, .quantifier = .required },
15866 },
15867 },
15868 .{
15869 .name = "PropertyRequiredWorkgroupSize",
15870 .opcode = 24,
15871 .operands = &.{
15872 .{ .kind = .id_ref, .quantifier = .required },
15873 .{ .kind = .id_ref, .quantifier = .required },
15874 .{ .kind = .id_ref, .quantifier = .required },
15875 .{ .kind = .id_ref, .quantifier = .required },
15876 },
15877 },
15878 .{
15879 .name = "SpecConstantSubgroupMaxSize",
15880 .opcode = 25,
15881 .operands = &.{
15882 .{ .kind = .id_ref, .quantifier = .required },
15883 },
15884 },
15885 .{
15886 .name = "ArgumentPointerPushConstant",
15887 .opcode = 26,
15888 .operands = &.{
15889 .{ .kind = .id_ref, .quantifier = .required },
15890 .{ .kind = .id_ref, .quantifier = .required },
15891 .{ .kind = .id_ref, .quantifier = .required },
15892 .{ .kind = .id_ref, .quantifier = .required },
15893 .{ .kind = .id_ref, .quantifier = .optional },
15894 },
15895 },
15896 .{
15897 .name = "ArgumentPointerUniform",
15898 .opcode = 27,
15899 .operands = &.{
15900 .{ .kind = .id_ref, .quantifier = .required },
15901 .{ .kind = .id_ref, .quantifier = .required },
15902 .{ .kind = .id_ref, .quantifier = .required },
15903 .{ .kind = .id_ref, .quantifier = .required },
15904 .{ .kind = .id_ref, .quantifier = .required },
15905 .{ .kind = .id_ref, .quantifier = .required },
15906 .{ .kind = .id_ref, .quantifier = .optional },
15907 },
15908 },
15909 .{
15910 .name = "ProgramScopeVariablesStorageBuffer",
15911 .opcode = 28,
15912 .operands = &.{
15913 .{ .kind = .id_ref, .quantifier = .required },
15914 .{ .kind = .id_ref, .quantifier = .required },
15915 .{ .kind = .id_ref, .quantifier = .required },
15916 },
15917 },
15918 .{
15919 .name = "ProgramScopeVariablePointerRelocation",
15920 .opcode = 29,
15921 .operands = &.{
15922 .{ .kind = .id_ref, .quantifier = .required },
15923 .{ .kind = .id_ref, .quantifier = .required },
15924 .{ .kind = .id_ref, .quantifier = .required },
15925 },
15926 },
15927 .{
15928 .name = "ImageArgumentInfoChannelOrderPushConstant",
15929 .opcode = 30,
15930 .operands = &.{
15931 .{ .kind = .id_ref, .quantifier = .required },
15932 .{ .kind = .id_ref, .quantifier = .required },
15933 .{ .kind = .id_ref, .quantifier = .required },
15934 .{ .kind = .id_ref, .quantifier = .required },
15935 },
15936 },
15937 .{
15938 .name = "ImageArgumentInfoChannelDataTypePushConstant",
15939 .opcode = 31,
15940 .operands = &.{
15941 .{ .kind = .id_ref, .quantifier = .required },
15942 .{ .kind = .id_ref, .quantifier = .required },
15943 .{ .kind = .id_ref, .quantifier = .required },
15944 .{ .kind = .id_ref, .quantifier = .required },
15945 },
15946 },
15947 .{
15948 .name = "ImageArgumentInfoChannelOrderUniform",
15949 .opcode = 32,
15950 .operands = &.{
15951 .{ .kind = .id_ref, .quantifier = .required },
15952 .{ .kind = .id_ref, .quantifier = .required },
15953 .{ .kind = .id_ref, .quantifier = .required },
15954 .{ .kind = .id_ref, .quantifier = .required },
15955 .{ .kind = .id_ref, .quantifier = .required },
15956 .{ .kind = .id_ref, .quantifier = .required },
15957 },
15958 },
15959 .{
15960 .name = "ImageArgumentInfoChannelDataTypeUniform",
15961 .opcode = 33,
15962 .operands = &.{
15963 .{ .kind = .id_ref, .quantifier = .required },
15964 .{ .kind = .id_ref, .quantifier = .required },
15965 .{ .kind = .id_ref, .quantifier = .required },
15966 .{ .kind = .id_ref, .quantifier = .required },
15967 .{ .kind = .id_ref, .quantifier = .required },
15968 .{ .kind = .id_ref, .quantifier = .required },
15969 },
15970 },
15971 .{
15972 .name = "ArgumentStorageTexelBuffer",
15973 .opcode = 34,
15974 .operands = &.{
15975 .{ .kind = .id_ref, .quantifier = .required },
15976 .{ .kind = .id_ref, .quantifier = .required },
15977 .{ .kind = .id_ref, .quantifier = .required },
15978 .{ .kind = .id_ref, .quantifier = .required },
15979 .{ .kind = .id_ref, .quantifier = .optional },
15980 },
15981 },
15982 .{
15983 .name = "ArgumentUniformTexelBuffer",
15984 .opcode = 35,
15985 .operands = &.{
15986 .{ .kind = .id_ref, .quantifier = .required },
15987 .{ .kind = .id_ref, .quantifier = .required },
15988 .{ .kind = .id_ref, .quantifier = .required },
15989 .{ .kind = .id_ref, .quantifier = .required },
15990 .{ .kind = .id_ref, .quantifier = .optional },
15991 },
15992 },
15993 .{
15994 .name = "ConstantDataPointerPushConstant",
15995 .opcode = 36,
15996 .operands = &.{
15997 .{ .kind = .id_ref, .quantifier = .required },
15998 .{ .kind = .id_ref, .quantifier = .required },
15999 .{ .kind = .id_ref, .quantifier = .required },
16000 },
16001 },
16002 .{
16003 .name = "ProgramScopeVariablePointerPushConstant",
16004 .opcode = 37,
16005 .operands = &.{
16006 .{ .kind = .id_ref, .quantifier = .required },
16007 .{ .kind = .id_ref, .quantifier = .required },
16008 .{ .kind = .id_ref, .quantifier = .required },
16009 },
16010 },
16011 .{
16012 .name = "PrintfInfo",
16013 .opcode = 38,
16014 .operands = &.{
16015 .{ .kind = .id_ref, .quantifier = .required },
16016 .{ .kind = .id_ref, .quantifier = .required },
16017 .{ .kind = .id_ref, .quantifier = .variadic },
16018 },
16019 },
16020 .{
16021 .name = "PrintfBufferStorageBuffer",
16022 .opcode = 39,
16023 .operands = &.{
16024 .{ .kind = .id_ref, .quantifier = .required },
16025 .{ .kind = .id_ref, .quantifier = .required },
16026 .{ .kind = .id_ref, .quantifier = .required },
16027 },
16028 },
16029 .{
16030 .name = "PrintfBufferPointerPushConstant",
16031 .opcode = 40,
16032 .operands = &.{
16033 .{ .kind = .id_ref, .quantifier = .required },
16034 .{ .kind = .id_ref, .quantifier = .required },
16035 .{ .kind = .id_ref, .quantifier = .required },
16036 },
16037 },
16038 .{
16039 .name = "NormalizedSamplerMaskPushConstant",
16040 .opcode = 41,
16041 .operands = &.{
16042 .{ .kind = .id_ref, .quantifier = .required },
16043 .{ .kind = .id_ref, .quantifier = .required },
16044 .{ .kind = .id_ref, .quantifier = .required },
16045 .{ .kind = .id_ref, .quantifier = .required },
16046 },
16047 },
16048 .{
16049 .name = "WorkgroupVariableSize",
16050 .opcode = 42,
16051 .operands = &.{
16052 .{ .kind = .id_ref, .quantifier = .required },
16053 .{ .kind = .id_ref, .quantifier = .required },
16054 },
16055 },
16056 },
16057 .@"GLSL.std.450" => &.{
16058 .{
16059 .name = "Round",
16060 .opcode = 1,
16061 .operands = &.{
16062 .{ .kind = .id_ref, .quantifier = .required },
16063 },
16064 },
16065 .{
16066 .name = "RoundEven",
16067 .opcode = 2,
16068 .operands = &.{
16069 .{ .kind = .id_ref, .quantifier = .required },
16070 },
16071 },
16072 .{
16073 .name = "Trunc",
16074 .opcode = 3,
16075 .operands = &.{
16076 .{ .kind = .id_ref, .quantifier = .required },
16077 },
16078 },
16079 .{
16080 .name = "FAbs",
16081 .opcode = 4,
16082 .operands = &.{
16083 .{ .kind = .id_ref, .quantifier = .required },
16084 },
16085 },
16086 .{
16087 .name = "SAbs",
16088 .opcode = 5,
16089 .operands = &.{
16090 .{ .kind = .id_ref, .quantifier = .required },
16091 },
16092 },
16093 .{
16094 .name = "FSign",
16095 .opcode = 6,
16096 .operands = &.{
16097 .{ .kind = .id_ref, .quantifier = .required },
16098 },
16099 },
16100 .{
16101 .name = "SSign",
16102 .opcode = 7,
16103 .operands = &.{
16104 .{ .kind = .id_ref, .quantifier = .required },
16105 },
16106 },
16107 .{
16108 .name = "Floor",
16109 .opcode = 8,
16110 .operands = &.{
16111 .{ .kind = .id_ref, .quantifier = .required },
16112 },
16113 },
16114 .{
16115 .name = "Ceil",
16116 .opcode = 9,
16117 .operands = &.{
16118 .{ .kind = .id_ref, .quantifier = .required },
16119 },
16120 },
16121 .{
16122 .name = "Fract",
16123 .opcode = 10,
16124 .operands = &.{
16125 .{ .kind = .id_ref, .quantifier = .required },
16126 },
16127 },
16128 .{
16129 .name = "Radians",
16130 .opcode = 11,
16131 .operands = &.{
16132 .{ .kind = .id_ref, .quantifier = .required },
16133 },
16134 },
16135 .{
16136 .name = "Degrees",
16137 .opcode = 12,
16138 .operands = &.{
16139 .{ .kind = .id_ref, .quantifier = .required },
16140 },
16141 },
16142 .{
16143 .name = "Sin",
16144 .opcode = 13,
16145 .operands = &.{
16146 .{ .kind = .id_ref, .quantifier = .required },
16147 },
16148 },
16149 .{
16150 .name = "Cos",
16151 .opcode = 14,
16152 .operands = &.{
16153 .{ .kind = .id_ref, .quantifier = .required },
16154 },
16155 },
16156 .{
16157 .name = "Tan",
16158 .opcode = 15,
16159 .operands = &.{
16160 .{ .kind = .id_ref, .quantifier = .required },
16161 },
16162 },
16163 .{
16164 .name = "Asin",
16165 .opcode = 16,
16166 .operands = &.{
16167 .{ .kind = .id_ref, .quantifier = .required },
16168 },
16169 },
16170 .{
16171 .name = "Acos",
16172 .opcode = 17,
16173 .operands = &.{
16174 .{ .kind = .id_ref, .quantifier = .required },
16175 },
16176 },
16177 .{
16178 .name = "Atan",
16179 .opcode = 18,
16180 .operands = &.{
16181 .{ .kind = .id_ref, .quantifier = .required },
16182 },
16183 },
16184 .{
16185 .name = "Sinh",
16186 .opcode = 19,
16187 .operands = &.{
16188 .{ .kind = .id_ref, .quantifier = .required },
16189 },
16190 },
16191 .{
16192 .name = "Cosh",
16193 .opcode = 20,
16194 .operands = &.{
16195 .{ .kind = .id_ref, .quantifier = .required },
16196 },
16197 },
16198 .{
16199 .name = "Tanh",
16200 .opcode = 21,
16201 .operands = &.{
16202 .{ .kind = .id_ref, .quantifier = .required },
16203 },
16204 },
16205 .{
16206 .name = "Asinh",
16207 .opcode = 22,
16208 .operands = &.{
16209 .{ .kind = .id_ref, .quantifier = .required },
16210 },
16211 },
16212 .{
16213 .name = "Acosh",
16214 .opcode = 23,
16215 .operands = &.{
16216 .{ .kind = .id_ref, .quantifier = .required },
16217 },
16218 },
16219 .{
16220 .name = "Atanh",
16221 .opcode = 24,
16222 .operands = &.{
16223 .{ .kind = .id_ref, .quantifier = .required },
16224 },
16225 },
16226 .{
16227 .name = "Atan2",
16228 .opcode = 25,
16229 .operands = &.{
16230 .{ .kind = .id_ref, .quantifier = .required },
16231 .{ .kind = .id_ref, .quantifier = .required },
16232 },
16233 },
16234 .{
16235 .name = "Pow",
16236 .opcode = 26,
16237 .operands = &.{
16238 .{ .kind = .id_ref, .quantifier = .required },
16239 .{ .kind = .id_ref, .quantifier = .required },
16240 },
16241 },
16242 .{
16243 .name = "Exp",
16244 .opcode = 27,
16245 .operands = &.{
16246 .{ .kind = .id_ref, .quantifier = .required },
16247 },
16248 },
16249 .{
16250 .name = "Log",
16251 .opcode = 28,
16252 .operands = &.{
16253 .{ .kind = .id_ref, .quantifier = .required },
16254 },
16255 },
16256 .{
16257 .name = "Exp2",
16258 .opcode = 29,
16259 .operands = &.{
16260 .{ .kind = .id_ref, .quantifier = .required },
16261 },
16262 },
16263 .{
16264 .name = "Log2",
16265 .opcode = 30,
16266 .operands = &.{
16267 .{ .kind = .id_ref, .quantifier = .required },
16268 },
16269 },
16270 .{
16271 .name = "Sqrt",
16272 .opcode = 31,
16273 .operands = &.{
16274 .{ .kind = .id_ref, .quantifier = .required },
16275 },
16276 },
16277 .{
16278 .name = "InverseSqrt",
16279 .opcode = 32,
16280 .operands = &.{
16281 .{ .kind = .id_ref, .quantifier = .required },
16282 },
16283 },
16284 .{
16285 .name = "Determinant",
16286 .opcode = 33,
16287 .operands = &.{
16288 .{ .kind = .id_ref, .quantifier = .required },
16289 },
16290 },
16291 .{
16292 .name = "MatrixInverse",
16293 .opcode = 34,
16294 .operands = &.{
16295 .{ .kind = .id_ref, .quantifier = .required },
16296 },
16297 },
16298 .{
16299 .name = "Modf",
16300 .opcode = 35,
16301 .operands = &.{
16302 .{ .kind = .id_ref, .quantifier = .required },
16303 .{ .kind = .id_ref, .quantifier = .required },
16304 },
16305 },
16306 .{
16307 .name = "ModfStruct",
16308 .opcode = 36,
16309 .operands = &.{
16310 .{ .kind = .id_ref, .quantifier = .required },
16311 },
16312 },
16313 .{
16314 .name = "FMin",
16315 .opcode = 37,
16316 .operands = &.{
16317 .{ .kind = .id_ref, .quantifier = .required },
16318 .{ .kind = .id_ref, .quantifier = .required },
16319 },
16320 },
16321 .{
16322 .name = "UMin",
16323 .opcode = 38,
16324 .operands = &.{
16325 .{ .kind = .id_ref, .quantifier = .required },
16326 .{ .kind = .id_ref, .quantifier = .required },
16327 },
16328 },
16329 .{
16330 .name = "SMin",
16331 .opcode = 39,
16332 .operands = &.{
16333 .{ .kind = .id_ref, .quantifier = .required },
16334 .{ .kind = .id_ref, .quantifier = .required },
16335 },
16336 },
16337 .{
16338 .name = "FMax",
16339 .opcode = 40,
16340 .operands = &.{
16341 .{ .kind = .id_ref, .quantifier = .required },
16342 .{ .kind = .id_ref, .quantifier = .required },
16343 },
16344 },
16345 .{
16346 .name = "UMax",
16347 .opcode = 41,
16348 .operands = &.{
16349 .{ .kind = .id_ref, .quantifier = .required },
16350 .{ .kind = .id_ref, .quantifier = .required },
16351 },
16352 },
16353 .{
16354 .name = "SMax",
16355 .opcode = 42,
16356 .operands = &.{
16357 .{ .kind = .id_ref, .quantifier = .required },
16358 .{ .kind = .id_ref, .quantifier = .required },
16359 },
16360 },
16361 .{
16362 .name = "FClamp",
16363 .opcode = 43,
16364 .operands = &.{
16365 .{ .kind = .id_ref, .quantifier = .required },
16366 .{ .kind = .id_ref, .quantifier = .required },
16367 .{ .kind = .id_ref, .quantifier = .required },
16368 },
16369 },
16370 .{
16371 .name = "UClamp",
16372 .opcode = 44,
16373 .operands = &.{
16374 .{ .kind = .id_ref, .quantifier = .required },
16375 .{ .kind = .id_ref, .quantifier = .required },
16376 .{ .kind = .id_ref, .quantifier = .required },
16377 },
16378 },
16379 .{
16380 .name = "SClamp",
16381 .opcode = 45,
16382 .operands = &.{
16383 .{ .kind = .id_ref, .quantifier = .required },
16384 .{ .kind = .id_ref, .quantifier = .required },
16385 .{ .kind = .id_ref, .quantifier = .required },
16386 },
16387 },
16388 .{
16389 .name = "FMix",
16390 .opcode = 46,
16391 .operands = &.{
16392 .{ .kind = .id_ref, .quantifier = .required },
16393 .{ .kind = .id_ref, .quantifier = .required },
16394 .{ .kind = .id_ref, .quantifier = .required },
16395 },
16396 },
16397 .{
16398 .name = "IMix",
16399 .opcode = 47,
16400 .operands = &.{
16401 .{ .kind = .id_ref, .quantifier = .required },
16402 .{ .kind = .id_ref, .quantifier = .required },
16403 .{ .kind = .id_ref, .quantifier = .required },
16404 },
16405 },
16406 .{
16407 .name = "Step",
16408 .opcode = 48,
16409 .operands = &.{
16410 .{ .kind = .id_ref, .quantifier = .required },
16411 .{ .kind = .id_ref, .quantifier = .required },
16412 },
16413 },
16414 .{
16415 .name = "SmoothStep",
16416 .opcode = 49,
16417 .operands = &.{
16418 .{ .kind = .id_ref, .quantifier = .required },
16419 .{ .kind = .id_ref, .quantifier = .required },
16420 .{ .kind = .id_ref, .quantifier = .required },
16421 },
16422 },
16423 .{
16424 .name = "Fma",
16425 .opcode = 50,
16426 .operands = &.{
16427 .{ .kind = .id_ref, .quantifier = .required },
16428 .{ .kind = .id_ref, .quantifier = .required },
16429 .{ .kind = .id_ref, .quantifier = .required },
16430 },
16431 },
16432 .{
16433 .name = "Frexp",
16434 .opcode = 51,
16435 .operands = &.{
16436 .{ .kind = .id_ref, .quantifier = .required },
16437 .{ .kind = .id_ref, .quantifier = .required },
16438 },
16439 },
16440 .{
16441 .name = "FrexpStruct",
16442 .opcode = 52,
16443 .operands = &.{
16444 .{ .kind = .id_ref, .quantifier = .required },
16445 },
16446 },
16447 .{
16448 .name = "Ldexp",
16449 .opcode = 53,
16450 .operands = &.{
16451 .{ .kind = .id_ref, .quantifier = .required },
16452 .{ .kind = .id_ref, .quantifier = .required },
16453 },
16454 },
16455 .{
16456 .name = "PackSnorm4x8",
16457 .opcode = 54,
16458 .operands = &.{
16459 .{ .kind = .id_ref, .quantifier = .required },
16460 },
16461 },
16462 .{
16463 .name = "PackUnorm4x8",
16464 .opcode = 55,
16465 .operands = &.{
16466 .{ .kind = .id_ref, .quantifier = .required },
16467 },
16468 },
16469 .{
16470 .name = "PackSnorm2x16",
16471 .opcode = 56,
16472 .operands = &.{
16473 .{ .kind = .id_ref, .quantifier = .required },
16474 },
16475 },
16476 .{
16477 .name = "PackUnorm2x16",
16478 .opcode = 57,
16479 .operands = &.{
16480 .{ .kind = .id_ref, .quantifier = .required },
16481 },
16482 },
16483 .{
16484 .name = "PackHalf2x16",
16485 .opcode = 58,
16486 .operands = &.{
16487 .{ .kind = .id_ref, .quantifier = .required },
16488 },
16489 },
16490 .{
16491 .name = "PackDouble2x32",
16492 .opcode = 59,
16493 .operands = &.{
16494 .{ .kind = .id_ref, .quantifier = .required },
16495 },
16496 },
16497 .{
16498 .name = "UnpackSnorm2x16",
16499 .opcode = 60,
16500 .operands = &.{
16501 .{ .kind = .id_ref, .quantifier = .required },
16502 },
16503 },
16504 .{
16505 .name = "UnpackUnorm2x16",
16506 .opcode = 61,
16507 .operands = &.{
16508 .{ .kind = .id_ref, .quantifier = .required },
16509 },
16510 },
16511 .{
16512 .name = "UnpackHalf2x16",
16513 .opcode = 62,
16514 .operands = &.{
16515 .{ .kind = .id_ref, .quantifier = .required },
16516 },
16517 },
16518 .{
16519 .name = "UnpackSnorm4x8",
16520 .opcode = 63,
16521 .operands = &.{
16522 .{ .kind = .id_ref, .quantifier = .required },
16523 },
16524 },
16525 .{
16526 .name = "UnpackUnorm4x8",
16527 .opcode = 64,
16528 .operands = &.{
16529 .{ .kind = .id_ref, .quantifier = .required },
16530 },
16531 },
16532 .{
16533 .name = "UnpackDouble2x32",
16534 .opcode = 65,
16535 .operands = &.{
16536 .{ .kind = .id_ref, .quantifier = .required },
16537 },
16538 },
16539 .{
16540 .name = "Length",
16541 .opcode = 66,
16542 .operands = &.{
16543 .{ .kind = .id_ref, .quantifier = .required },
16544 },
16545 },
16546 .{
16547 .name = "Distance",
16548 .opcode = 67,
16549 .operands = &.{
16550 .{ .kind = .id_ref, .quantifier = .required },
16551 .{ .kind = .id_ref, .quantifier = .required },
16552 },
16553 },
16554 .{
16555 .name = "Cross",
16556 .opcode = 68,
16557 .operands = &.{
16558 .{ .kind = .id_ref, .quantifier = .required },
16559 .{ .kind = .id_ref, .quantifier = .required },
16560 },
16561 },
16562 .{
16563 .name = "Normalize",
16564 .opcode = 69,
16565 .operands = &.{
16566 .{ .kind = .id_ref, .quantifier = .required },
16567 },
16568 },
16569 .{
16570 .name = "FaceForward",
16571 .opcode = 70,
16572 .operands = &.{
16573 .{ .kind = .id_ref, .quantifier = .required },
16574 .{ .kind = .id_ref, .quantifier = .required },
16575 .{ .kind = .id_ref, .quantifier = .required },
16576 },
16577 },
16578 .{
16579 .name = "Reflect",
16580 .opcode = 71,
16581 .operands = &.{
16582 .{ .kind = .id_ref, .quantifier = .required },
16583 .{ .kind = .id_ref, .quantifier = .required },
16584 },
16585 },
16586 .{
16587 .name = "Refract",
16588 .opcode = 72,
16589 .operands = &.{
16590 .{ .kind = .id_ref, .quantifier = .required },
16591 .{ .kind = .id_ref, .quantifier = .required },
16592 .{ .kind = .id_ref, .quantifier = .required },
16593 },
16594 },
16595 .{
16596 .name = "FindILsb",
16597 .opcode = 73,
16598 .operands = &.{
16599 .{ .kind = .id_ref, .quantifier = .required },
16600 },
16601 },
16602 .{
16603 .name = "FindSMsb",
16604 .opcode = 74,
16605 .operands = &.{
16606 .{ .kind = .id_ref, .quantifier = .required },
16607 },
16608 },
16609 .{
16610 .name = "FindUMsb",
16611 .opcode = 75,
16612 .operands = &.{
16613 .{ .kind = .id_ref, .quantifier = .required },
16614 },
16615 },
16616 .{
16617 .name = "InterpolateAtCentroid",
16618 .opcode = 76,
16619 .operands = &.{
16620 .{ .kind = .id_ref, .quantifier = .required },
16621 },
16622 },
16623 .{
16624 .name = "InterpolateAtSample",
16625 .opcode = 77,
16626 .operands = &.{
16627 .{ .kind = .id_ref, .quantifier = .required },
16628 .{ .kind = .id_ref, .quantifier = .required },
16629 },
16630 },
16631 .{
16632 .name = "InterpolateAtOffset",
16633 .opcode = 78,
16634 .operands = &.{
16635 .{ .kind = .id_ref, .quantifier = .required },
16636 .{ .kind = .id_ref, .quantifier = .required },
16637 },
16638 },
16639 .{
16640 .name = "NMin",
16641 .opcode = 79,
16642 .operands = &.{
16643 .{ .kind = .id_ref, .quantifier = .required },
16644 .{ .kind = .id_ref, .quantifier = .required },
16645 },
16646 },
16647 .{
16648 .name = "NMax",
16649 .opcode = 80,
16650 .operands = &.{
16651 .{ .kind = .id_ref, .quantifier = .required },
16652 .{ .kind = .id_ref, .quantifier = .required },
16653 },
16654 },
16655 .{
16656 .name = "NClamp",
16657 .opcode = 81,
16658 .operands = &.{
16659 .{ .kind = .id_ref, .quantifier = .required },
16660 .{ .kind = .id_ref, .quantifier = .required },
16661 .{ .kind = .id_ref, .quantifier = .required },
16662 },
16663 },
16664 },
16665 .SPV_AMD_shader_ballot => &.{
16666 .{
16667 .name = "SwizzleInvocationsAMD",
16668 .opcode = 1,
16669 .operands = &.{
16670 .{ .kind = .id_ref, .quantifier = .required },
16671 .{ .kind = .id_ref, .quantifier = .required },
16672 },
16673 },
16674 .{
16675 .name = "SwizzleInvocationsMaskedAMD",
16676 .opcode = 2,
16677 .operands = &.{
16678 .{ .kind = .id_ref, .quantifier = .required },
16679 .{ .kind = .id_ref, .quantifier = .required },
16680 },
16681 },
16682 .{
16683 .name = "WriteInvocationAMD",
16684 .opcode = 3,
16685 .operands = &.{
16686 .{ .kind = .id_ref, .quantifier = .required },
16687 .{ .kind = .id_ref, .quantifier = .required },
16688 .{ .kind = .id_ref, .quantifier = .required },
16689 },
16690 },
16691 .{
16692 .name = "MbcntAMD",
16693 .opcode = 4,
16694 .operands = &.{
16695 .{ .kind = .id_ref, .quantifier = .required },
16696 },
16697 },
16698 },
16699 .@"NonSemantic.DebugPrintf" => &.{
16700 .{
16701 .name = "DebugPrintf",
16702 .opcode = 1,
16703 .operands = &.{
16704 .{ .kind = .id_ref, .quantifier = .required },
16705 .{ .kind = .id_ref, .quantifier = .variadic },
16706 },
16707 },
16708 },
16709 .SPV_AMD_gcn_shader => &.{
16710 .{
16711 .name = "CubeFaceIndexAMD",
16712 .opcode = 1,
16713 .operands = &.{
16714 .{ .kind = .id_ref, .quantifier = .required },
16715 },
16716 },
16717 .{
16718 .name = "CubeFaceCoordAMD",
16719 .opcode = 2,
16720 .operands = &.{
16721 .{ .kind = .id_ref, .quantifier = .required },
16722 },
16723 },
16724 .{
16725 .name = "TimeAMD",
16726 .opcode = 3,
16727 .operands = &.{},
16728 },
16729 },
16730 .@"OpenCL.std" => &.{
16731 .{
16732 .name = "acos",
16733 .opcode = 0,
16734 .operands = &.{
16735 .{ .kind = .id_ref, .quantifier = .required },
16736 },
16737 },
16738 .{
16739 .name = "acosh",
16740 .opcode = 1,
16741 .operands = &.{
16742 .{ .kind = .id_ref, .quantifier = .required },
16743 },
16744 },
16745 .{
16746 .name = "acospi",
16747 .opcode = 2,
16748 .operands = &.{
16749 .{ .kind = .id_ref, .quantifier = .required },
16750 },
16751 },
16752 .{
16753 .name = "asin",
16754 .opcode = 3,
16755 .operands = &.{
16756 .{ .kind = .id_ref, .quantifier = .required },
16757 },
16758 },
16759 .{
16760 .name = "asinh",
16761 .opcode = 4,
16762 .operands = &.{
16763 .{ .kind = .id_ref, .quantifier = .required },
16764 },
16765 },
16766 .{
16767 .name = "asinpi",
16768 .opcode = 5,
16769 .operands = &.{
16770 .{ .kind = .id_ref, .quantifier = .required },
16771 },
16772 },
16773 .{
16774 .name = "atan",
16775 .opcode = 6,
16776 .operands = &.{
16777 .{ .kind = .id_ref, .quantifier = .required },
16778 },
16779 },
16780 .{
16781 .name = "atan2",
16782 .opcode = 7,
16783 .operands = &.{
16784 .{ .kind = .id_ref, .quantifier = .required },
16785 .{ .kind = .id_ref, .quantifier = .required },
16786 },
16787 },
16788 .{
16789 .name = "atanh",
16790 .opcode = 8,
16791 .operands = &.{
16792 .{ .kind = .id_ref, .quantifier = .required },
16793 },
16794 },
16795 .{
16796 .name = "atanpi",
16797 .opcode = 9,
16798 .operands = &.{
16799 .{ .kind = .id_ref, .quantifier = .required },
16800 },
16801 },
16802 .{
16803 .name = "atan2pi",
16804 .opcode = 10,
16805 .operands = &.{
16806 .{ .kind = .id_ref, .quantifier = .required },
16807 .{ .kind = .id_ref, .quantifier = .required },
16808 },
16809 },
16810 .{
16811 .name = "cbrt",
16812 .opcode = 11,
16813 .operands = &.{
16814 .{ .kind = .id_ref, .quantifier = .required },
16815 },
16816 },
16817 .{
16818 .name = "ceil",
16819 .opcode = 12,
16820 .operands = &.{
16821 .{ .kind = .id_ref, .quantifier = .required },
16822 },
16823 },
16824 .{
16825 .name = "copysign",
16826 .opcode = 13,
16827 .operands = &.{
16828 .{ .kind = .id_ref, .quantifier = .required },
16829 .{ .kind = .id_ref, .quantifier = .required },
16830 },
16831 },
16832 .{
16833 .name = "cos",
16834 .opcode = 14,
16835 .operands = &.{
16836 .{ .kind = .id_ref, .quantifier = .required },
16837 },
16838 },
16839 .{
16840 .name = "cosh",
16841 .opcode = 15,
16842 .operands = &.{
16843 .{ .kind = .id_ref, .quantifier = .required },
16844 },
16845 },
16846 .{
16847 .name = "cospi",
16848 .opcode = 16,
16849 .operands = &.{
16850 .{ .kind = .id_ref, .quantifier = .required },
16851 },
16852 },
16853 .{
16854 .name = "erfc",
16855 .opcode = 17,
16856 .operands = &.{
16857 .{ .kind = .id_ref, .quantifier = .required },
16858 },
16859 },
16860 .{
16861 .name = "erf",
16862 .opcode = 18,
16863 .operands = &.{
16864 .{ .kind = .id_ref, .quantifier = .required },
16865 },
16866 },
16867 .{
16868 .name = "exp",
16869 .opcode = 19,
16870 .operands = &.{
16871 .{ .kind = .id_ref, .quantifier = .required },
16872 },
16873 },
16874 .{
16875 .name = "exp2",
16876 .opcode = 20,
16877 .operands = &.{
16878 .{ .kind = .id_ref, .quantifier = .required },
16879 },
16880 },
16881 .{
16882 .name = "exp10",
16883 .opcode = 21,
16884 .operands = &.{
16885 .{ .kind = .id_ref, .quantifier = .required },
16886 },
16887 },
16888 .{
16889 .name = "expm1",
16890 .opcode = 22,
16891 .operands = &.{
16892 .{ .kind = .id_ref, .quantifier = .required },
16893 },
16894 },
16895 .{
16896 .name = "fabs",
16897 .opcode = 23,
16898 .operands = &.{
16899 .{ .kind = .id_ref, .quantifier = .required },
16900 },
16901 },
16902 .{
16903 .name = "fdim",
16904 .opcode = 24,
16905 .operands = &.{
16906 .{ .kind = .id_ref, .quantifier = .required },
16907 .{ .kind = .id_ref, .quantifier = .required },
16908 },
16909 },
16910 .{
16911 .name = "floor",
16912 .opcode = 25,
16913 .operands = &.{
16914 .{ .kind = .id_ref, .quantifier = .required },
16915 },
16916 },
16917 .{
16918 .name = "fma",
16919 .opcode = 26,
16920 .operands = &.{
16921 .{ .kind = .id_ref, .quantifier = .required },
16922 .{ .kind = .id_ref, .quantifier = .required },
16923 .{ .kind = .id_ref, .quantifier = .required },
16924 },
16925 },
16926 .{
16927 .name = "fmax",
16928 .opcode = 27,
16929 .operands = &.{
16930 .{ .kind = .id_ref, .quantifier = .required },
16931 .{ .kind = .id_ref, .quantifier = .required },
16932 },
16933 },
16934 .{
16935 .name = "fmin",
16936 .opcode = 28,
16937 .operands = &.{
16938 .{ .kind = .id_ref, .quantifier = .required },
16939 .{ .kind = .id_ref, .quantifier = .required },
16940 },
16941 },
16942 .{
16943 .name = "fmod",
16944 .opcode = 29,
16945 .operands = &.{
16946 .{ .kind = .id_ref, .quantifier = .required },
16947 .{ .kind = .id_ref, .quantifier = .required },
16948 },
16949 },
16950 .{
16951 .name = "fract",
16952 .opcode = 30,
16953 .operands = &.{
16954 .{ .kind = .id_ref, .quantifier = .required },
16955 .{ .kind = .id_ref, .quantifier = .required },
16956 },
16957 },
16958 .{
16959 .name = "frexp",
16960 .opcode = 31,
16961 .operands = &.{
16962 .{ .kind = .id_ref, .quantifier = .required },
16963 .{ .kind = .id_ref, .quantifier = .required },
16964 },
16965 },
16966 .{
16967 .name = "hypot",
16968 .opcode = 32,
16969 .operands = &.{
16970 .{ .kind = .id_ref, .quantifier = .required },
16971 .{ .kind = .id_ref, .quantifier = .required },
16972 },
16973 },
16974 .{
16975 .name = "ilogb",
16976 .opcode = 33,
16977 .operands = &.{
16978 .{ .kind = .id_ref, .quantifier = .required },
16979 },
16980 },
16981 .{
16982 .name = "ldexp",
16983 .opcode = 34,
16984 .operands = &.{
16985 .{ .kind = .id_ref, .quantifier = .required },
16986 .{ .kind = .id_ref, .quantifier = .required },
16987 },
16988 },
16989 .{
16990 .name = "lgamma",
16991 .opcode = 35,
16992 .operands = &.{
16993 .{ .kind = .id_ref, .quantifier = .required },
16994 },
16995 },
16996 .{
16997 .name = "lgamma_r",
16998 .opcode = 36,
16999 .operands = &.{
17000 .{ .kind = .id_ref, .quantifier = .required },
17001 .{ .kind = .id_ref, .quantifier = .required },
17002 },
17003 },
17004 .{
17005 .name = "log",
17006 .opcode = 37,
17007 .operands = &.{
17008 .{ .kind = .id_ref, .quantifier = .required },
17009 },
17010 },
17011 .{
17012 .name = "log2",
17013 .opcode = 38,
17014 .operands = &.{
17015 .{ .kind = .id_ref, .quantifier = .required },
17016 },
17017 },
17018 .{
17019 .name = "log10",
17020 .opcode = 39,
17021 .operands = &.{
17022 .{ .kind = .id_ref, .quantifier = .required },
17023 },
17024 },
17025 .{
17026 .name = "log1p",
17027 .opcode = 40,
17028 .operands = &.{
17029 .{ .kind = .id_ref, .quantifier = .required },
17030 },
17031 },
17032 .{
17033 .name = "logb",
17034 .opcode = 41,
17035 .operands = &.{
17036 .{ .kind = .id_ref, .quantifier = .required },
17037 },
17038 },
17039 .{
17040 .name = "mad",
17041 .opcode = 42,
17042 .operands = &.{
17043 .{ .kind = .id_ref, .quantifier = .required },
17044 .{ .kind = .id_ref, .quantifier = .required },
17045 .{ .kind = .id_ref, .quantifier = .required },
17046 },
17047 },
17048 .{
17049 .name = "maxmag",
17050 .opcode = 43,
17051 .operands = &.{
17052 .{ .kind = .id_ref, .quantifier = .required },
17053 .{ .kind = .id_ref, .quantifier = .required },
17054 },
17055 },
17056 .{
17057 .name = "minmag",
17058 .opcode = 44,
17059 .operands = &.{
17060 .{ .kind = .id_ref, .quantifier = .required },
17061 .{ .kind = .id_ref, .quantifier = .required },
17062 },
17063 },
17064 .{
17065 .name = "modf",
17066 .opcode = 45,
17067 .operands = &.{
17068 .{ .kind = .id_ref, .quantifier = .required },
17069 .{ .kind = .id_ref, .quantifier = .required },
17070 },
17071 },
17072 .{
17073 .name = "nan",
17074 .opcode = 46,
17075 .operands = &.{
17076 .{ .kind = .id_ref, .quantifier = .required },
17077 },
17078 },
17079 .{
17080 .name = "nextafter",
17081 .opcode = 47,
17082 .operands = &.{
17083 .{ .kind = .id_ref, .quantifier = .required },
17084 .{ .kind = .id_ref, .quantifier = .required },
17085 },
17086 },
17087 .{
17088 .name = "pow",
17089 .opcode = 48,
17090 .operands = &.{
17091 .{ .kind = .id_ref, .quantifier = .required },
17092 .{ .kind = .id_ref, .quantifier = .required },
17093 },
17094 },
17095 .{
17096 .name = "pown",
17097 .opcode = 49,
17098 .operands = &.{
17099 .{ .kind = .id_ref, .quantifier = .required },
17100 .{ .kind = .id_ref, .quantifier = .required },
17101 },
17102 },
17103 .{
17104 .name = "powr",
17105 .opcode = 50,
17106 .operands = &.{
17107 .{ .kind = .id_ref, .quantifier = .required },
17108 .{ .kind = .id_ref, .quantifier = .required },
17109 },
17110 },
17111 .{
17112 .name = "remainder",
17113 .opcode = 51,
17114 .operands = &.{
17115 .{ .kind = .id_ref, .quantifier = .required },
17116 .{ .kind = .id_ref, .quantifier = .required },
17117 },
17118 },
17119 .{
17120 .name = "remquo",
17121 .opcode = 52,
17122 .operands = &.{
17123 .{ .kind = .id_ref, .quantifier = .required },
17124 .{ .kind = .id_ref, .quantifier = .required },
17125 .{ .kind = .id_ref, .quantifier = .required },
17126 },
17127 },
17128 .{
17129 .name = "rint",
17130 .opcode = 53,
17131 .operands = &.{
17132 .{ .kind = .id_ref, .quantifier = .required },
17133 },
17134 },
17135 .{
17136 .name = "rootn",
17137 .opcode = 54,
17138 .operands = &.{
17139 .{ .kind = .id_ref, .quantifier = .required },
17140 .{ .kind = .id_ref, .quantifier = .required },
17141 },
17142 },
17143 .{
17144 .name = "round",
17145 .opcode = 55,
17146 .operands = &.{
1714714498 .{ .kind = .id_ref, .quantifier = .required },
1714814499 },
1714914500 },
1715014501 .{
17151 .name = "rsqrt",
17152 .opcode = 56,
14502 .name = "cbrt",
14503 .opcode = 11,
1715314504 .operands = &.{
1715414505 .{ .kind = .id_ref, .quantifier = .required },
1715514506 },
1715614507 },
1715714508 .{
17158 .name = "sin",
17159 .opcode = 57,
14509 .name = "ceil",
14510 .opcode = 12,
1716014511 .operands = &.{
1716114512 .{ .kind = .id_ref, .quantifier = .required },
1716214513 },
1716314514 },
1716414515 .{
17165 .name = "sincos",
17166 .opcode = 58,
14516 .name = "copysign",
14517 .opcode = 13,
1716714518 .operands = &.{
1716814519 .{ .kind = .id_ref, .quantifier = .required },
1716914520 .{ .kind = .id_ref, .quantifier = .required },
1717014521 },
1717114522 },
1717214523 .{
17173 .name = "sinh",
17174 .opcode = 59,
14524 .name = "cos",
14525 .opcode = 14,
1717514526 .operands = &.{
1717614527 .{ .kind = .id_ref, .quantifier = .required },
1717714528 },
1717814529 },
1717914530 .{
17180 .name = "sinpi",
17181 .opcode = 60,
14531 .name = "cosh",
14532 .opcode = 15,
1718214533 .operands = &.{
1718314534 .{ .kind = .id_ref, .quantifier = .required },
1718414535 },
1718514536 },
1718614537 .{
17187 .name = "sqrt",
17188 .opcode = 61,
14538 .name = "cospi",
14539 .opcode = 16,
1718914540 .operands = &.{
1719014541 .{ .kind = .id_ref, .quantifier = .required },
1719114542 },
1719214543 },
1719314544 .{
17194 .name = "tan",
17195 .opcode = 62,
14545 .name = "erfc",
14546 .opcode = 17,
1719614547 .operands = &.{
1719714548 .{ .kind = .id_ref, .quantifier = .required },
1719814549 },
1719914550 },
1720014551 .{
17201 .name = "tanh",
17202 .opcode = 63,
14552 .name = "erf",
14553 .opcode = 18,
1720314554 .operands = &.{
1720414555 .{ .kind = .id_ref, .quantifier = .required },
1720514556 },
1720614557 },
1720714558 .{
17208 .name = "tanpi",
17209 .opcode = 64,
14559 .name = "exp",
14560 .opcode = 19,
1721014561 .operands = &.{
1721114562 .{ .kind = .id_ref, .quantifier = .required },
1721214563 },
1721314564 },
1721414565 .{
17215 .name = "tgamma",
17216 .opcode = 65,
14566 .name = "exp2",
14567 .opcode = 20,
1721714568 .operands = &.{
1721814569 .{ .kind = .id_ref, .quantifier = .required },
1721914570 },
1722014571 },
1722114572 .{
17222 .name = "trunc",
17223 .opcode = 66,
14573 .name = "exp10",
14574 .opcode = 21,
1722414575 .operands = &.{
1722514576 .{ .kind = .id_ref, .quantifier = .required },
1722614577 },
1722714578 },
1722814579 .{
17229 .name = "half_cos",
17230 .opcode = 67,
14580 .name = "expm1",
14581 .opcode = 22,
1723114582 .operands = &.{
1723214583 .{ .kind = .id_ref, .quantifier = .required },
1723314584 },
1723414585 },
1723514586 .{
17236 .name = "half_divide",
17237 .opcode = 68,
14587 .name = "fabs",
14588 .opcode = 23,
1723814589 .operands = &.{
1723914590 .{ .kind = .id_ref, .quantifier = .required },
17240 .{ .kind = .id_ref, .quantifier = .required },
1724114591 },
1724214592 },
1724314593 .{
17244 .name = "half_exp",
17245 .opcode = 69,
14594 .name = "fdim",
14595 .opcode = 24,
1724614596 .operands = &.{
1724714597 .{ .kind = .id_ref, .quantifier = .required },
14598 .{ .kind = .id_ref, .quantifier = .required },
1724814599 },
1724914600 },
1725014601 .{
17251 .name = "half_exp2",
17252 .opcode = 70,
14602 .name = "floor",
14603 .opcode = 25,
1725314604 .operands = &.{
1725414605 .{ .kind = .id_ref, .quantifier = .required },
1725514606 },
1725614607 },
1725714608 .{
17258 .name = "half_exp10",
17259 .opcode = 71,
14609 .name = "fma",
14610 .opcode = 26,
1726014611 .operands = &.{
1726114612 .{ .kind = .id_ref, .quantifier = .required },
14613 .{ .kind = .id_ref, .quantifier = .required },
14614 .{ .kind = .id_ref, .quantifier = .required },
1726214615 },
1726314616 },
1726414617 .{
17265 .name = "half_log",
17266 .opcode = 72,
14618 .name = "fmax",
14619 .opcode = 27,
1726714620 .operands = &.{
1726814621 .{ .kind = .id_ref, .quantifier = .required },
14622 .{ .kind = .id_ref, .quantifier = .required },
1726914623 },
1727014624 },
1727114625 .{
17272 .name = "half_log2",
17273 .opcode = 73,
14626 .name = "fmin",
14627 .opcode = 28,
1727414628 .operands = &.{
1727514629 .{ .kind = .id_ref, .quantifier = .required },
14630 .{ .kind = .id_ref, .quantifier = .required },
1727614631 },
1727714632 },
1727814633 .{
17279 .name = "half_log10",
17280 .opcode = 74,
14634 .name = "fmod",
14635 .opcode = 29,
1728114636 .operands = &.{
1728214637 .{ .kind = .id_ref, .quantifier = .required },
14638 .{ .kind = .id_ref, .quantifier = .required },
1728314639 },
1728414640 },
1728514641 .{
17286 .name = "half_powr",
17287 .opcode = 75,
14642 .name = "fract",
14643 .opcode = 30,
1728814644 .operands = &.{
1728914645 .{ .kind = .id_ref, .quantifier = .required },
1729014646 .{ .kind = .id_ref, .quantifier = .required },
1729114647 },
1729214648 },
1729314649 .{
17294 .name = "half_recip",
17295 .opcode = 76,
14650 .name = "frexp",
14651 .opcode = 31,
1729614652 .operands = &.{
1729714653 .{ .kind = .id_ref, .quantifier = .required },
14654 .{ .kind = .id_ref, .quantifier = .required },
1729814655 },
1729914656 },
1730014657 .{
17301 .name = "half_rsqrt",
17302 .opcode = 77,
14658 .name = "hypot",
14659 .opcode = 32,
1730314660 .operands = &.{
1730414661 .{ .kind = .id_ref, .quantifier = .required },
14662 .{ .kind = .id_ref, .quantifier = .required },
1730514663 },
1730614664 },
1730714665 .{
17308 .name = "half_sin",
17309 .opcode = 78,
14666 .name = "ilogb",
14667 .opcode = 33,
1731014668 .operands = &.{
1731114669 .{ .kind = .id_ref, .quantifier = .required },
1731214670 },
1731314671 },
1731414672 .{
17315 .name = "half_sqrt",
17316 .opcode = 79,
14673 .name = "ldexp",
14674 .opcode = 34,
1731714675 .operands = &.{
1731814676 .{ .kind = .id_ref, .quantifier = .required },
14677 .{ .kind = .id_ref, .quantifier = .required },
1731914678 },
1732014679 },
1732114680 .{
17322 .name = "half_tan",
17323 .opcode = 80,
14681 .name = "lgamma",
14682 .opcode = 35,
1732414683 .operands = &.{
1732514684 .{ .kind = .id_ref, .quantifier = .required },
1732614685 },
1732714686 },
1732814687 .{
17329 .name = "native_cos",
17330 .opcode = 81,
14688 .name = "lgamma_r",
14689 .opcode = 36,
1733114690 .operands = &.{
1733214691 .{ .kind = .id_ref, .quantifier = .required },
14692 .{ .kind = .id_ref, .quantifier = .required },
1733314693 },
1733414694 },
1733514695 .{
17336 .name = "native_divide",
17337 .opcode = 82,
14696 .name = "log",
14697 .opcode = 37,
1733814698 .operands = &.{
1733914699 .{ .kind = .id_ref, .quantifier = .required },
17340 .{ .kind = .id_ref, .quantifier = .required },
1734114700 },
1734214701 },
1734314702 .{
17344 .name = "native_exp",
17345 .opcode = 83,
14703 .name = "log2",
14704 .opcode = 38,
1734614705 .operands = &.{
1734714706 .{ .kind = .id_ref, .quantifier = .required },
1734814707 },
1734914708 },
1735014709 .{
17351 .name = "native_exp2",
17352 .opcode = 84,
14710 .name = "log10",
14711 .opcode = 39,
1735314712 .operands = &.{
1735414713 .{ .kind = .id_ref, .quantifier = .required },
1735514714 },
1735614715 },
1735714716 .{
17358 .name = "native_exp10",
17359 .opcode = 85,
14717 .name = "log1p",
14718 .opcode = 40,
1736014719 .operands = &.{
1736114720 .{ .kind = .id_ref, .quantifier = .required },
1736214721 },
1736314722 },
1736414723 .{
17365 .name = "native_log",
17366 .opcode = 86,
14724 .name = "logb",
14725 .opcode = 41,
1736714726 .operands = &.{
1736814727 .{ .kind = .id_ref, .quantifier = .required },
1736914728 },
1737014729 },
1737114730 .{
17372 .name = "native_log2",
17373 .opcode = 87,
14731 .name = "mad",
14732 .opcode = 42,
1737414733 .operands = &.{
1737514734 .{ .kind = .id_ref, .quantifier = .required },
14735 .{ .kind = .id_ref, .quantifier = .required },
14736 .{ .kind = .id_ref, .quantifier = .required },
1737614737 },
1737714738 },
1737814739 .{
17379 .name = "native_log10",
17380 .opcode = 88,
14740 .name = "maxmag",
14741 .opcode = 43,
1738114742 .operands = &.{
1738214743 .{ .kind = .id_ref, .quantifier = .required },
14744 .{ .kind = .id_ref, .quantifier = .required },
1738314745 },
1738414746 },
1738514747 .{
17386 .name = "native_powr",
17387 .opcode = 89,
14748 .name = "minmag",
14749 .opcode = 44,
1738814750 .operands = &.{
1738914751 .{ .kind = .id_ref, .quantifier = .required },
1739014752 .{ .kind = .id_ref, .quantifier = .required },
1739114753 },
1739214754 },
1739314755 .{
17394 .name = "native_recip",
17395 .opcode = 90,
14756 .name = "modf",
14757 .opcode = 45,
1739614758 .operands = &.{
1739714759 .{ .kind = .id_ref, .quantifier = .required },
14760 .{ .kind = .id_ref, .quantifier = .required },
1739814761 },
1739914762 },
1740014763 .{
17401 .name = "native_rsqrt",
17402 .opcode = 91,
14764 .name = "nan",
14765 .opcode = 46,
1740314766 .operands = &.{
1740414767 .{ .kind = .id_ref, .quantifier = .required },
1740514768 },
1740614769 },
1740714770 .{
17408 .name = "native_sin",
17409 .opcode = 92,
14771 .name = "nextafter",
14772 .opcode = 47,
1741014773 .operands = &.{
1741114774 .{ .kind = .id_ref, .quantifier = .required },
14775 .{ .kind = .id_ref, .quantifier = .required },
1741214776 },
1741314777 },
1741414778 .{
17415 .name = "native_sqrt",
17416 .opcode = 93,
14779 .name = "pow",
14780 .opcode = 48,
1741714781 .operands = &.{
1741814782 .{ .kind = .id_ref, .quantifier = .required },
14783 .{ .kind = .id_ref, .quantifier = .required },
1741914784 },
1742014785 },
1742114786 .{
17422 .name = "native_tan",
17423 .opcode = 94,
14787 .name = "pown",
14788 .opcode = 49,
1742414789 .operands = &.{
1742514790 .{ .kind = .id_ref, .quantifier = .required },
14791 .{ .kind = .id_ref, .quantifier = .required },
1742614792 },
1742714793 },
1742814794 .{
17429 .name = "fclamp",
17430 .opcode = 95,
14795 .name = "powr",
14796 .opcode = 50,
1743114797 .operands = &.{
1743214798 .{ .kind = .id_ref, .quantifier = .required },
1743314799 .{ .kind = .id_ref, .quantifier = .required },
17434 .{ .kind = .id_ref, .quantifier = .required },
1743514800 },
1743614801 },
1743714802 .{
17438 .name = "degrees",
17439 .opcode = 96,
14803 .name = "remainder",
14804 .opcode = 51,
1744014805 .operands = &.{
1744114806 .{ .kind = .id_ref, .quantifier = .required },
14807 .{ .kind = .id_ref, .quantifier = .required },
1744214808 },
1744314809 },
1744414810 .{
17445 .name = "fmax_common",
17446 .opcode = 97,
14811 .name = "remquo",
14812 .opcode = 52,
1744714813 .operands = &.{
1744814814 .{ .kind = .id_ref, .quantifier = .required },
1744914815 .{ .kind = .id_ref, .quantifier = .required },
14816 .{ .kind = .id_ref, .quantifier = .required },
1745014817 },
1745114818 },
1745214819 .{
17453 .name = "fmin_common",
17454 .opcode = 98,
14820 .name = "rint",
14821 .opcode = 53,
1745514822 .operands = &.{
1745614823 .{ .kind = .id_ref, .quantifier = .required },
17457 .{ .kind = .id_ref, .quantifier = .required },
1745814824 },
1745914825 },
1746014826 .{
17461 .name = "mix",
17462 .opcode = 99,
14827 .name = "rootn",
14828 .opcode = 54,
1746314829 .operands = &.{
1746414830 .{ .kind = .id_ref, .quantifier = .required },
1746514831 .{ .kind = .id_ref, .quantifier = .required },
17466 .{ .kind = .id_ref, .quantifier = .required },
1746714832 },
1746814833 },
1746914834 .{
17470 .name = "radians",
17471 .opcode = 100,
14835 .name = "round",
14836 .opcode = 55,
1747214837 .operands = &.{
1747314838 .{ .kind = .id_ref, .quantifier = .required },
1747414839 },
1747514840 },
1747614841 .{
17477 .name = "step",
17478 .opcode = 101,
14842 .name = "rsqrt",
14843 .opcode = 56,
1747914844 .operands = &.{
1748014845 .{ .kind = .id_ref, .quantifier = .required },
17481 .{ .kind = .id_ref, .quantifier = .required },
1748214846 },
1748314847 },
1748414848 .{
17485 .name = "smoothstep",
17486 .opcode = 102,
14849 .name = "sin",
14850 .opcode = 57,
1748714851 .operands = &.{
1748814852 .{ .kind = .id_ref, .quantifier = .required },
14853 },
14854 },
14855 .{
14856 .name = "sincos",
14857 .opcode = 58,
14858 .operands = &.{
1748914859 .{ .kind = .id_ref, .quantifier = .required },
1749014860 .{ .kind = .id_ref, .quantifier = .required },
1749114861 },
1749214862 },
1749314863 .{
17494 .name = "sign",
17495 .opcode = 103,
14864 .name = "sinh",
14865 .opcode = 59,
1749614866 .operands = &.{
1749714867 .{ .kind = .id_ref, .quantifier = .required },
1749814868 },
1749914869 },
1750014870 .{
17501 .name = "cross",
17502 .opcode = 104,
14871 .name = "sinpi",
14872 .opcode = 60,
1750314873 .operands = &.{
1750414874 .{ .kind = .id_ref, .quantifier = .required },
17505 .{ .kind = .id_ref, .quantifier = .required },
1750614875 },
1750714876 },
1750814877 .{
17509 .name = "distance",
17510 .opcode = 105,
14878 .name = "sqrt",
14879 .opcode = 61,
1751114880 .operands = &.{
1751214881 .{ .kind = .id_ref, .quantifier = .required },
17513 .{ .kind = .id_ref, .quantifier = .required },
1751414882 },
1751514883 },
1751614884 .{
17517 .name = "length",
17518 .opcode = 106,
14885 .name = "tan",
14886 .opcode = 62,
1751914887 .operands = &.{
1752014888 .{ .kind = .id_ref, .quantifier = .required },
1752114889 },
1752214890 },
1752314891 .{
17524 .name = "normalize",
17525 .opcode = 107,
14892 .name = "tanh",
14893 .opcode = 63,
1752614894 .operands = &.{
1752714895 .{ .kind = .id_ref, .quantifier = .required },
1752814896 },
1752914897 },
1753014898 .{
17531 .name = "fast_distance",
17532 .opcode = 108,
14899 .name = "tanpi",
14900 .opcode = 64,
1753314901 .operands = &.{
1753414902 .{ .kind = .id_ref, .quantifier = .required },
17535 .{ .kind = .id_ref, .quantifier = .required },
1753614903 },
1753714904 },
1753814905 .{
17539 .name = "fast_length",
17540 .opcode = 109,
14906 .name = "tgamma",
14907 .opcode = 65,
1754114908 .operands = &.{
1754214909 .{ .kind = .id_ref, .quantifier = .required },
1754314910 },
1754414911 },
1754514912 .{
17546 .name = "fast_normalize",
17547 .opcode = 110,
14913 .name = "trunc",
14914 .opcode = 66,
1754814915 .operands = &.{
1754914916 .{ .kind = .id_ref, .quantifier = .required },
1755014917 },
1755114918 },
1755214919 .{
17553 .name = "s_abs",
17554 .opcode = 141,
14920 .name = "half_cos",
14921 .opcode = 67,
1755514922 .operands = &.{
1755614923 .{ .kind = .id_ref, .quantifier = .required },
1755714924 },
1755814925 },
1755914926 .{
17560 .name = "s_abs_diff",
17561 .opcode = 142,
14927 .name = "half_divide",
14928 .opcode = 68,
1756214929 .operands = &.{
1756314930 .{ .kind = .id_ref, .quantifier = .required },
1756414931 .{ .kind = .id_ref, .quantifier = .required },
1756514932 },
1756614933 },
1756714934 .{
17568 .name = "s_add_sat",
17569 .opcode = 143,
14935 .name = "half_exp",
14936 .opcode = 69,
1757014937 .operands = &.{
1757114938 .{ .kind = .id_ref, .quantifier = .required },
17572 .{ .kind = .id_ref, .quantifier = .required },
1757314939 },
1757414940 },
1757514941 .{
17576 .name = "u_add_sat",
17577 .opcode = 144,
14942 .name = "half_exp2",
14943 .opcode = 70,
1757814944 .operands = &.{
1757914945 .{ .kind = .id_ref, .quantifier = .required },
17580 .{ .kind = .id_ref, .quantifier = .required },
1758114946 },
1758214947 },
1758314948 .{
17584 .name = "s_hadd",
17585 .opcode = 145,
14949 .name = "half_exp10",
14950 .opcode = 71,
1758614951 .operands = &.{
1758714952 .{ .kind = .id_ref, .quantifier = .required },
17588 .{ .kind = .id_ref, .quantifier = .required },
1758914953 },
1759014954 },
1759114955 .{
17592 .name = "u_hadd",
17593 .opcode = 146,
14956 .name = "half_log",
14957 .opcode = 72,
1759414958 .operands = &.{
1759514959 .{ .kind = .id_ref, .quantifier = .required },
17596 .{ .kind = .id_ref, .quantifier = .required },
1759714960 },
1759814961 },
1759914962 .{
17600 .name = "s_rhadd",
17601 .opcode = 147,
14963 .name = "half_log2",
14964 .opcode = 73,
1760214965 .operands = &.{
1760314966 .{ .kind = .id_ref, .quantifier = .required },
17604 .{ .kind = .id_ref, .quantifier = .required },
1760514967 },
1760614968 },
1760714969 .{
17608 .name = "u_rhadd",
17609 .opcode = 148,
14970 .name = "half_log10",
14971 .opcode = 74,
1761014972 .operands = &.{
1761114973 .{ .kind = .id_ref, .quantifier = .required },
17612 .{ .kind = .id_ref, .quantifier = .required },
1761314974 },
1761414975 },
1761514976 .{
17616 .name = "s_clamp",
17617 .opcode = 149,
14977 .name = "half_powr",
14978 .opcode = 75,
1761814979 .operands = &.{
1761914980 .{ .kind = .id_ref, .quantifier = .required },
1762014981 .{ .kind = .id_ref, .quantifier = .required },
17621 .{ .kind = .id_ref, .quantifier = .required },
1762214982 },
1762314983 },
1762414984 .{
17625 .name = "u_clamp",
17626 .opcode = 150,
14985 .name = "half_recip",
14986 .opcode = 76,
1762714987 .operands = &.{
1762814988 .{ .kind = .id_ref, .quantifier = .required },
17629 .{ .kind = .id_ref, .quantifier = .required },
17630 .{ .kind = .id_ref, .quantifier = .required },
1763114989 },
1763214990 },
1763314991 .{
17634 .name = "clz",
17635 .opcode = 151,
14992 .name = "half_rsqrt",
14993 .opcode = 77,
1763614994 .operands = &.{
1763714995 .{ .kind = .id_ref, .quantifier = .required },
1763814996 },
1763914997 },
1764014998 .{
17641 .name = "ctz",
17642 .opcode = 152,
14999 .name = "half_sin",
15000 .opcode = 78,
1764315001 .operands = &.{
1764415002 .{ .kind = .id_ref, .quantifier = .required },
1764515003 },
1764615004 },
1764715005 .{
17648 .name = "s_mad_hi",
17649 .opcode = 153,
15006 .name = "half_sqrt",
15007 .opcode = 79,
1765015008 .operands = &.{
1765115009 .{ .kind = .id_ref, .quantifier = .required },
17652 .{ .kind = .id_ref, .quantifier = .required },
17653 .{ .kind = .id_ref, .quantifier = .required },
1765415010 },
1765515011 },
1765615012 .{
17657 .name = "u_mad_sat",
17658 .opcode = 154,
15013 .name = "half_tan",
15014 .opcode = 80,
1765915015 .operands = &.{
1766015016 .{ .kind = .id_ref, .quantifier = .required },
17661 .{ .kind = .id_ref, .quantifier = .required },
17662 .{ .kind = .id_ref, .quantifier = .required },
1766315017 },
1766415018 },
1766515019 .{
17666 .name = "s_mad_sat",
17667 .opcode = 155,
15020 .name = "native_cos",
15021 .opcode = 81,
1766815022 .operands = &.{
1766915023 .{ .kind = .id_ref, .quantifier = .required },
17670 .{ .kind = .id_ref, .quantifier = .required },
17671 .{ .kind = .id_ref, .quantifier = .required },
1767215024 },
1767315025 },
1767415026 .{
17675 .name = "s_max",
17676 .opcode = 156,
15027 .name = "native_divide",
15028 .opcode = 82,
1767715029 .operands = &.{
1767815030 .{ .kind = .id_ref, .quantifier = .required },
1767915031 .{ .kind = .id_ref, .quantifier = .required },
1768015032 },
1768115033 },
1768215034 .{
17683 .name = "u_max",
17684 .opcode = 157,
15035 .name = "native_exp",
15036 .opcode = 83,
1768515037 .operands = &.{
1768615038 .{ .kind = .id_ref, .quantifier = .required },
17687 .{ .kind = .id_ref, .quantifier = .required },
1768815039 },
1768915040 },
1769015041 .{
17691 .name = "s_min",
17692 .opcode = 158,
15042 .name = "native_exp2",
15043 .opcode = 84,
1769315044 .operands = &.{
1769415045 .{ .kind = .id_ref, .quantifier = .required },
17695 .{ .kind = .id_ref, .quantifier = .required },
1769615046 },
1769715047 },
1769815048 .{
17699 .name = "u_min",
17700 .opcode = 159,
15049 .name = "native_exp10",
15050 .opcode = 85,
1770115051 .operands = &.{
1770215052 .{ .kind = .id_ref, .quantifier = .required },
17703 .{ .kind = .id_ref, .quantifier = .required },
1770415053 },
1770515054 },
1770615055 .{
17707 .name = "s_mul_hi",
17708 .opcode = 160,
15056 .name = "native_log",
15057 .opcode = 86,
1770915058 .operands = &.{
1771015059 .{ .kind = .id_ref, .quantifier = .required },
17711 .{ .kind = .id_ref, .quantifier = .required },
1771215060 },
1771315061 },
1771415062 .{
17715 .name = "rotate",
17716 .opcode = 161,
15063 .name = "native_log2",
15064 .opcode = 87,
1771715065 .operands = &.{
1771815066 .{ .kind = .id_ref, .quantifier = .required },
17719 .{ .kind = .id_ref, .quantifier = .required },
1772015067 },
1772115068 },
1772215069 .{
17723 .name = "s_sub_sat",
17724 .opcode = 162,
15070 .name = "native_log10",
15071 .opcode = 88,
1772515072 .operands = &.{
1772615073 .{ .kind = .id_ref, .quantifier = .required },
17727 .{ .kind = .id_ref, .quantifier = .required },
1772815074 },
1772915075 },
1773015076 .{
17731 .name = "u_sub_sat",
17732 .opcode = 163,
15077 .name = "native_powr",
15078 .opcode = 89,
1773315079 .operands = &.{
1773415080 .{ .kind = .id_ref, .quantifier = .required },
1773515081 .{ .kind = .id_ref, .quantifier = .required },
1773615082 },
1773715083 },
1773815084 .{
17739 .name = "u_upsample",
17740 .opcode = 164,
15085 .name = "native_recip",
15086 .opcode = 90,
1774115087 .operands = &.{
1774215088 .{ .kind = .id_ref, .quantifier = .required },
17743 .{ .kind = .id_ref, .quantifier = .required },
1774415089 },
1774515090 },
1774615091 .{
17747 .name = "s_upsample",
17748 .opcode = 165,
15092 .name = "native_rsqrt",
15093 .opcode = 91,
1774915094 .operands = &.{
1775015095 .{ .kind = .id_ref, .quantifier = .required },
17751 .{ .kind = .id_ref, .quantifier = .required },
1775215096 },
1775315097 },
1775415098 .{
17755 .name = "popcount",
17756 .opcode = 166,
15099 .name = "native_sin",
15100 .opcode = 92,
1775715101 .operands = &.{
1775815102 .{ .kind = .id_ref, .quantifier = .required },
1775915103 },
1776015104 },
1776115105 .{
17762 .name = "s_mad24",
17763 .opcode = 167,
15106 .name = "native_sqrt",
15107 .opcode = 93,
1776415108 .operands = &.{
1776515109 .{ .kind = .id_ref, .quantifier = .required },
17766 .{ .kind = .id_ref, .quantifier = .required },
17767 .{ .kind = .id_ref, .quantifier = .required },
1776815110 },
1776915111 },
1777015112 .{
17771 .name = "u_mad24",
17772 .opcode = 168,
15113 .name = "native_tan",
15114 .opcode = 94,
1777315115 .operands = &.{
1777415116 .{ .kind = .id_ref, .quantifier = .required },
17775 .{ .kind = .id_ref, .quantifier = .required },
17776 .{ .kind = .id_ref, .quantifier = .required },
1777715117 },
1777815118 },
1777915119 .{
17780 .name = "s_mul24",
17781 .opcode = 169,
15120 .name = "fclamp",
15121 .opcode = 95,
1778215122 .operands = &.{
1778315123 .{ .kind = .id_ref, .quantifier = .required },
1778415124 .{ .kind = .id_ref, .quantifier = .required },
15125 .{ .kind = .id_ref, .quantifier = .required },
1778515126 },
1778615127 },
1778715128 .{
17788 .name = "u_mul24",
17789 .opcode = 170,
15129 .name = "degrees",
15130 .opcode = 96,
1779015131 .operands = &.{
1779115132 .{ .kind = .id_ref, .quantifier = .required },
17792 .{ .kind = .id_ref, .quantifier = .required },
1779315133 },
1779415134 },
1779515135 .{
17796 .name = "vloadn",
17797 .opcode = 171,
15136 .name = "fmax_common",
15137 .opcode = 97,
1779815138 .operands = &.{
1779915139 .{ .kind = .id_ref, .quantifier = .required },
1780015140 .{ .kind = .id_ref, .quantifier = .required },
17801 .{ .kind = .literal_integer, .quantifier = .required },
1780215141 },
1780315142 },
1780415143 .{
17805 .name = "vstoren",
17806 .opcode = 172,
15144 .name = "fmin_common",
15145 .opcode = 98,
1780715146 .operands = &.{
1780815147 .{ .kind = .id_ref, .quantifier = .required },
1780915148 .{ .kind = .id_ref, .quantifier = .required },
17810 .{ .kind = .id_ref, .quantifier = .required },
1781115149 },
1781215150 },
1781315151 .{
17814 .name = "vload_half",
17815 .opcode = 173,
15152 .name = "mix",
15153 .opcode = 99,
1781615154 .operands = &.{
1781715155 .{ .kind = .id_ref, .quantifier = .required },
1781815156 .{ .kind = .id_ref, .quantifier = .required },
15157 .{ .kind = .id_ref, .quantifier = .required },
1781915158 },
1782015159 },
1782115160 .{
17822 .name = "vload_halfn",
17823 .opcode = 174,
15161 .name = "radians",
15162 .opcode = 100,
1782415163 .operands = &.{
1782515164 .{ .kind = .id_ref, .quantifier = .required },
17826 .{ .kind = .id_ref, .quantifier = .required },
17827 .{ .kind = .literal_integer, .quantifier = .required },
1782815165 },
1782915166 },
1783015167 .{
17831 .name = "vstore_half",
17832 .opcode = 175,
15168 .name = "step",
15169 .opcode = 101,
1783315170 .operands = &.{
1783415171 .{ .kind = .id_ref, .quantifier = .required },
1783515172 .{ .kind = .id_ref, .quantifier = .required },
17836 .{ .kind = .id_ref, .quantifier = .required },
1783715173 },
1783815174 },
1783915175 .{
17840 .name = "vstore_half_r",
17841 .opcode = 176,
15176 .name = "smoothstep",
15177 .opcode = 102,
1784215178 .operands = &.{
1784315179 .{ .kind = .id_ref, .quantifier = .required },
1784415180 .{ .kind = .id_ref, .quantifier = .required },
1784515181 .{ .kind = .id_ref, .quantifier = .required },
17846 .{ .kind = .fp_rounding_mode, .quantifier = .required },
1784715182 },
1784815183 },
1784915184 .{
17850 .name = "vstore_halfn",
17851 .opcode = 177,
15185 .name = "sign",
15186 .opcode = 103,
1785215187 .operands = &.{
1785315188 .{ .kind = .id_ref, .quantifier = .required },
17854 .{ .kind = .id_ref, .quantifier = .required },
17855 .{ .kind = .id_ref, .quantifier = .required },
1785615189 },
1785715190 },
1785815191 .{
17859 .name = "vstore_halfn_r",
17860 .opcode = 178,
15192 .name = "cross",
15193 .opcode = 104,
1786115194 .operands = &.{
1786215195 .{ .kind = .id_ref, .quantifier = .required },
1786315196 .{ .kind = .id_ref, .quantifier = .required },
17864 .{ .kind = .id_ref, .quantifier = .required },
17865 .{ .kind = .fp_rounding_mode, .quantifier = .required },
1786615197 },
1786715198 },
1786815199 .{
17869 .name = "vloada_halfn",
17870 .opcode = 179,
15200 .name = "distance",
15201 .opcode = 105,
1787115202 .operands = &.{
1787215203 .{ .kind = .id_ref, .quantifier = .required },
1787315204 .{ .kind = .id_ref, .quantifier = .required },
17874 .{ .kind = .literal_integer, .quantifier = .required },
1787515205 },
1787615206 },
1787715207 .{
17878 .name = "vstorea_halfn",
17879 .opcode = 180,
15208 .name = "length",
15209 .opcode = 106,
1788015210 .operands = &.{
1788115211 .{ .kind = .id_ref, .quantifier = .required },
17882 .{ .kind = .id_ref, .quantifier = .required },
17883 .{ .kind = .id_ref, .quantifier = .required },
1788415212 },
1788515213 },
1788615214 .{
17887 .name = "vstorea_halfn_r",
17888 .opcode = 181,
15215 .name = "normalize",
15216 .opcode = 107,
1788915217 .operands = &.{
1789015218 .{ .kind = .id_ref, .quantifier = .required },
17891 .{ .kind = .id_ref, .quantifier = .required },
17892 .{ .kind = .id_ref, .quantifier = .required },
17893 .{ .kind = .fp_rounding_mode, .quantifier = .required },
1789415219 },
1789515220 },
1789615221 .{
17897 .name = "shuffle",
17898 .opcode = 182,
15222 .name = "fast_distance",
15223 .opcode = 108,
1789915224 .operands = &.{
1790015225 .{ .kind = .id_ref, .quantifier = .required },
1790115226 .{ .kind = .id_ref, .quantifier = .required },
1790215227 },
1790315228 },
1790415229 .{
17905 .name = "shuffle2",
17906 .opcode = 183,
15230 .name = "fast_length",
15231 .opcode = 109,
1790715232 .operands = &.{
1790815233 .{ .kind = .id_ref, .quantifier = .required },
17909 .{ .kind = .id_ref, .quantifier = .required },
17910 .{ .kind = .id_ref, .quantifier = .required },
1791115234 },
1791215235 },
1791315236 .{
17914 .name = "printf",
17915 .opcode = 184,
15237 .name = "fast_normalize",
15238 .opcode = 110,
1791615239 .operands = &.{
1791715240 .{ .kind = .id_ref, .quantifier = .required },
17918 .{ .kind = .id_ref, .quantifier = .variadic },
1791915241 },
1792015242 },
1792115243 .{
17922 .name = "prefetch",
17923 .opcode = 185,
15244 .name = "s_abs",
15245 .opcode = 141,
1792415246 .operands = &.{
1792515247 .{ .kind = .id_ref, .quantifier = .required },
17926 .{ .kind = .id_ref, .quantifier = .required },
1792715248 },
1792815249 },
1792915250 .{
17930 .name = "bitselect",
17931 .opcode = 186,
15251 .name = "s_abs_diff",
15252 .opcode = 142,
1793215253 .operands = &.{
1793315254 .{ .kind = .id_ref, .quantifier = .required },
1793415255 .{ .kind = .id_ref, .quantifier = .required },
17935 .{ .kind = .id_ref, .quantifier = .required },
1793615256 },
1793715257 },
1793815258 .{
17939 .name = "select",
17940 .opcode = 187,
15259 .name = "s_add_sat",
15260 .opcode = 143,
1794115261 .operands = &.{
1794215262 .{ .kind = .id_ref, .quantifier = .required },
1794315263 .{ .kind = .id_ref, .quantifier = .required },
17944 .{ .kind = .id_ref, .quantifier = .required },
1794515264 },
1794615265 },
1794715266 .{
17948 .name = "u_abs",
17949 .opcode = 201,
15267 .name = "u_add_sat",
15268 .opcode = 144,
1795015269 .operands = &.{
1795115270 .{ .kind = .id_ref, .quantifier = .required },
15271 .{ .kind = .id_ref, .quantifier = .required },
1795215272 },
1795315273 },
1795415274 .{
17955 .name = "u_abs_diff",
17956 .opcode = 202,
15275 .name = "s_hadd",
15276 .opcode = 145,
1795715277 .operands = &.{
1795815278 .{ .kind = .id_ref, .quantifier = .required },
1795915279 .{ .kind = .id_ref, .quantifier = .required },
1796015280 },
1796115281 },
1796215282 .{
17963 .name = "u_mul_hi",
17964 .opcode = 203,
15283 .name = "u_hadd",
15284 .opcode = 146,
1796515285 .operands = &.{
1796615286 .{ .kind = .id_ref, .quantifier = .required },
1796715287 .{ .kind = .id_ref, .quantifier = .required },
1796815288 },
1796915289 },
1797015290 .{
17971 .name = "u_mad_hi",
17972 .opcode = 204,
15291 .name = "s_rhadd",
15292 .opcode = 147,
1797315293 .operands = &.{
1797415294 .{ .kind = .id_ref, .quantifier = .required },
1797515295 .{ .kind = .id_ref, .quantifier = .required },
17976 .{ .kind = .id_ref, .quantifier = .required },
1797715296 },
1797815297 },
17979 },
17980 .@"NonSemantic.Shader.DebugInfo.100" => &.{
17981 .{
17982 .name = "DebugInfoNone",
17983 .opcode = 0,
17984 .operands = &.{},
17985 },
1798615298 .{
17987 .name = "DebugCompilationUnit",
17988 .opcode = 1,
15299 .name = "u_rhadd",
15300 .opcode = 148,
1798915301 .operands = &.{
1799015302 .{ .kind = .id_ref, .quantifier = .required },
1799115303 .{ .kind = .id_ref, .quantifier = .required },
17992 .{ .kind = .id_ref, .quantifier = .required },
17993 .{ .kind = .id_ref, .quantifier = .required },
1799415304 },
1799515305 },
1799615306 .{
17997 .name = "DebugTypeBasic",
17998 .opcode = 2,
15307 .name = "s_clamp",
15308 .opcode = 149,
1799915309 .operands = &.{
1800015310 .{ .kind = .id_ref, .quantifier = .required },
1800115311 .{ .kind = .id_ref, .quantifier = .required },
1800215312 .{ .kind = .id_ref, .quantifier = .required },
18003 .{ .kind = .id_ref, .quantifier = .required },
1800415313 },
1800515314 },
1800615315 .{
18007 .name = "DebugTypePointer",
18008 .opcode = 3,
15316 .name = "u_clamp",
15317 .opcode = 150,
1800915318 .operands = &.{
1801015319 .{ .kind = .id_ref, .quantifier = .required },
1801115320 .{ .kind = .id_ref, .quantifier = .required },
......@@ -18013,216 +15322,179 @@ pub const InstructionSet = enum {
1801315322 },
1801415323 },
1801515324 .{
18016 .name = "DebugTypeQualifier",
18017 .opcode = 4,
15325 .name = "clz",
15326 .opcode = 151,
1801815327 .operands = &.{
1801915328 .{ .kind = .id_ref, .quantifier = .required },
18020 .{ .kind = .id_ref, .quantifier = .required },
1802115329 },
1802215330 },
1802315331 .{
18024 .name = "DebugTypeArray",
18025 .opcode = 5,
15332 .name = "ctz",
15333 .opcode = 152,
1802615334 .operands = &.{
1802715335 .{ .kind = .id_ref, .quantifier = .required },
18028 .{ .kind = .id_ref, .quantifier = .variadic },
1802915336 },
1803015337 },
1803115338 .{
18032 .name = "DebugTypeVector",
18033 .opcode = 6,
15339 .name = "s_mad_hi",
15340 .opcode = 153,
1803415341 .operands = &.{
1803515342 .{ .kind = .id_ref, .quantifier = .required },
1803615343 .{ .kind = .id_ref, .quantifier = .required },
15344 .{ .kind = .id_ref, .quantifier = .required },
1803715345 },
1803815346 },
1803915347 .{
18040 .name = "DebugTypedef",
18041 .opcode = 7,
15348 .name = "u_mad_sat",
15349 .opcode = 154,
1804215350 .operands = &.{
1804315351 .{ .kind = .id_ref, .quantifier = .required },
1804415352 .{ .kind = .id_ref, .quantifier = .required },
1804515353 .{ .kind = .id_ref, .quantifier = .required },
15354 },
15355 },
15356 .{
15357 .name = "s_mad_sat",
15358 .opcode = 155,
15359 .operands = &.{
1804615360 .{ .kind = .id_ref, .quantifier = .required },
1804715361 .{ .kind = .id_ref, .quantifier = .required },
1804815362 .{ .kind = .id_ref, .quantifier = .required },
1804915363 },
1805015364 },
1805115365 .{
18052 .name = "DebugTypeFunction",
18053 .opcode = 8,
15366 .name = "s_max",
15367 .opcode = 156,
1805415368 .operands = &.{
1805515369 .{ .kind = .id_ref, .quantifier = .required },
1805615370 .{ .kind = .id_ref, .quantifier = .required },
18057 .{ .kind = .id_ref, .quantifier = .variadic },
1805815371 },
1805915372 },
1806015373 .{
18061 .name = "DebugTypeEnum",
18062 .opcode = 9,
15374 .name = "u_max",
15375 .opcode = 157,
1806315376 .operands = &.{
1806415377 .{ .kind = .id_ref, .quantifier = .required },
1806515378 .{ .kind = .id_ref, .quantifier = .required },
18066 .{ .kind = .id_ref, .quantifier = .required },
18067 .{ .kind = .id_ref, .quantifier = .required },
18068 .{ .kind = .id_ref, .quantifier = .required },
18069 .{ .kind = .id_ref, .quantifier = .required },
18070 .{ .kind = .id_ref, .quantifier = .required },
18071 .{ .kind = .id_ref, .quantifier = .required },
18072 .{ .kind = .pair_id_ref_id_ref, .quantifier = .variadic },
1807315379 },
1807415380 },
1807515381 .{
18076 .name = "DebugTypeComposite",
18077 .opcode = 10,
15382 .name = "s_min",
15383 .opcode = 158,
1807815384 .operands = &.{
1807915385 .{ .kind = .id_ref, .quantifier = .required },
1808015386 .{ .kind = .id_ref, .quantifier = .required },
18081 .{ .kind = .id_ref, .quantifier = .required },
18082 .{ .kind = .id_ref, .quantifier = .required },
18083 .{ .kind = .id_ref, .quantifier = .required },
18084 .{ .kind = .id_ref, .quantifier = .required },
18085 .{ .kind = .id_ref, .quantifier = .required },
18086 .{ .kind = .id_ref, .quantifier = .required },
18087 .{ .kind = .id_ref, .quantifier = .required },
18088 .{ .kind = .id_ref, .quantifier = .variadic },
1808915387 },
1809015388 },
1809115389 .{
18092 .name = "DebugTypeMember",
18093 .opcode = 11,
15390 .name = "u_min",
15391 .opcode = 159,
1809415392 .operands = &.{
1809515393 .{ .kind = .id_ref, .quantifier = .required },
1809615394 .{ .kind = .id_ref, .quantifier = .required },
18097 .{ .kind = .id_ref, .quantifier = .required },
18098 .{ .kind = .id_ref, .quantifier = .required },
18099 .{ .kind = .id_ref, .quantifier = .required },
18100 .{ .kind = .id_ref, .quantifier = .required },
18101 .{ .kind = .id_ref, .quantifier = .required },
18102 .{ .kind = .id_ref, .quantifier = .required },
18103 .{ .kind = .id_ref, .quantifier = .optional },
1810415395 },
1810515396 },
1810615397 .{
18107 .name = "DebugTypeInheritance",
18108 .opcode = 12,
15398 .name = "s_mul_hi",
15399 .opcode = 160,
1810915400 .operands = &.{
1811015401 .{ .kind = .id_ref, .quantifier = .required },
1811115402 .{ .kind = .id_ref, .quantifier = .required },
18112 .{ .kind = .id_ref, .quantifier = .required },
18113 .{ .kind = .id_ref, .quantifier = .required },
1811415403 },
1811515404 },
1811615405 .{
18117 .name = "DebugTypePtrToMember",
18118 .opcode = 13,
15406 .name = "rotate",
15407 .opcode = 161,
1811915408 .operands = &.{
1812015409 .{ .kind = .id_ref, .quantifier = .required },
1812115410 .{ .kind = .id_ref, .quantifier = .required },
1812215411 },
1812315412 },
1812415413 .{
18125 .name = "DebugTypeTemplate",
18126 .opcode = 14,
15414 .name = "s_sub_sat",
15415 .opcode = 162,
1812715416 .operands = &.{
1812815417 .{ .kind = .id_ref, .quantifier = .required },
18129 .{ .kind = .id_ref, .quantifier = .variadic },
15418 .{ .kind = .id_ref, .quantifier = .required },
1813015419 },
1813115420 },
1813215421 .{
18133 .name = "DebugTypeTemplateParameter",
18134 .opcode = 15,
15422 .name = "u_sub_sat",
15423 .opcode = 163,
1813515424 .operands = &.{
1813615425 .{ .kind = .id_ref, .quantifier = .required },
1813715426 .{ .kind = .id_ref, .quantifier = .required },
18138 .{ .kind = .id_ref, .quantifier = .required },
18139 .{ .kind = .id_ref, .quantifier = .required },
18140 .{ .kind = .id_ref, .quantifier = .required },
18141 .{ .kind = .id_ref, .quantifier = .required },
1814215427 },
1814315428 },
1814415429 .{
18145 .name = "DebugTypeTemplateTemplateParameter",
18146 .opcode = 16,
15430 .name = "u_upsample",
15431 .opcode = 164,
1814715432 .operands = &.{
1814815433 .{ .kind = .id_ref, .quantifier = .required },
1814915434 .{ .kind = .id_ref, .quantifier = .required },
18150 .{ .kind = .id_ref, .quantifier = .required },
18151 .{ .kind = .id_ref, .quantifier = .required },
18152 .{ .kind = .id_ref, .quantifier = .required },
1815315435 },
1815415436 },
1815515437 .{
18156 .name = "DebugTypeTemplateParameterPack",
18157 .opcode = 17,
15438 .name = "s_upsample",
15439 .opcode = 165,
1815815440 .operands = &.{
1815915441 .{ .kind = .id_ref, .quantifier = .required },
1816015442 .{ .kind = .id_ref, .quantifier = .required },
18161 .{ .kind = .id_ref, .quantifier = .required },
18162 .{ .kind = .id_ref, .quantifier = .required },
18163 .{ .kind = .id_ref, .quantifier = .variadic },
1816415443 },
1816515444 },
1816615445 .{
18167 .name = "DebugGlobalVariable",
18168 .opcode = 18,
15446 .name = "popcount",
15447 .opcode = 166,
1816915448 .operands = &.{
1817015449 .{ .kind = .id_ref, .quantifier = .required },
18171 .{ .kind = .id_ref, .quantifier = .required },
18172 .{ .kind = .id_ref, .quantifier = .required },
18173 .{ .kind = .id_ref, .quantifier = .required },
18174 .{ .kind = .id_ref, .quantifier = .required },
18175 .{ .kind = .id_ref, .quantifier = .required },
18176 .{ .kind = .id_ref, .quantifier = .required },
18177 .{ .kind = .id_ref, .quantifier = .required },
18178 .{ .kind = .id_ref, .quantifier = .required },
18179 .{ .kind = .id_ref, .quantifier = .optional },
1818015450 },
1818115451 },
1818215452 .{
18183 .name = "DebugFunctionDeclaration",
18184 .opcode = 19,
15453 .name = "s_mad24",
15454 .opcode = 167,
1818515455 .operands = &.{
1818615456 .{ .kind = .id_ref, .quantifier = .required },
1818715457 .{ .kind = .id_ref, .quantifier = .required },
1818815458 .{ .kind = .id_ref, .quantifier = .required },
18189 .{ .kind = .id_ref, .quantifier = .required },
18190 .{ .kind = .id_ref, .quantifier = .required },
18191 .{ .kind = .id_ref, .quantifier = .required },
18192 .{ .kind = .id_ref, .quantifier = .required },
18193 .{ .kind = .id_ref, .quantifier = .required },
1819415459 },
1819515460 },
1819615461 .{
18197 .name = "DebugFunction",
18198 .opcode = 20,
15462 .name = "u_mad24",
15463 .opcode = 168,
1819915464 .operands = &.{
1820015465 .{ .kind = .id_ref, .quantifier = .required },
1820115466 .{ .kind = .id_ref, .quantifier = .required },
1820215467 .{ .kind = .id_ref, .quantifier = .required },
15468 },
15469 },
15470 .{
15471 .name = "s_mul24",
15472 .opcode = 169,
15473 .operands = &.{
1820315474 .{ .kind = .id_ref, .quantifier = .required },
1820415475 .{ .kind = .id_ref, .quantifier = .required },
18205 .{ .kind = .id_ref, .quantifier = .required },
18206 .{ .kind = .id_ref, .quantifier = .required },
18207 .{ .kind = .id_ref, .quantifier = .required },
18208 .{ .kind = .id_ref, .quantifier = .required },
18209 .{ .kind = .id_ref, .quantifier = .optional },
1821015476 },
1821115477 },
1821215478 .{
18213 .name = "DebugLexicalBlock",
18214 .opcode = 21,
15479 .name = "u_mul24",
15480 .opcode = 170,
1821515481 .operands = &.{
1821615482 .{ .kind = .id_ref, .quantifier = .required },
1821715483 .{ .kind = .id_ref, .quantifier = .required },
15484 },
15485 },
15486 .{
15487 .name = "vloadn",
15488 .opcode = 171,
15489 .operands = &.{
1821815490 .{ .kind = .id_ref, .quantifier = .required },
1821915491 .{ .kind = .id_ref, .quantifier = .required },
18220 .{ .kind = .id_ref, .quantifier = .optional },
15492 .{ .kind = .literal_integer, .quantifier = .required },
1822115493 },
1822215494 },
1822315495 .{
18224 .name = "DebugLexicalBlockDiscriminator",
18225 .opcode = 22,
15496 .name = "vstoren",
15497 .opcode = 172,
1822615498 .operands = &.{
1822715499 .{ .kind = .id_ref, .quantifier = .required },
1822815500 .{ .kind = .id_ref, .quantifier = .required },
......@@ -18230,183 +15502,165 @@ pub const InstructionSet = enum {
1823015502 },
1823115503 },
1823215504 .{
18233 .name = "DebugScope",
18234 .opcode = 23,
15505 .name = "vload_half",
15506 .opcode = 173,
1823515507 .operands = &.{
1823615508 .{ .kind = .id_ref, .quantifier = .required },
18237 .{ .kind = .id_ref, .quantifier = .optional },
15509 .{ .kind = .id_ref, .quantifier = .required },
1823815510 },
1823915511 },
1824015512 .{
18241 .name = "DebugNoScope",
18242 .opcode = 24,
18243 .operands = &.{},
18244 },
18245 .{
18246 .name = "DebugInlinedAt",
18247 .opcode = 25,
15513 .name = "vload_halfn",
15514 .opcode = 174,
1824815515 .operands = &.{
1824915516 .{ .kind = .id_ref, .quantifier = .required },
1825015517 .{ .kind = .id_ref, .quantifier = .required },
18251 .{ .kind = .id_ref, .quantifier = .optional },
15518 .{ .kind = .literal_integer, .quantifier = .required },
1825215519 },
1825315520 },
1825415521 .{
18255 .name = "DebugLocalVariable",
18256 .opcode = 26,
15522 .name = "vstore_half",
15523 .opcode = 175,
1825715524 .operands = &.{
1825815525 .{ .kind = .id_ref, .quantifier = .required },
1825915526 .{ .kind = .id_ref, .quantifier = .required },
1826015527 .{ .kind = .id_ref, .quantifier = .required },
18261 .{ .kind = .id_ref, .quantifier = .required },
18262 .{ .kind = .id_ref, .quantifier = .required },
18263 .{ .kind = .id_ref, .quantifier = .required },
18264 .{ .kind = .id_ref, .quantifier = .required },
18265 .{ .kind = .id_ref, .quantifier = .optional },
1826615528 },
1826715529 },
1826815530 .{
18269 .name = "DebugInlinedVariable",
18270 .opcode = 27,
15531 .name = "vstore_half_r",
15532 .opcode = 176,
1827115533 .operands = &.{
1827215534 .{ .kind = .id_ref, .quantifier = .required },
1827315535 .{ .kind = .id_ref, .quantifier = .required },
15536 .{ .kind = .id_ref, .quantifier = .required },
15537 .{ .kind = .fp_rounding_mode, .quantifier = .required },
1827415538 },
1827515539 },
1827615540 .{
18277 .name = "DebugDeclare",
18278 .opcode = 28,
15541 .name = "vstore_halfn",
15542 .opcode = 177,
1827915543 .operands = &.{
1828015544 .{ .kind = .id_ref, .quantifier = .required },
1828115545 .{ .kind = .id_ref, .quantifier = .required },
1828215546 .{ .kind = .id_ref, .quantifier = .required },
18283 .{ .kind = .id_ref, .quantifier = .variadic },
1828415547 },
1828515548 },
1828615549 .{
18287 .name = "DebugValue",
18288 .opcode = 29,
15550 .name = "vstore_halfn_r",
15551 .opcode = 178,
1828915552 .operands = &.{
1829015553 .{ .kind = .id_ref, .quantifier = .required },
1829115554 .{ .kind = .id_ref, .quantifier = .required },
1829215555 .{ .kind = .id_ref, .quantifier = .required },
18293 .{ .kind = .id_ref, .quantifier = .variadic },
15556 .{ .kind = .fp_rounding_mode, .quantifier = .required },
1829415557 },
1829515558 },
1829615559 .{
18297 .name = "DebugOperation",
18298 .opcode = 30,
15560 .name = "vloada_halfn",
15561 .opcode = 179,
1829915562 .operands = &.{
1830015563 .{ .kind = .id_ref, .quantifier = .required },
18301 .{ .kind = .id_ref, .quantifier = .variadic },
15564 .{ .kind = .id_ref, .quantifier = .required },
15565 .{ .kind = .literal_integer, .quantifier = .required },
1830215566 },
1830315567 },
1830415568 .{
18305 .name = "DebugExpression",
18306 .opcode = 31,
15569 .name = "vstorea_halfn",
15570 .opcode = 180,
1830715571 .operands = &.{
18308 .{ .kind = .id_ref, .quantifier = .variadic },
15572 .{ .kind = .id_ref, .quantifier = .required },
15573 .{ .kind = .id_ref, .quantifier = .required },
15574 .{ .kind = .id_ref, .quantifier = .required },
1830915575 },
1831015576 },
1831115577 .{
18312 .name = "DebugMacroDef",
18313 .opcode = 32,
15578 .name = "vstorea_halfn_r",
15579 .opcode = 181,
1831415580 .operands = &.{
1831515581 .{ .kind = .id_ref, .quantifier = .required },
1831615582 .{ .kind = .id_ref, .quantifier = .required },
1831715583 .{ .kind = .id_ref, .quantifier = .required },
18318 .{ .kind = .id_ref, .quantifier = .optional },
15584 .{ .kind = .fp_rounding_mode, .quantifier = .required },
1831915585 },
1832015586 },
1832115587 .{
18322 .name = "DebugMacroUndef",
18323 .opcode = 33,
15588 .name = "shuffle",
15589 .opcode = 182,
1832415590 .operands = &.{
1832515591 .{ .kind = .id_ref, .quantifier = .required },
1832615592 .{ .kind = .id_ref, .quantifier = .required },
18327 .{ .kind = .id_ref, .quantifier = .required },
1832815593 },
1832915594 },
1833015595 .{
18331 .name = "DebugImportedEntity",
18332 .opcode = 34,
15596 .name = "shuffle2",
15597 .opcode = 183,
1833315598 .operands = &.{
1833415599 .{ .kind = .id_ref, .quantifier = .required },
1833515600 .{ .kind = .id_ref, .quantifier = .required },
1833615601 .{ .kind = .id_ref, .quantifier = .required },
18337 .{ .kind = .id_ref, .quantifier = .required },
18338 .{ .kind = .id_ref, .quantifier = .required },
18339 .{ .kind = .id_ref, .quantifier = .required },
18340 .{ .kind = .id_ref, .quantifier = .required },
1834115602 },
1834215603 },
1834315604 .{
18344 .name = "DebugSource",
18345 .opcode = 35,
15605 .name = "printf",
15606 .opcode = 184,
1834615607 .operands = &.{
1834715608 .{ .kind = .id_ref, .quantifier = .required },
18348 .{ .kind = .id_ref, .quantifier = .optional },
15609 .{ .kind = .id_ref, .quantifier = .variadic },
1834915610 },
1835015611 },
1835115612 .{
18352 .name = "DebugFunctionDefinition",
18353 .opcode = 101,
15613 .name = "prefetch",
15614 .opcode = 185,
1835415615 .operands = &.{
1835515616 .{ .kind = .id_ref, .quantifier = .required },
1835615617 .{ .kind = .id_ref, .quantifier = .required },
1835715618 },
1835815619 },
1835915620 .{
18360 .name = "DebugSourceContinued",
18361 .opcode = 102,
15621 .name = "bitselect",
15622 .opcode = 186,
1836215623 .operands = &.{
1836315624 .{ .kind = .id_ref, .quantifier = .required },
15625 .{ .kind = .id_ref, .quantifier = .required },
15626 .{ .kind = .id_ref, .quantifier = .required },
1836415627 },
1836515628 },
1836615629 .{
18367 .name = "DebugLine",
18368 .opcode = 103,
15630 .name = "select",
15631 .opcode = 187,
1836915632 .operands = &.{
1837015633 .{ .kind = .id_ref, .quantifier = .required },
1837115634 .{ .kind = .id_ref, .quantifier = .required },
1837215635 .{ .kind = .id_ref, .quantifier = .required },
18373 .{ .kind = .id_ref, .quantifier = .required },
18374 .{ .kind = .id_ref, .quantifier = .required },
1837515636 },
1837615637 },
1837715638 .{
18378 .name = "DebugNoLine",
18379 .opcode = 104,
18380 .operands = &.{},
18381 },
18382 .{
18383 .name = "DebugBuildIdentifier",
18384 .opcode = 105,
15639 .name = "u_abs",
15640 .opcode = 201,
1838515641 .operands = &.{
1838615642 .{ .kind = .id_ref, .quantifier = .required },
18387 .{ .kind = .id_ref, .quantifier = .required },
1838815643 },
1838915644 },
1839015645 .{
18391 .name = "DebugStoragePath",
18392 .opcode = 106,
15646 .name = "u_abs_diff",
15647 .opcode = 202,
1839315648 .operands = &.{
1839415649 .{ .kind = .id_ref, .quantifier = .required },
15650 .{ .kind = .id_ref, .quantifier = .required },
1839515651 },
1839615652 },
1839715653 .{
18398 .name = "DebugEntryPoint",
18399 .opcode = 107,
15654 .name = "u_mul_hi",
15655 .opcode = 203,
1840015656 .operands = &.{
1840115657 .{ .kind = .id_ref, .quantifier = .required },
1840215658 .{ .kind = .id_ref, .quantifier = .required },
18403 .{ .kind = .id_ref, .quantifier = .required },
18404 .{ .kind = .id_ref, .quantifier = .required },
1840515659 },
1840615660 },
1840715661 .{
18408 .name = "DebugTypeMatrix",
18409 .opcode = 108,
15662 .name = "u_mad_hi",
15663 .opcode = 204,
1841015664 .operands = &.{
1841115665 .{ .kind = .id_ref, .quantifier = .required },
1841215666 .{ .kind = .id_ref, .quantifier = .required },
src/link/SpirV.zig+31-7
......@@ -23,6 +23,7 @@ const Linker = @This();
2323
2424base: link.File,
2525module: Module,
26cg: CodeGen,
2627
2728pub fn createEmpty(
2829 arena: Allocator,
......@@ -63,6 +64,16 @@ pub fn createEmpty(
6364 .arena = arena,
6465 .zcu = comp.zcu.?,
6566 },
67 .cg = .{
68 // These fields are populated in generate()
69 .pt = undefined,
70 .air = undefined,
71 .liveness = undefined,
72 .owner_nav = undefined,
73 .module = undefined,
74 .control_flow = .{ .structured = .{} },
75 .base_line = undefined,
76 },
6677 };
6778 errdefer linker.deinit();
6879
......@@ -84,6 +95,7 @@ pub fn open(
8495}
8596
8697pub fn deinit(linker: *Linker) void {
98 linker.cg.deinit();
8799 linker.module.deinit();
88100}
89101
......@@ -99,29 +111,41 @@ fn generate(
99111 const gpa = zcu.gpa;
100112 const structured_cfg = zcu.navFileScope(nav_index).mod.?.structured_cfg;
101113
102 var cg: CodeGen = .{
114 linker.cg.control_flow.deinit(gpa);
115 linker.cg.args.clearRetainingCapacity();
116 linker.cg.inst_results.clearRetainingCapacity();
117 linker.cg.id_scratch.clearRetainingCapacity();
118 linker.cg.prologue.reset();
119 linker.cg.body.reset();
120
121 linker.cg = .{
103122 .pt = pt,
104 .module = &linker.module,
105 .owner_nav = nav_index,
106123 .air = air,
107124 .liveness = liveness,
125 .owner_nav = nav_index,
126 .module = &linker.module,
108127 .control_flow = switch (structured_cfg) {
109128 true => .{ .structured = .{} },
110129 false => .{ .unstructured = .{} },
111130 },
112131 .base_line = zcu.navSrcLine(nav_index),
132
133 .args = linker.cg.args,
134 .inst_results = linker.cg.inst_results,
135 .id_scratch = linker.cg.id_scratch,
136 .prologue = linker.cg.prologue,
137 .body = linker.cg.body,
113138 };
114 defer cg.deinit();
115139
116 cg.genNav(do_codegen) catch |err| switch (err) {
117 error.CodegenFail => switch (zcu.codegenFailMsg(nav_index, cg.error_msg.?)) {
140 linker.cg.genNav(do_codegen) catch |err| switch (err) {
141 error.CodegenFail => switch (zcu.codegenFailMsg(nav_index, linker.cg.error_msg.?)) {
118142 error.CodegenFail => {},
119143 error.OutOfMemory => |e| return e,
120144 },
121145 else => |other| {
122146 // There might be an error that happened *after* linker.error_msg
123147 // was already allocated, so be sure to free it.
124 if (cg.error_msg) |error_msg| {
148 if (linker.cg.error_msg) |error_msg| {
125149 error_msg.deinit(gpa);
126150 }
127151
tools/gen_spirv_spec.zig+81-60
......@@ -12,6 +12,7 @@ const ExtendedStructSet = std.StringHashMap(void);
1212
1313const Extension = struct {
1414 name: []const u8,
15 opcode_name: []const u8,
1516 spec: ExtensionRegistry,
1617};
1718
......@@ -44,23 +45,11 @@ const OperandKindMap = std.ArrayHashMap(StringPair, OperandKind, StringPairConte
4445
4546/// Khronos made it so that these names are not defined explicitly, so
4647/// we need to hardcode it (like they did).
47/// See https://github.com/KhronosGroup/SPIRV-Registry/
48const set_names = std.StaticStringMap([]const u8).initComptime(.{
49 .{ "opencl.std.100", "OpenCL.std" },
50 .{ "glsl.std.450", "GLSL.std.450" },
51 .{ "opencl.debuginfo.100", "OpenCL.DebugInfo.100" },
52 .{ "spv-amd-shader-ballot", "SPV_AMD_shader_ballot" },
53 .{ "nonsemantic.shader.debuginfo.100", "NonSemantic.Shader.DebugInfo.100" },
54 .{ "nonsemantic.vkspreflection", "NonSemantic.VkspReflection" },
55 .{ "nonsemantic.clspvreflection", "NonSemantic.ClspvReflection.6" }, // This version needs to be handled manually
56 .{ "spv-amd-gcn-shader", "SPV_AMD_gcn_shader" },
57 .{ "spv-amd-shader-trinary-minmax", "SPV_AMD_shader_trinary_minmax" },
58 .{ "debuginfo", "DebugInfo" },
59 .{ "nonsemantic.debugprintf", "NonSemantic.DebugPrintf" },
60 .{ "spv-amd-shader-explicit-vertex-parameter", "SPV_AMD_shader_explicit_vertex_parameter" },
61 .{ "nonsemantic.debugbreak", "NonSemantic.DebugBreak" },
62 .{ "tosa.001000.1", "SPV_EXT_INST_TYPE_TOSA_001000_1" },
63 .{ "zig", "zig" },
48/// See https://github.com/KhronosGroup/SPIRV-Registry
49const set_names = std.StaticStringMap(struct { []const u8, []const u8 }).initComptime(.{
50 .{ "opencl.std.100", .{ "OpenCL.std", "OpenClOpcode" } },
51 .{ "glsl.std.450", .{ "GLSL.std.450", "GlslOpcode" } },
52 .{ "zig", .{ "zig", "Zig" } },
6453});
6554
6655var arena = std.heap.ArenaAllocator.init(std.heap.smp_allocator);
......@@ -78,7 +67,7 @@ pub fn main() !void {
7867 const dir = try std.fs.cwd().openDir(json_path, .{ .iterate = true });
7968
8069 const core_spec = try readRegistry(CoreRegistry, dir, "spirv.core.grammar.json");
81 std.sort.block(Instruction, core_spec.instructions, CmpInst{}, CmpInst.lt);
70 std.mem.sortUnstable(Instruction, core_spec.instructions, CmpInst{}, CmpInst.lt);
8271
8372 var exts = std.ArrayList(Extension).init(allocator);
8473
......@@ -134,14 +123,24 @@ fn readExtRegistry(exts: *std.ArrayList(Extension), dir: std.fs.Dir, sub_path: [
134123 const name = filename["extinst.".len .. filename.len - ".grammar.json".len];
135124 const spec = try readRegistry(ExtensionRegistry, dir, sub_path);
136125
126 const set_name = set_names.get(name) orelse {
127 std.log.info("ignored instruction set '{s}'", .{name});
128 return;
129 };
130
137131 std.sort.block(Instruction, spec.instructions, CmpInst{}, CmpInst.lt);
138132
139 try exts.append(.{ .name = set_names.get(name).?, .spec = spec });
133 try exts.append(.{
134 .name = set_name.@"0",
135 .opcode_name = set_name.@"1",
136 .spec = spec,
137 });
140138}
141139
142140fn readRegistry(comptime RegistryType: type, dir: std.fs.Dir, path: []const u8) !RegistryType {
143141 const spec = try dir.readFileAlloc(allocator, path, std.math.maxInt(usize));
144142 // Required for json parsing.
143 // TODO: ALI
145144 @setEvalBranchQuota(10000);
146145
147146 var scanner = std.json.Scanner.initCompleteInput(allocator, spec);
......@@ -191,7 +190,11 @@ fn tagPriorityScore(tag: []const u8) usize {
191190 }
192191}
193192
194fn render(writer: *std.io.Writer, registry: CoreRegistry, extensions: []const Extension) !void {
193fn render(
194 writer: *std.io.Writer,
195 registry: CoreRegistry,
196 extensions: []const Extension,
197) !void {
195198 try writer.writeAll(
196199 \\//! This file is auto-generated by tools/gen_spirv_spec.zig.
197200 \\
......@@ -317,13 +320,18 @@ fn render(writer: *std.io.Writer, registry: CoreRegistry, extensions: []const Ex
317320 // Note: extensions don't seem to have class.
318321 try renderClass(writer, registry.instructions);
319322 try renderOperandKind(writer, all_operand_kinds.values());
320 try renderOpcodes(writer, registry.instructions, extended_structs);
323
324 try renderOpcodes(writer, "Opcode", true, registry.instructions, extended_structs);
325 for (extensions) |ext| {
326 try renderOpcodes(writer, ext.opcode_name, false, ext.spec.instructions, extended_structs);
327 }
328
321329 try renderOperandKinds(writer, all_operand_kinds.values(), extended_structs);
322330 try renderInstructionSet(writer, registry, extensions, all_operand_kinds);
323331}
324332
325333fn renderInstructionSet(
326 writer: anytype,
334 writer: *std.io.Writer,
327335 core: CoreRegistry,
328336 extensions: []const Extension,
329337 all_operand_kinds: OperandKindMap,
......@@ -358,7 +366,7 @@ fn renderInstructionSet(
358366}
359367
360368fn renderInstructionsCase(
361 writer: anytype,
369 writer: *std.io.Writer,
362370 set_name: []const u8,
363371 instructions: []const Instruction,
364372 all_operand_kinds: OperandKindMap,
......@@ -405,7 +413,7 @@ fn renderInstructionsCase(
405413 );
406414}
407415
408fn renderClass(writer: anytype, instructions: []const Instruction) !void {
416fn renderClass(writer: *std.io.Writer, instructions: []const Instruction) !void {
409417 var class_map = std.StringArrayHashMap(void).init(allocator);
410418
411419 for (instructions) |inst| {
......@@ -454,7 +462,7 @@ fn formatId(identifier: []const u8) std.fmt.Alt(Formatter, Formatter.format) {
454462 return .{ .data = .{ .data = identifier } };
455463}
456464
457fn renderOperandKind(writer: anytype, operands: []const OperandKind) !void {
465fn renderOperandKind(writer: *std.io.Writer, operands: []const OperandKind) !void {
458466 try writer.writeAll(
459467 \\pub const OperandKind = enum {
460468 \\ opcode,
......@@ -510,7 +518,7 @@ fn renderOperandKind(writer: anytype, operands: []const OperandKind) !void {
510518 try writer.writeAll("};\n}\n};\n");
511519}
512520
513fn renderEnumerant(writer: anytype, enumerant: Enumerant) !void {
521fn renderEnumerant(writer: *std.io.Writer, enumerant: Enumerant) !void {
514522 try writer.print(".{{.name = \"{s}\", .value = ", .{enumerant.enumerant});
515523 switch (enumerant.value) {
516524 .bitflag => |flag| try writer.writeAll(flag),
......@@ -527,7 +535,9 @@ fn renderEnumerant(writer: anytype, enumerant: Enumerant) !void {
527535}
528536
529537fn renderOpcodes(
530 writer: anytype,
538 writer: *std.io.Writer,
539 opcode_type_name: []const u8,
540 want_operands: bool,
531541 instructions: []const Instruction,
532542 extended_structs: ExtendedStructSet,
533543) !void {
......@@ -538,7 +548,9 @@ fn renderOpcodes(
538548 try aliases.ensureTotalCapacity(instructions.len);
539549
540550 for (instructions, 0..) |inst, i| {
541 if (std.mem.eql(u8, inst.class.?, "@exclude")) continue;
551 if (inst.class) |class| {
552 if (std.mem.eql(u8, class, "@exclude")) continue;
553 }
542554
543555 const result = inst_map.getOrPutAssumeCapacity(inst.opcode);
544556 if (!result.found_existing) {
......@@ -562,58 +574,67 @@ fn renderOpcodes(
562574
563575 const instructions_indices = inst_map.values();
564576
565 try writer.writeAll("pub const Opcode = enum(u16) {\n");
577 try writer.print("\npub const {f} = enum(u16) {{\n", .{std.zig.fmtId(opcode_type_name)});
566578 for (instructions_indices) |i| {
567579 const inst = instructions[i];
568580 try writer.print("{f} = {},\n", .{ std.zig.fmtId(inst.opname), inst.opcode });
569581 }
570582
571 try writer.writeAll(
572 \\
573 );
583 try writer.writeAll("\n");
574584
575585 for (aliases.items) |alias| {
576 try writer.print("pub const {f} = Opcode.{f};\n", .{
586 try writer.print("pub const {f} = {f}.{f};\n", .{
577587 formatId(instructions[alias.inst].opname),
588 std.zig.fmtId(opcode_type_name),
578589 formatId(instructions[alias.alias].opname),
579590 });
580591 }
581592
582 try writer.writeAll(
583 \\
584 \\pub fn Operands(comptime self: Opcode) type {
585 \\ return switch (self) {
586 \\
587 );
593 if (want_operands) {
594 try writer.print(
595 \\
596 \\pub fn Operands(comptime self: {f}) type {{
597 \\ return switch (self) {{
598 \\
599 , .{std.zig.fmtId(opcode_type_name)});
588600
589 for (instructions_indices) |i| {
590 const inst = instructions[i];
591 try renderOperand(writer, .instruction, inst.opname, inst.operands, extended_structs, false);
592 }
601 for (instructions_indices) |i| {
602 const inst = instructions[i];
603 try renderOperand(writer, .instruction, inst.opname, inst.operands, extended_structs, false);
604 }
593605
594 try writer.writeAll(
595 \\ };
596 \\}
597 \\pub fn class(self: Opcode) Class {
598 \\ return switch (self) {
599 \\
600 );
606 try writer.writeAll(
607 \\ };
608 \\}
609 \\
610 );
601611
602 for (instructions_indices) |i| {
603 const inst = instructions[i];
604 try writer.print(".{f} => .{f},\n", .{ std.zig.fmtId(inst.opname), formatId(inst.class.?) });
612 try writer.print(
613 \\pub fn class(self: {f}) Class {{
614 \\ return switch (self) {{
615 \\
616 , .{std.zig.fmtId(opcode_type_name)});
617
618 for (instructions_indices) |i| {
619 const inst = instructions[i];
620 try writer.print(".{f} => .{f},\n", .{ std.zig.fmtId(inst.opname), formatId(inst.class.?) });
621 }
622
623 try writer.writeAll(
624 \\ };
625 \\}
626 \\
627 );
605628 }
606629
607630 try writer.writeAll(
608 \\ };
609 \\}
610631 \\};
611632 \\
612633 );
613634}
614635
615636fn renderOperandKinds(
616 writer: anytype,
637 writer: *std.io.Writer,
617638 kinds: []const OperandKind,
618639 extended_structs: ExtendedStructSet,
619640) !void {
......@@ -627,7 +648,7 @@ fn renderOperandKinds(
627648}
628649
629650fn renderValueEnum(
630 writer: anytype,
651 writer: *std.io.Writer,
631652 enumeration: OperandKind,
632653 extended_structs: ExtendedStructSet,
633654) !void {
......@@ -705,7 +726,7 @@ fn renderValueEnum(
705726}
706727
707728fn renderBitEnum(
708 writer: anytype,
729 writer: *std.io.Writer,
709730 enumeration: OperandKind,
710731 extended_structs: ExtendedStructSet,
711732) !void {
......@@ -788,7 +809,7 @@ fn renderBitEnum(
788809}
789810
790811fn renderOperand(
791 writer: anytype,
812 writer: *std.io.Writer,
792813 kind: enum {
793814 @"union",
794815 instruction,
......@@ -872,7 +893,7 @@ fn renderOperand(
872893 try writer.writeAll(",\n");
873894}
874895
875fn renderFieldName(writer: anytype, operands: []const Operand, field_index: usize) !void {
896fn renderFieldName(writer: *std.io.Writer, operands: []const Operand, field_index: usize) !void {
876897 const operand = operands[field_index];
877898
878899 derive_from_kind: {