1source: [*:0]const u8,
2operands: std.StringHashMapUnmanaged(Operand),
3
4pub const Operand = union(enum) {
5 register: aarch64.encoding.Register,
6};
7
8pub fn nextInstruction(as: *Assemble) !?Instruction {
9 const original_source = while (true) {
10 const original_source = as.source;
11 var token_buf: [token_buf_len]u8 = undefined;
12 const source_token = try as.nextToken(&token_buf, .{});
13 switch (source_token.len) {
14 0 => return null,
15 else => switch (source_token[0]) {
16 else => break original_source,
17 '\n', ';' => {},
18 },
19 }
20 };
21 log.debug(
22 \\.
23 \\=========================
24 \\= Assembling "{f}"
25 \\=========================
26 \\
27 , .{std.zig.fmtString(std.mem.span(original_source))});
28 for (matchers) |matcher| {
29 as.source = original_source;
30 if (try matcher(as)) |result| return result;
31 }
32 as.source = original_source;
33 log.debug("Nothing matched!\n", .{});
34 return error.InvalidSyntax;
35}
36
37fn zonCast(comptime Result: type, zon_value: anytype, symbols: anytype) Result {
38 const ZonValue = @TypeOf(zon_value);
39 const Symbols = @TypeOf(symbols);
40 switch (@typeInfo(ZonValue)) {
41 .void, .bool, .int, .float, .pointer, .comptime_float, .comptime_int, .@"enum" => return zon_value,
42 .@"struct" => |zon_struct| switch (@typeInfo(Result)) {
43 .pointer => |result_pointer| {
44 comptime assert(result_pointer.size == .slice and result_pointer.attrs.@"const");
45 const elems = comptime blk: {
46 var temp_elems: [zon_value.len]result_pointer.child = undefined;
47 for (&temp_elems, zon_value) |*elem, zon_elem| elem.* = zonCast(result_pointer.child, zon_elem, symbols);
48 break :blk temp_elems;
49 };
50 return &elems;
51 },
52 .@"struct" => |result_struct| {
53 comptime var used_zon_fields = 0;
54 var result: Result = undefined;
55 inline for (result_struct.field_names, result_struct.field_types, result_struct.field_attrs) |result_field_name, result_field_type, result_field_attrs|
56 @field(result, result_field_name) = if (@hasField(ZonValue, result_field_name)) result: {
57 used_zon_fields += 1;
58 break :result zonCast(@FieldType(Result, result_field_name), @field(zon_value, result_field_name), symbols);
59 } else result_field_attrs.defaultValue(result_field_type) orelse @compileError(std.fmt.comptimePrint("missing zon field '{s}': {} <- {any}", .{ result_field_name, Result, zon_value }));
60 if (used_zon_fields != zon_struct.field_names.len) @compileError(std.fmt.comptimePrint("unused zon field: {} <- {any}", .{ Result, zon_value }));
61 return result;
62 },
63 .@"union" => {
64 if (zon_struct.field_names.len != 1) @compileError(std.fmt.comptimePrint("{} <- {any}", .{ Result, zon_value }));
65 const field_name = zon_struct.field_names[0];
66 return @unionInit(
67 Result,
68 field_name,
69 zonCast(@FieldType(Result, field_name), @field(zon_value, field_name), symbols),
70 );
71 },
72 else => @compileError(std.fmt.comptimePrint("unsupported zon type: {} <- {any}", .{ Result, zon_value })),
73 },
74 .enum_literal => if (@hasField(Symbols, @tagName(zon_value))) {
75 const symbol = @field(symbols, @tagName(zon_value));
76 const Symbol = @TypeOf(symbol);
77 switch (@typeInfo(Result)) {
78 .@"enum" => switch (@typeInfo(Symbol)) {
79 .int => |info| {
80 var buf: [
81 std.fmt.count("{d}", .{switch (info.signedness) {
82 .signed => std.math.minInt(Symbol),
83 .unsigned => std.math.maxInt(Symbol),
84 }})
85 ]u8 = undefined;
86 return std.meta.stringToEnum(Result, std.mem.print(&buf, "{d}", .{symbol}) catch unreachable).?;
87 },
88 else => return symbol,
89 },
90 else => return symbol,
91 }
92 } else {
93 const Container = switch (@typeInfo(Result)) {
94 else => struct {},
95 .@"struct", .@"enum", .@"union", .@"opaque" => Result,
96 .optional => |info| info.child,
97 .error_union => |info| info.payload,
98 };
99 return if (@hasDecl(Container, @tagName(zon_value))) @field(Container, @tagName(zon_value)) else zon_value;
100 },
101 else => @compileError(std.fmt.comptimePrint("unsupported zon type: {} <- {any}", .{ Result, zon_value })),
102 }
103}
104
105const matchers = matchers: {
106 const instructions = @import("instructions.zon");
107 var mut_matchers: [instructions.len]*const fn (as: *Assemble) error{InvalidSyntax}!?Instruction = undefined;
108 for (instructions, &mut_matchers) |instruction, *matcher| matcher.* = struct {
109 fn match(as: *Assemble) !?Instruction {
110 comptime for (@typeInfo(@TypeOf(instruction)).@"struct".field_names) |field_name| {
111 if (std.mem.eql(u8, field_name, "requires")) continue;
112 if (std.mem.eql(u8, field_name, "pattern")) continue;
113 if (std.mem.eql(u8, field_name, "symbols")) continue;
114 if (std.mem.eql(u8, field_name, "encode")) continue;
115 @compileError("unexpected field '" ++ field_name ++ "'");
116 };
117 if (@hasField(@TypeOf(instruction), "requires")) _ = zonCast(
118 []const std.Target.aarch64.Feature,
119 instruction.requires,
120 .{},
121 );
122 var symbols: Symbols: {
123 const symbol_names = @typeInfo(@TypeOf(instruction.symbols)).@"struct".field_names;
124 var field_names: [symbol_names.len][]const u8 = undefined;
125 var field_types: [symbol_names.len]type = undefined;
126 for (symbol_names, &field_names, &field_types) |symbol_name, *field_name, *FieldType| {
127 field_name.* = symbol_name;
128 FieldType.* = zonCast(SymbolSpec, @field(instruction.symbols, symbol_name), .{}).Storage();
129 }
130 break :Symbols @Struct(.auto, null, &field_names, &field_types, &@splat(.{}));
131 } = undefined;
132 const Symbol = std.meta.FieldEnum(@TypeOf(instruction.symbols));
133 comptime var unused_symbols: std.enums.EnumSet(Symbol) = .full;
134 comptime var pattern_as: Assemble = .{ .source = instruction.pattern, .operands = undefined };
135 inline while (true) {
136 comptime var ct_token_buf: [token_buf_len]u8 = undefined;
137 var token_buf: [token_buf_len]u8 = undefined;
138 const pattern_token = comptime pattern_as.nextToken(&ct_token_buf, .{ .placeholders = true }) catch |err|
139 @compileError(@errorName(err) ++ " while parsing '" ++ instruction.pattern ++ "'");
140 const source_token = try as.nextToken(&token_buf, .{ .operands = true });
141 log.debug("\"{f}\" -> \"{f}\"", .{
142 std.zig.fmtString(pattern_token),
143 std.zig.fmtString(source_token),
144 });
145 if (pattern_token.len == 0) {
146 comptime var unused_symbol_it = unused_symbols.iterator();
147 inline while (comptime unused_symbol_it.next()) |unused_symbol|
148 @compileError(@tagName(unused_symbol) ++ " unused while parsing '" ++ instruction.pattern ++ "'");
149 switch (source_token.len) {
150 0 => {},
151 else => switch (source_token[0]) {
152 else => {
153 log.debug("'{s}' not matched...", .{instruction.pattern});
154 return null;
155 },
156 '\n', ';' => {},
157 },
158 }
159 const encode = @field(Instruction, @tagName(instruction.encode[0]));
160 const Encode = @TypeOf(encode);
161 var args: std.meta.ArgsTuple(Encode) = undefined;
162 inline for (&args, @typeInfo(Encode).@"fn".param_types, 1..instruction.encode.len) |*arg, param_type, encode_index|
163 arg.* = zonCast(param_type.?, instruction.encode[encode_index], symbols);
164 return @call(.auto, encode, args);
165 } else if (pattern_token[0] == '<') {
166 const symbol_name = comptime pattern_token[1 .. std.mem.findScalarPos(u8, pattern_token, 1, '|') orelse
167 pattern_token.len - 1];
168 const symbol = @field(Symbol, symbol_name);
169 const symbol_ptr = &@field(symbols, symbol_name);
170 const symbol_value = zonCast(SymbolSpec, @field(instruction.symbols, symbol_name), .{}).parse(source_token) orelse {
171 log.debug("'{s}' not matched...", .{instruction.pattern});
172 return null;
173 };
174 if (comptime unused_symbols.contains(symbol)) {
175 log.debug("{s} = {any}", .{ symbol_name, symbol_value });
176 symbol_ptr.* = symbol_value;
177 comptime unused_symbols.remove(symbol);
178 } else if (symbol_ptr.* != symbol_value) {
179 log.debug("'{s}' not matched...", .{instruction.pattern});
180 return null;
181 }
182 } else if (!toUpperEqlAssertUpper(source_token, pattern_token)) {
183 log.debug("'{s}' not matched...", .{instruction.pattern});
184 return null;
185 }
186 }
187 }
188 }.match;
189 break :matchers mut_matchers;
190};
191
192fn toUpperEqlAssertUpper(lhs: []const u8, rhs: []const u8) bool {
193 if (lhs.len != rhs.len) return false;
194 for (lhs, rhs) |l, r| {
195 assert(!std.ascii.isLower(r));
196 if (std.ascii.toUpper(l) != r) return false;
197 }
198 return true;
199}
200
201const token_buf_len = "v31.b[15]".len;
202fn nextToken(as: *Assemble, buf: *[token_buf_len]u8, comptime opts: struct {
203 operands: bool = false,
204 placeholders: bool = false,
205}) ![]const u8 {
206 const invalid_syntax: u8 = 1;
207 while (true) c: switch (as.source[0]) {
208 0 => return as.source[0..0],
209 '\t', '\n' + 1...'\r', ' ' => as.source = as.source[1..],
210 '\n', '!', '#', ',', ';', '[', ']' => {
211 defer as.source = as.source[1..];
212 return as.source[0..1];
213 },
214 '%' => if (opts.operands) {
215 if (as.source[1] != '[') continue :c invalid_syntax;
216 const name_start: usize = 2;
217 var index = name_start;
218 while (switch (as.source[index]) {
219 else => true,
220 ':', ']' => false,
221 }) index += 1;
222 const operand = as.operands.get(as.source[name_start..index]) orelse continue :c invalid_syntax;
223 const modifier = modifier: switch (as.source[index]) {
224 else => unreachable,
225 ':' => {
226 index += 1;
227 const modifier_start = index;
228 while (switch (as.source[index]) {
229 else => true,
230 ']' => false,
231 }) index += 1;
232 break :modifier as.source[modifier_start..index];
233 },
234 ']' => "",
235 };
236 assert(as.source[index] == ']');
237 const modified_operand: Operand = if (std.mem.eql(u8, modifier, ""))
238 operand
239 else if (std.mem.eql(u8, modifier, "w")) switch (operand) {
240 .register => |reg| .{ .register = reg.alias.w() },
241 } else if (std.mem.eql(u8, modifier, "x")) switch (operand) {
242 .register => |reg| .{ .register = reg.alias.x() },
243 } else if (std.mem.eql(u8, modifier, "b")) switch (operand) {
244 .register => |reg| .{ .register = reg.alias.b() },
245 } else if (std.mem.eql(u8, modifier, "h")) switch (operand) {
246 .register => |reg| .{ .register = reg.alias.h() },
247 } else if (std.mem.eql(u8, modifier, "s")) switch (operand) {
248 .register => |reg| .{ .register = reg.alias.s() },
249 } else if (std.mem.eql(u8, modifier, "d")) switch (operand) {
250 .register => |reg| .{ .register = reg.alias.d() },
251 } else if (std.mem.eql(u8, modifier, "q")) switch (operand) {
252 .register => |reg| .{ .register = reg.alias.q() },
253 } else if (std.mem.eql(u8, modifier, "Z")) switch (operand) {
254 .register => |reg| .{ .register = reg.alias.z() },
255 } else continue :c invalid_syntax;
256 switch (modified_operand) {
257 .register => |reg| {
258 as.source = as.source[index + 1 ..];
259 return std.mem.print(buf, "{f}", .{reg.fmt()}) catch unreachable;
260 },
261 }
262 } else continue :c invalid_syntax,
263 '+', '-', '.', '0'...'9', 'A'...'Z', '_', 'a'...'z' => {
264 var index: usize = 1;
265 while (more: switch (as.source[index]) {
266 '0'...'9' => true,
267 'A'...'Z', '_', 'a'...'z' => switch (as.source[0]) {
268 else => true,
269 '.' => {
270 index = 1;
271 break :more false;
272 },
273 },
274 '.' => switch (as.source[0]) {
275 else => unreachable,
276 '+', '-', '.', '0'...'9' => true,
277 'A'...'Z', '_', 'a'...'z' => false,
278 },
279 else => false,
280 }) index += 1;
281 defer as.source = as.source[index..];
282 return as.source[0..index];
283 },
284 '<' => if (opts.placeholders) {
285 var index: usize = 1;
286 while (switch (as.source[index]) {
287 0 => return error.UnterminatedPlaceholder,
288 '>' => false,
289 else => true,
290 }) index += 1;
291 defer as.source = as.source[index + 1 ..];
292 return as.source[0 .. index + 1];
293 } else continue :c invalid_syntax,
294 else => {
295 if (!@inComptime()) log.debug("invalid token \"{f}\"", .{std.zig.fmtString(std.mem.span(as.source))});
296 return error.InvalidSyntax;
297 },
298 };
299}
300
301const SymbolSpec = union(enum) {
302 reg_alias: aarch64.encoding.Register.Format.Alias,
303 reg: struct { format: aarch64.encoding.Register.Format, allow_sp: bool = false },
304 arrangement: struct {
305 elem_size: ?Instruction.DataProcessingVector.Size = null,
306 allow_double: bool = true,
307 min_valid_len: comptime_int = 0,
308 },
309 systemreg,
310 imm: struct {
311 type: std.lang.Type.Int,
312 multiple_of: ?comptime_int = null,
313 min_valid: ?comptime_int = null,
314 max_valid: ?comptime_int = null,
315 adjust: enum { none, neg_wrap, dec } = .none,
316 },
317 fimm: struct { only_valid: ?f16 = null },
318 extend: struct { size: ?aarch64.encoding.Register.GeneralSize = null },
319 shift: struct { allow_ror: bool = true },
320 barrier: struct { only_sy: bool = false },
321
322 fn Storage(comptime spec: SymbolSpec) type {
323 return switch (spec) {
324 .reg_alias => aarch64.encoding.Register.Alias,
325 .reg => aarch64.encoding.Register,
326 .arrangement => aarch64.encoding.Register.Arrangement,
327 .systemreg => aarch64.encoding.Register.System,
328 .imm => |imm_spec| @Int(imm_spec.type.signedness, imm_spec.type.bits),
329 .fimm => f16,
330 .extend => Instruction.DataProcessingRegister.AddSubtractExtendedRegister.Option,
331 .shift => Instruction.DataProcessingRegister.Shift.Op,
332 .barrier => Instruction.BranchExceptionGeneratingSystem.Barriers.Option,
333 };
334 }
335
336 fn parse(comptime spec: SymbolSpec, token: []const u8) ?Storage(spec) {
337 const Result = Storage(spec);
338 switch (spec) {
339 .reg_alias => |reg_alias_spec| {
340 const reg = aarch64.encoding.Register.parse(token) orelse {
341 log.debug("invalid register: \"{f}\"", .{std.zig.fmtString(token)});
342 return null;
343 };
344 if (reg.format != .alias or reg.format.alias != reg_alias_spec) {
345 log.debug("invalid register size: \"{f}\"", .{std.zig.fmtString(token)});
346 return null;
347 }
348 return reg.alias;
349 },
350 .reg => |reg_spec| {
351 const reg = Result.parse(token) orelse {
352 log.debug("invalid register: \"{f}\"", .{std.zig.fmtString(token)});
353 return null;
354 };
355 if (switch (reg_spec.format) {
356 .alias, .vector, .element, .scalable => comptime unreachable,
357 .general => |general_spec| reg.format != .general or reg.format.general != general_spec,
358 .scalar => |scalar_spec| reg.format != .scalar or reg.format.scalar != scalar_spec,
359 }) {
360 log.debug("invalid register size: \"{f}\"", .{std.zig.fmtString(token)});
361 return null;
362 }
363 if (reg.alias == if (reg_spec.allow_sp) .zr else .sp) {
364 log.debug("invalid register usage: \"{f}\"", .{std.zig.fmtString(token)});
365 return null;
366 }
367 return reg;
368 },
369 .arrangement => |arrangement_spec| {
370 var buf: [
371 max_len: {
372 var max_len = 0;
373 for (@typeInfo(Result).@"enum".field_names) |field_name| max_len = @max(max_len, field_name.len);
374 break :max_len max_len;
375 } + 1
376 ]u8 = undefined;
377 const arrangement = std.meta.stringToEnum(Result, std.ascii.lowerString(
378 &buf,
379 token[0..@min(token.len, buf.len)],
380 )) orelse {
381 log.debug("invalid arrangement: \"{f}\"", .{std.zig.fmtString(token)});
382 return null;
383 };
384 if (arrangement_spec.elem_size) |elem_size| if (arrangement.elemSize() != elem_size) {
385 log.debug("invalid arrangement: \"{f}\"", .{std.zig.fmtString(token)});
386 return null;
387 };
388 if (!arrangement_spec.allow_double and arrangement.elemSize() == .double) {
389 log.debug("invalid arrangement: \"{f}\"", .{std.zig.fmtString(token)});
390 return null;
391 }
392 if (arrangement.len() < arrangement_spec.min_valid_len) {
393 log.debug("invalid arrangement: \"{f}\"", .{std.zig.fmtString(token)});
394 return null;
395 }
396 return arrangement;
397 },
398 .systemreg => {
399 const systemreg = Result.parse(token) orelse {
400 log.debug("invalid system register: \"{f}\"", .{std.zig.fmtString(token)});
401 return null;
402 };
403 assert(systemreg.op0 >= 2);
404 return systemreg;
405 },
406 .imm => |imm_spec| {
407 const imm = std.fmt.parseInt(@Int(
408 imm_spec.type.signedness,
409 switch (imm_spec.adjust) {
410 .none, .neg_wrap => imm_spec.type.bits,
411 .dec => imm_spec.type.bits + 1,
412 },
413 ), token, 0) catch {
414 log.debug("invalid immediate: \"{f}\"", .{std.zig.fmtString(token)});
415 return null;
416 };
417 if (imm_spec.multiple_of) |multiple_of| if (@rem(imm, multiple_of) != 0) {
418 log.debug("invalid immediate usage: \"{f}\"", .{std.zig.fmtString(token)});
419 return null;
420 };
421 if (imm_spec.min_valid) |min_valid| if (imm < min_valid) {
422 log.debug("out of range immediate: \"{f}\"", .{std.zig.fmtString(token)});
423 return null;
424 };
425 if (imm_spec.max_valid) |max_valid| if (imm > max_valid) {
426 log.debug("out of range immediate: \"{f}\"", .{std.zig.fmtString(token)});
427 return null;
428 };
429 return switch (imm_spec.adjust) {
430 .none => imm,
431 .neg_wrap => -%imm,
432 .dec => std.math.cast(Result, imm - 1) orelse {
433 log.debug("out of range immediate: \"{f}\"", .{std.zig.fmtString(token)});
434 return null;
435 },
436 };
437 },
438 .fimm => |fimm_spec| {
439 const full_fimm = std.fmt.parseFloat(f128, token) catch {
440 log.debug("invalid immediate: \"{f}\"", .{std.zig.fmtString(token)});
441 return null;
442 };
443 const fimm: f16 = @floatCast(full_fimm);
444 if (fimm != full_fimm) {
445 log.debug("out of range immediate: \"{f}\"", .{std.zig.fmtString(token)});
446 return null;
447 }
448 if (fimm_spec.only_valid) |only_valid| {
449 if (@as(u16, @bitCast(fimm)) != @as(u16, @bitCast(only_valid))) {
450 log.debug("out of range immediate: \"{f}\"", .{std.zig.fmtString(token)});
451 return null;
452 }
453 } else {
454 const Repr = std.math.FloatRepr(f16);
455 const repr: Repr = @bitCast(fimm);
456 if (repr.mantissa & std.math.maxInt(Repr.Mantissa) >> 5 != 0 or switch (repr.exponent) {
457 .denormal, .infinite => true,
458 else => std.math.cast(i3, repr.exponent.unbias() - 1) == null,
459 }) {
460 log.debug("out of range immediate: \"{f}\"", .{std.zig.fmtString(token)});
461 return null;
462 }
463 }
464 return fimm;
465 },
466 .extend => |extend_spec| {
467 var buf: [
468 max_len: {
469 var max_len = 0;
470 for (@typeInfo(Result).@"enum".field_names) |field_name| max_len = @max(max_len, field_name.len);
471 break :max_len max_len;
472 } + 1
473 ]u8 = undefined;
474 const extend = std.meta.stringToEnum(Result, std.ascii.lowerString(
475 &buf,
476 token[0..@min(token.len, buf.len)],
477 )) orelse {
478 log.debug("invalid extend: \"{f}\"", .{std.zig.fmtString(token)});
479 return null;
480 };
481 if (extend_spec.size) |size| if (extend.sf() != size) {
482 log.debug("invalid extend: \"{f}\"", .{std.zig.fmtString(token)});
483 return null;
484 };
485 return extend;
486 },
487 .shift => |shift_spec| {
488 var buf: [
489 max_len: {
490 var max_len = 0;
491 for (@typeInfo(Result).@"enum".field_names) |field_name| max_len = @max(max_len, field_name.len);
492 break :max_len max_len;
493 } + 1
494 ]u8 = undefined;
495 const shift = std.meta.stringToEnum(Result, std.ascii.lowerString(
496 &buf,
497 token[0..@min(token.len, buf.len)],
498 )) orelse {
499 log.debug("invalid shift: \"{f}\"", .{std.zig.fmtString(token)});
500 return null;
501 };
502 if (!shift_spec.allow_ror and shift == .ror) {
503 log.debug("invalid shift usage: \"{f}\"", .{std.zig.fmtString(token)});
504 return null;
505 }
506 return shift;
507 },
508 .barrier => |barrier_spec| {
509 var buf: [
510 max_len: {
511 var max_len = 0;
512 for (@typeInfo(Result).@"enum".field_names) |field_name| max_len = @max(max_len, field_name.len);
513 break :max_len max_len;
514 } + 1
515 ]u8 = undefined;
516 const barrier = std.meta.stringToEnum(Result, std.ascii.lowerString(
517 &buf,
518 token[0..@min(token.len, buf.len)],
519 )) orelse {
520 log.debug("invalid barrier: \"{f}\"", .{std.zig.fmtString(token)});
521 return null;
522 };
523 if (barrier_spec.only_sy and barrier != .sy) {
524 log.debug("invalid barrier: \"{f}\"", .{std.zig.fmtString(token)});
525 return null;
526 }
527 return barrier;
528 },
529 }
530 }
531};
532
533test "add sub" {
534 var as: Assemble = .{
535 .source =
536 \\ adc w0, w0, w1
537 \\ adc w2, w3, w4
538 \\ adc w5, w5, wzr
539 \\ adc w6, w7, wzr
540 \\
541 \\ adcs w0, w0, w1
542 \\ adcs w2, w3, w4
543 \\ adcs w5, w5, wzr
544 \\ adcs w6, w7, wzr
545 \\
546 \\ add w0, w0, w1
547 \\ add w2, w3, w4
548 \\ add wsp, w5, w6
549 \\ add w7, wsp, w8
550 \\ add wsp, wsp, w9
551 \\ add w10, w10, wzr
552 \\ add w11, w12, wzr
553 \\ add wsp, w13, wzr
554 \\ add w14, wsp, wzr
555 \\ add wsp, wsp, wzr
556 \\
557 \\ add x0, x0, x1
558 \\ add x2, x3, x4
559 \\ add sp, x5, x6
560 \\ add x7, sp, x8
561 \\ add sp, sp, x9
562 \\ add x10, x10, xzr
563 \\ add x11, x12, xzr
564 \\ add sp, x13, xzr
565 \\ add x14, sp, xzr
566 \\ add sp, sp, xzr
567 \\
568 \\ add w0, w0, w1
569 \\ add w2, w3, w4, uxtb #0
570 \\ add wsp, w5, w6, uxth #1
571 \\ add w7, wsp, w8, uxtw #2
572 \\ add wsp, wsp, w9, uxtx #0
573 \\ add w10, w10, wzr, uxtx #3
574 \\ add w11, w12, wzr, sxtb #4
575 \\ add wsp, w13, wzr, sxth #0
576 \\ add w14, wsp, wzr, sxtw #1
577 \\ add wsp, wsp, wzr, sxtx #2
578 \\
579 \\ add x0, x0, x1
580 \\ add x2, x3, w4, uxtb #0
581 \\ add sp, x5, w6, uxth #1
582 \\ add x7, sp, w8, uxtw #2
583 \\ add sp, sp, x9, uxtx #0
584 \\ add x10, x10, xzr, uxtx #3
585 \\ add x11, x12, wzr, sxtb #4
586 \\ add sp, x13, wzr, sxth #0
587 \\ add x14, sp, wzr, sxtw #1
588 \\ add sp, sp, xzr, sxtx #2
589 \\
590 \\ add w0, w0, #0
591 \\ add w0, w1, #1, lsl #0
592 \\ add wsp, w2, #2, lsl #12
593 \\ add w3, wsp, #3, lsl #0
594 \\ add wsp, wsp, #4095, lsl #12
595 \\ add w0, w1, #0
596 \\ add w2, w3, #0, lsl #0
597 \\ add w4, wsp, #0
598 \\ add w5, wsp, #0, lsl #0
599 \\ add wsp, w6, #0
600 \\ add wsp, w7, #0, lsl #0
601 \\ add wsp, wsp, #0
602 \\ add wsp, wsp, #0, lsl #0
603 \\
604 \\ add x0, x0, #0
605 \\ add x0, x1, #1, lsl #0
606 \\ add sp, x2, #2, lsl #12
607 \\ add x3, sp, #3, lsl #0
608 \\ add sp, sp, #4095, lsl #12
609 \\ add x0, x1, #0
610 \\ add x2, x3, #0, lsl #0
611 \\ add x4, sp, #0
612 \\ add x5, sp, #0, lsl #0
613 \\ add sp, x6, #0
614 \\ add sp, x7, #0, lsl #0
615 \\ add sp, sp, #0
616 \\ add sp, sp, #0, lsl #0
617 \\
618 \\ add w0, w0, w0
619 \\ add w1, w1, w2, lsl #0
620 \\ add w3, w4, w5, lsl #1
621 \\ add w6, w6, wzr, lsl #31
622 \\ add w7, wzr, w8, lsr #0
623 \\ add w9, wzr, wzr, lsr #30
624 \\ add wzr, w10, w11, lsr #31
625 \\ add wzr, w12, wzr, asr #0x0
626 \\ add wzr, wzr, w13, asr #0x10
627 \\ add wzr, wzr, wzr, asr #0x1f
628 \\
629 \\ add x0, x0, x0
630 \\ add x1, x1, x2, lsl #0
631 \\ add x3, x4, x5, lsl #1
632 \\ add x6, x6, xzr, lsl #63
633 \\ add x7, xzr, x8, lsr #0
634 \\ add x9, xzr, xzr, lsr #62
635 \\ add xzr, x10, x11, lsr #63
636 \\ add xzr, x12, xzr, asr #0x0
637 \\ add xzr, xzr, x13, asr #0x1F
638 \\ add xzr, xzr, xzr, asr #0x3f
639 \\
640 \\ addg x0, sp, #0, #0xf
641 \\ addg sp, x1, #0x3f0, #0
642 \\
643 \\ adds w0, w0, w1
644 \\ adds w2, w3, w4
645 \\ adds w5, w5, w6
646 \\ adds w7, wsp, w8
647 \\ adds w9, wsp, w9
648 \\ adds w10, w10, wzr
649 \\ adds w11, w12, wzr
650 \\ adds wzr, w13, wzr
651 \\ adds w14, wsp, wzr
652 \\ adds wzr, wsp, wzr
653 \\
654 \\ adds x0, x0, x1
655 \\ adds x2, x3, x4
656 \\ adds x5, x5, x6
657 \\ adds x7, sp, x8
658 \\ adds x9, sp, x9
659 \\ adds x10, x10, xzr
660 \\ adds x11, x12, xzr
661 \\ adds xzr, x13, xzr
662 \\ adds x14, sp, xzr
663 \\ adds xzr, sp, xzr
664 \\
665 \\ adds w0, w0, w1
666 \\ adds w2, w3, w4, uxtb #0
667 \\ adds wzr, w5, w6, uxth #1
668 \\ adds w7, wsp, w8, uxtw #2
669 \\ adds w9, wsp, w9, uxtx #0
670 \\ adds w10, w10, wzr, uxtx #3
671 \\ adds w11, w12, wzr, sxtb #4
672 \\ adds wzr, w13, wzr, sxth #0
673 \\ adds w14, wsp, wzr, sxtw #1
674 \\ adds wzr, wsp, wzr, sxtx #2
675 \\
676 \\ adds x0, x0, x1
677 \\ adds x2, x3, w4, uxtb #0
678 \\ adds xzr, x5, w6, uxth #1
679 \\ adds x7, sp, w8, uxtw #2
680 \\ adds xzr, sp, x9, uxtx #0
681 \\ adds x10, x10, xzr, uxtx #3
682 \\ adds x11, x12, wzr, sxtb #4
683 \\ adds xzr, x13, wzr, sxth #0
684 \\ adds x14, sp, wzr, sxtw #1
685 \\ adds xzr, sp, xzr, sxtx #2
686 \\
687 \\ adds w0, w0, #0
688 \\ adds w0, w1, #1, lsl #0
689 \\ adds wzr, w2, #2, lsl #12
690 \\ adds w3, wsp, #3, lsl #0
691 \\ adds wzr, wsp, #4095, lsl #12
692 \\ adds w0, w1, #0
693 \\ adds w2, w3, #0, lsl #0
694 \\ adds w4, wsp, #0
695 \\ adds w5, wsp, #0, lsl #0
696 \\ adds wzr, w6, #0
697 \\ adds wzr, w7, #0, lsl #0
698 \\ adds wzr, wsp, #0
699 \\ adds wzr, wsp, #0, lsl #0
700 \\
701 \\ adds x0, x0, #0
702 \\ adds x0, x1, #1, lsl #0
703 \\ adds xzr, x2, #2, lsl #12
704 \\ adds x3, sp, #3, lsl #0
705 \\ adds xzr, sp, #4095, lsl #12
706 \\ adds x0, x1, #0
707 \\ adds x2, x3, #0, lsl #0
708 \\ adds x4, sp, #0
709 \\ adds x5, sp, #0, lsl #0
710 \\ adds xzr, x6, #0
711 \\ adds xzr, x7, #0, lsl #0
712 \\ adds xzr, sp, #0
713 \\ adds xzr, sp, #0, lsl #0
714 \\
715 \\ adds w0, w0, w0
716 \\ adds w1, w1, w2, lsl #0
717 \\ adds w3, w4, w5, lsl #1
718 \\ adds w6, w6, wzr, lsl #31
719 \\ adds w7, wzr, w8, lsr #0
720 \\ adds w9, wzr, wzr, lsr #30
721 \\ adds wzr, w10, w11, lsr #31
722 \\ adds wzr, w12, wzr, asr #0x0
723 \\ adds wzr, wzr, w13, asr #0x10
724 \\ adds wzr, wzr, wzr, asr #0x1f
725 \\
726 \\ adds x0, x0, x0
727 \\ adds x1, x1, x2, lsl #0
728 \\ adds x3, x4, x5, lsl #1
729 \\ adds x6, x6, xzr, lsl #63
730 \\ adds x7, xzr, x8, lsr #0
731 \\ adds x9, xzr, xzr, lsr #62
732 \\ adds xzr, x10, x11, lsr #63
733 \\ adds xzr, x12, xzr, asr #0x0
734 \\ adds xzr, xzr, x13, asr #0x1F
735 \\ adds xzr, xzr, xzr, asr #0x3f
736 \\
737 \\ neg w0, w0
738 \\ neg w1, w2, lsl #0
739 \\ neg w3, wzr, lsl #7
740 \\ neg wzr, w4, lsr #14
741 \\ neg wzr, wzr, asr #21
742 \\
743 \\ neg x0, x0
744 \\ neg x1, x2, lsl #0
745 \\ neg x3, xzr, lsl #11
746 \\ neg xzr, x4, lsr #22
747 \\ neg xzr, xzr, asr #33
748 \\
749 \\ sbc w0, w0, w1
750 \\ sbc w2, w3, w4
751 \\ sbc w5, w5, wzr
752 \\ sbc w6, w7, wzr
753 \\
754 \\ sbcs w0, w0, w1
755 \\ sbcs w2, w3, w4
756 \\ sbcs w5, w5, wzr
757 \\ sbcs w6, w7, wzr
758 \\
759 \\ sub w0, w0, w1
760 \\ sub w2, w3, w4
761 \\ sub wsp, w5, w6
762 \\ sub w7, wsp, w8
763 \\ sub wsp, wsp, w9
764 \\ sub w10, w10, wzr
765 \\ sub w11, w12, wzr
766 \\ sub wsp, w13, wzr
767 \\ sub w14, wsp, wzr
768 \\ sub wsp, wsp, wzr
769 \\
770 \\ sub x0, x0, x1
771 \\ sub x2, x3, x4
772 \\ sub sp, x5, x6
773 \\ sub x7, sp, x8
774 \\ sub sp, sp, x9
775 \\ sub x10, x10, xzr
776 \\ sub x11, x12, xzr
777 \\ sub sp, x13, xzr
778 \\ sub x14, sp, xzr
779 \\ sub sp, sp, xzr
780 \\
781 \\ sub w0, w0, w1
782 \\ sub w2, w3, w4, uxtb #0
783 \\ sub wsp, w5, w6, uxth #1
784 \\ sub w7, wsp, w8, uxtw #2
785 \\ sub wsp, wsp, w9, uxtx #0
786 \\ sub w10, w10, wzr, uxtx #3
787 \\ sub w11, w12, wzr, sxtb #4
788 \\ sub wsp, w13, wzr, sxth #0
789 \\ sub w14, wsp, wzr, sxtw #1
790 \\ sub wsp, wsp, wzr, sxtx #2
791 \\
792 \\ sub x0, x0, x1
793 \\ sub x2, x3, w4, uxtb #0
794 \\ sub sp, x5, w6, uxth #1
795 \\ sub x7, sp, w8, uxtw #2
796 \\ sub sp, sp, x9, uxtx #0
797 \\ sub x10, x10, xzr, uxtx #3
798 \\ sub x11, x12, wzr, sxtb #4
799 \\ sub sp, x13, wzr, sxth #0
800 \\ sub x14, sp, wzr, sxtw #1
801 \\ sub sp, sp, xzr, sxtx #2
802 \\
803 \\ sub w0, w0, #0
804 \\ sub w0, w1, #1, lsl #0
805 \\ sub wsp, w2, #2, lsl #12
806 \\ sub w3, wsp, #3, lsl #0
807 \\ sub wsp, wsp, #4095, lsl #12
808 \\ sub w0, w1, #0
809 \\ sub w2, w3, #0, lsl #0
810 \\ sub w4, wsp, #0
811 \\ sub w5, wsp, #0, lsl #0
812 \\ sub wsp, w6, #0
813 \\ sub wsp, w7, #0, lsl #0
814 \\ sub wsp, wsp, #0
815 \\ sub wsp, wsp, #0, lsl #0
816 \\
817 \\ sub x0, x0, #0
818 \\ sub x0, x1, #1, lsl #0
819 \\ sub sp, x2, #2, lsl #12
820 \\ sub x3, sp, #3, lsl #0
821 \\ sub sp, sp, #4095, lsl #12
822 \\ sub x0, x1, #0
823 \\ sub x2, x3, #0, lsl #0
824 \\ sub x4, sp, #0
825 \\ sub x5, sp, #0, lsl #0
826 \\ sub sp, x6, #0
827 \\ sub sp, x7, #0, lsl #0
828 \\ sub sp, sp, #0
829 \\ sub sp, sp, #0, lsl #0
830 \\
831 \\ sub w0, w0, w0
832 \\ sub w1, w1, w2, lsl #0
833 \\ sub w3, w4, w5, lsl #1
834 \\ sub w6, w6, wzr, lsl #31
835 \\ sub w7, wzr, w8, lsr #0
836 \\ sub w9, wzr, wzr, lsr #30
837 \\ sub wzr, w10, w11, lsr #31
838 \\ sub wzr, w12, wzr, asr #0x0
839 \\ sub wzr, wzr, w13, asr #0x10
840 \\ sub wzr, wzr, wzr, asr #0x1f
841 \\
842 \\ sub x0, x0, x0
843 \\ sub x1, x1, x2, lsl #0
844 \\ sub x3, x4, x5, lsl #1
845 \\ sub x6, x6, xzr, lsl #63
846 \\ sub x7, xzr, x8, lsr #0
847 \\ sub x9, xzr, xzr, lsr #62
848 \\ sub xzr, x10, x11, lsr #63
849 \\ sub xzr, x12, xzr, asr #0x0
850 \\ sub xzr, xzr, x13, asr #0x1F
851 \\ sub xzr, xzr, xzr, asr #0x3f
852 \\
853 \\ subg x0, sp, #0, #0xf
854 \\ subg sp, x1, #0x3f0, #0
855 \\
856 \\ subs w0, w0, w1
857 \\ subs w2, w3, w4
858 \\ subs w5, w5, w6
859 \\ subs w7, wsp, w8
860 \\ subs w9, wsp, w9
861 \\ subs w10, w10, wzr
862 \\ subs w11, w12, wzr
863 \\ subs wzr, w13, wzr
864 \\ subs w14, wsp, wzr
865 \\ subs wzr, wsp, wzr
866 \\
867 \\ subs x0, x0, x1
868 \\ subs x2, x3, x4
869 \\ subs x5, x5, x6
870 \\ subs x7, sp, x8
871 \\ subs x9, sp, x9
872 \\ subs x10, x10, xzr
873 \\ subs x11, x12, xzr
874 \\ subs xzr, x13, xzr
875 \\ subs x14, sp, xzr
876 \\ subs xzr, sp, xzr
877 \\
878 \\ subs w0, w0, w1
879 \\ subs w2, w3, w4, uxtb #0
880 \\ subs wzr, w5, w6, uxth #1
881 \\ subs w7, wsp, w8, uxtw #2
882 \\ subs w9, wsp, w9, uxtx #0
883 \\ subs w10, w10, wzr, uxtx #3
884 \\ subs w11, w12, wzr, sxtb #4
885 \\ subs wzr, w13, wzr, sxth #0
886 \\ subs w14, wsp, wzr, sxtw #1
887 \\ subs wzr, wsp, wzr, sxtx #2
888 \\
889 \\ subs x0, x0, x1
890 \\ subs x2, x3, w4, uxtb #0
891 \\ subs xzr, x5, w6, uxth #1
892 \\ subs x7, sp, w8, uxtw #2
893 \\ subs xzr, sp, x9, uxtx #0
894 \\ subs x10, x10, xzr, uxtx #3
895 \\ subs x11, x12, wzr, sxtb #4
896 \\ subs xzr, x13, wzr, sxth #0
897 \\ subs x14, sp, wzr, sxtw #1
898 \\ subs xzr, sp, xzr, sxtx #2
899 \\
900 \\ subs w0, w0, #0
901 \\ subs w0, w1, #1, lsl #0
902 \\ subs wzr, w2, #2, lsl #12
903 \\ subs w3, wsp, #3, lsl #0
904 \\ subs wzr, wsp, #4095, lsl #12
905 \\ subs w0, w1, #0
906 \\ subs w2, w3, #0, lsl #0
907 \\ subs w4, wsp, #0
908 \\ subs w5, wsp, #0, lsl #0
909 \\ subs wzr, w6, #0
910 \\ subs wzr, w7, #0, lsl #0
911 \\ subs wzr, wsp, #0
912 \\ subs wzr, wsp, #0, lsl #0
913 \\
914 \\ subs x0, x0, #0
915 \\ subs x0, x1, #1, lsl #0
916 \\ subs xzr, x2, #2, lsl #12
917 \\ subs x3, sp, #3, lsl #0
918 \\ subs xzr, sp, #4095, lsl #12
919 \\ subs x0, x1, #0
920 \\ subs x2, x3, #0, lsl #0
921 \\ subs x4, sp, #0
922 \\ subs x5, sp, #0, lsl #0
923 \\ subs xzr, x6, #0
924 \\ subs xzr, x7, #0, lsl #0
925 \\ subs xzr, sp, #0
926 \\ subs xzr, sp, #0, lsl #0
927 \\
928 \\ subs w0, w0, w0
929 \\ subs w1, w1, w2, lsl #0
930 \\ subs w3, w4, w5, lsl #1
931 \\ subs w6, w6, wzr, lsl #31
932 \\ subs w7, wzr, w8, lsr #0
933 \\ subs w9, wzr, wzr, lsr #30
934 \\ subs wzr, w10, w11, lsr #31
935 \\ subs wzr, w12, wzr, asr #0x0
936 \\ subs wzr, wzr, w13, asr #0x10
937 \\ subs wzr, wzr, wzr, asr #0x1f
938 \\
939 \\ subs x0, x0, x0
940 \\ subs x1, x1, x2, lsl #0
941 \\ subs x3, x4, x5, lsl #1
942 \\ subs x6, x6, xzr, lsl #63
943 \\ subs x7, xzr, x8, lsr #0
944 \\ subs x9, xzr, xzr, lsr #62
945 \\ subs xzr, x10, x11, lsr #63
946 \\ subs xzr, x12, xzr, asr #0x0
947 \\ subs xzr, xzr, x13, asr #0x1F
948 \\ subs xzr, xzr, xzr, asr #0x3f
949 ,
950 .operands = .empty,
951 };
952
953 try std.testing.expectFmt("adc w0, w0, w1", "{f}", .{(try as.nextInstruction()).?});
954 try std.testing.expectFmt("adc w2, w3, w4", "{f}", .{(try as.nextInstruction()).?});
955 try std.testing.expectFmt("adc w5, w5, wzr", "{f}", .{(try as.nextInstruction()).?});
956 try std.testing.expectFmt("adc w6, w7, wzr", "{f}", .{(try as.nextInstruction()).?});
957
958 try std.testing.expectFmt("adcs w0, w0, w1", "{f}", .{(try as.nextInstruction()).?});
959 try std.testing.expectFmt("adcs w2, w3, w4", "{f}", .{(try as.nextInstruction()).?});
960 try std.testing.expectFmt("adcs w5, w5, wzr", "{f}", .{(try as.nextInstruction()).?});
961 try std.testing.expectFmt("adcs w6, w7, wzr", "{f}", .{(try as.nextInstruction()).?});
962
963 try std.testing.expectFmt("add w0, w0, w1", "{f}", .{(try as.nextInstruction()).?});
964 try std.testing.expectFmt("add w2, w3, w4", "{f}", .{(try as.nextInstruction()).?});
965 try std.testing.expectFmt("add wsp, w5, w6", "{f}", .{(try as.nextInstruction()).?});
966 try std.testing.expectFmt("add w7, wsp, w8", "{f}", .{(try as.nextInstruction()).?});
967 try std.testing.expectFmt("add wsp, wsp, w9", "{f}", .{(try as.nextInstruction()).?});
968 try std.testing.expectFmt("add w10, w10, wzr", "{f}", .{(try as.nextInstruction()).?});
969 try std.testing.expectFmt("add w11, w12, wzr", "{f}", .{(try as.nextInstruction()).?});
970 try std.testing.expectFmt("add wsp, w13, wzr", "{f}", .{(try as.nextInstruction()).?});
971 try std.testing.expectFmt("add w14, wsp, wzr", "{f}", .{(try as.nextInstruction()).?});
972 try std.testing.expectFmt("add wsp, wsp, wzr", "{f}", .{(try as.nextInstruction()).?});
973
974 try std.testing.expectFmt("add x0, x0, x1", "{f}", .{(try as.nextInstruction()).?});
975 try std.testing.expectFmt("add x2, x3, x4", "{f}", .{(try as.nextInstruction()).?});
976 try std.testing.expectFmt("add sp, x5, x6", "{f}", .{(try as.nextInstruction()).?});
977 try std.testing.expectFmt("add x7, sp, x8", "{f}", .{(try as.nextInstruction()).?});
978 try std.testing.expectFmt("add sp, sp, x9", "{f}", .{(try as.nextInstruction()).?});
979 try std.testing.expectFmt("add x10, x10, xzr", "{f}", .{(try as.nextInstruction()).?});
980 try std.testing.expectFmt("add x11, x12, xzr", "{f}", .{(try as.nextInstruction()).?});
981 try std.testing.expectFmt("add sp, x13, xzr", "{f}", .{(try as.nextInstruction()).?});
982 try std.testing.expectFmt("add x14, sp, xzr", "{f}", .{(try as.nextInstruction()).?});
983 try std.testing.expectFmt("add sp, sp, xzr", "{f}", .{(try as.nextInstruction()).?});
984
985 try std.testing.expectFmt("add w0, w0, w1", "{f}", .{(try as.nextInstruction()).?});
986 try std.testing.expectFmt("add w2, w3, w4, uxtb", "{f}", .{(try as.nextInstruction()).?});
987 try std.testing.expectFmt("add wsp, w5, w6, uxth #1", "{f}", .{(try as.nextInstruction()).?});
988 try std.testing.expectFmt("add w7, wsp, w8, lsl #2", "{f}", .{(try as.nextInstruction()).?});
989 try std.testing.expectFmt("add wsp, wsp, w9, uxtx", "{f}", .{(try as.nextInstruction()).?});
990 try std.testing.expectFmt("add w10, w10, wzr, uxtx #3", "{f}", .{(try as.nextInstruction()).?});
991 try std.testing.expectFmt("add w11, w12, wzr, sxtb #4", "{f}", .{(try as.nextInstruction()).?});
992 try std.testing.expectFmt("add wsp, w13, wzr, sxth", "{f}", .{(try as.nextInstruction()).?});
993 try std.testing.expectFmt("add w14, wsp, wzr, sxtw #1", "{f}", .{(try as.nextInstruction()).?});
994 try std.testing.expectFmt("add wsp, wsp, wzr, sxtx #2", "{f}", .{(try as.nextInstruction()).?});
995
996 try std.testing.expectFmt("add x0, x0, x1", "{f}", .{(try as.nextInstruction()).?});
997 try std.testing.expectFmt("add x2, x3, w4, uxtb", "{f}", .{(try as.nextInstruction()).?});
998 try std.testing.expectFmt("add sp, x5, w6, uxth #1", "{f}", .{(try as.nextInstruction()).?});
999 try std.testing.expectFmt("add x7, sp, w8, uxtw #2", "{f}", .{(try as.nextInstruction()).?});
1000 try std.testing.expectFmt("add sp, sp, x9", "{f}", .{(try as.nextInstruction()).?});
1001 try std.testing.expectFmt("add x10, x10, xzr, uxtx #3", "{f}", .{(try as.nextInstruction()).?});
1002 try std.testing.expectFmt("add x11, x12, wzr, sxtb #4", "{f}", .{(try as.nextInstruction()).?});
1003 try std.testing.expectFmt("add sp, x13, wzr, sxth", "{f}", .{(try as.nextInstruction()).?});
1004 try std.testing.expectFmt("add x14, sp, wzr, sxtw #1", "{f}", .{(try as.nextInstruction()).?});
1005 try std.testing.expectFmt("add sp, sp, xzr, sxtx #2", "{f}", .{(try as.nextInstruction()).?});
1006
1007 try std.testing.expectFmt("add w0, w0, #0x0", "{f}", .{(try as.nextInstruction()).?});
1008 try std.testing.expectFmt("add w0, w1, #0x1", "{f}", .{(try as.nextInstruction()).?});
1009 try std.testing.expectFmt("add wsp, w2, #0x2, lsl #12", "{f}", .{(try as.nextInstruction()).?});
1010 try std.testing.expectFmt("add w3, wsp, #0x3", "{f}", .{(try as.nextInstruction()).?});
1011 try std.testing.expectFmt("add wsp, wsp, #0xfff, lsl #12", "{f}", .{(try as.nextInstruction()).?});
1012 try std.testing.expectFmt("add w0, w1, #0x0", "{f}", .{(try as.nextInstruction()).?});
1013 try std.testing.expectFmt("add w2, w3, #0x0", "{f}", .{(try as.nextInstruction()).?});
1014 try std.testing.expectFmt("mov w4, wsp", "{f}", .{(try as.nextInstruction()).?});
1015 try std.testing.expectFmt("mov w5, wsp", "{f}", .{(try as.nextInstruction()).?});
1016 try std.testing.expectFmt("mov wsp, w6", "{f}", .{(try as.nextInstruction()).?});
1017 try std.testing.expectFmt("mov wsp, w7", "{f}", .{(try as.nextInstruction()).?});
1018 try std.testing.expectFmt("mov wsp, wsp", "{f}", .{(try as.nextInstruction()).?});
1019 try std.testing.expectFmt("mov wsp, wsp", "{f}", .{(try as.nextInstruction()).?});
1020
1021 try std.testing.expectFmt("add x0, x0, #0x0", "{f}", .{(try as.nextInstruction()).?});
1022 try std.testing.expectFmt("add x0, x1, #0x1", "{f}", .{(try as.nextInstruction()).?});
1023 try std.testing.expectFmt("add sp, x2, #0x2, lsl #12", "{f}", .{(try as.nextInstruction()).?});
1024 try std.testing.expectFmt("add x3, sp, #0x3", "{f}", .{(try as.nextInstruction()).?});
1025 try std.testing.expectFmt("add sp, sp, #0xfff, lsl #12", "{f}", .{(try as.nextInstruction()).?});
1026 try std.testing.expectFmt("add x0, x1, #0x0", "{f}", .{(try as.nextInstruction()).?});
1027 try std.testing.expectFmt("add x2, x3, #0x0", "{f}", .{(try as.nextInstruction()).?});
1028 try std.testing.expectFmt("mov x4, sp", "{f}", .{(try as.nextInstruction()).?});
1029 try std.testing.expectFmt("mov x5, sp", "{f}", .{(try as.nextInstruction()).?});
1030 try std.testing.expectFmt("mov sp, x6", "{f}", .{(try as.nextInstruction()).?});
1031 try std.testing.expectFmt("mov sp, x7", "{f}", .{(try as.nextInstruction()).?});
1032 try std.testing.expectFmt("mov sp, sp", "{f}", .{(try as.nextInstruction()).?});
1033 try std.testing.expectFmt("mov sp, sp", "{f}", .{(try as.nextInstruction()).?});
1034
1035 try std.testing.expectFmt("add w0, w0, w0", "{f}", .{(try as.nextInstruction()).?});
1036 try std.testing.expectFmt("add w1, w1, w2", "{f}", .{(try as.nextInstruction()).?});
1037 try std.testing.expectFmt("add w3, w4, w5, lsl #1", "{f}", .{(try as.nextInstruction()).?});
1038 try std.testing.expectFmt("add w6, w6, wzr, lsl #31", "{f}", .{(try as.nextInstruction()).?});
1039 try std.testing.expectFmt("add w7, wzr, w8, lsr #0", "{f}", .{(try as.nextInstruction()).?});
1040 try std.testing.expectFmt("add w9, wzr, wzr, lsr #30", "{f}", .{(try as.nextInstruction()).?});
1041 try std.testing.expectFmt("add wzr, w10, w11, lsr #31", "{f}", .{(try as.nextInstruction()).?});
1042 try std.testing.expectFmt("add wzr, w12, wzr, asr #0", "{f}", .{(try as.nextInstruction()).?});
1043 try std.testing.expectFmt("add wzr, wzr, w13, asr #16", "{f}", .{(try as.nextInstruction()).?});
1044 try std.testing.expectFmt("add wzr, wzr, wzr, asr #31", "{f}", .{(try as.nextInstruction()).?});
1045
1046 try std.testing.expectFmt("add x0, x0, x0", "{f}", .{(try as.nextInstruction()).?});
1047 try std.testing.expectFmt("add x1, x1, x2", "{f}", .{(try as.nextInstruction()).?});
1048 try std.testing.expectFmt("add x3, x4, x5, lsl #1", "{f}", .{(try as.nextInstruction()).?});
1049 try std.testing.expectFmt("add x6, x6, xzr, lsl #63", "{f}", .{(try as.nextInstruction()).?});
1050 try std.testing.expectFmt("add x7, xzr, x8, lsr #0", "{f}", .{(try as.nextInstruction()).?});
1051 try std.testing.expectFmt("add x9, xzr, xzr, lsr #62", "{f}", .{(try as.nextInstruction()).?});
1052 try std.testing.expectFmt("add xzr, x10, x11, lsr #63", "{f}", .{(try as.nextInstruction()).?});
1053 try std.testing.expectFmt("add xzr, x12, xzr, asr #0", "{f}", .{(try as.nextInstruction()).?});
1054 try std.testing.expectFmt("add xzr, xzr, x13, asr #31", "{f}", .{(try as.nextInstruction()).?});
1055 try std.testing.expectFmt("add xzr, xzr, xzr, asr #63", "{f}", .{(try as.nextInstruction()).?});
1056
1057 try std.testing.expectFmt("addg x0, sp, #0x0, #0xf", "{f}", .{(try as.nextInstruction()).?});
1058 try std.testing.expectFmt("addg sp, x1, #0x3f0, #0x0", "{f}", .{(try as.nextInstruction()).?});
1059
1060 try std.testing.expectFmt("adds w0, w0, w1", "{f}", .{(try as.nextInstruction()).?});
1061 try std.testing.expectFmt("adds w2, w3, w4", "{f}", .{(try as.nextInstruction()).?});
1062 try std.testing.expectFmt("adds w5, w5, w6", "{f}", .{(try as.nextInstruction()).?});
1063 try std.testing.expectFmt("adds w7, wsp, w8", "{f}", .{(try as.nextInstruction()).?});
1064 try std.testing.expectFmt("adds w9, wsp, w9", "{f}", .{(try as.nextInstruction()).?});
1065 try std.testing.expectFmt("adds w10, w10, wzr", "{f}", .{(try as.nextInstruction()).?});
1066 try std.testing.expectFmt("adds w11, w12, wzr", "{f}", .{(try as.nextInstruction()).?});
1067 try std.testing.expectFmt("cmn w13, wzr", "{f}", .{(try as.nextInstruction()).?});
1068 try std.testing.expectFmt("adds w14, wsp, wzr", "{f}", .{(try as.nextInstruction()).?});
1069 try std.testing.expectFmt("cmn wsp, wzr", "{f}", .{(try as.nextInstruction()).?});
1070
1071 try std.testing.expectFmt("adds x0, x0, x1", "{f}", .{(try as.nextInstruction()).?});
1072 try std.testing.expectFmt("adds x2, x3, x4", "{f}", .{(try as.nextInstruction()).?});
1073 try std.testing.expectFmt("adds x5, x5, x6", "{f}", .{(try as.nextInstruction()).?});
1074 try std.testing.expectFmt("adds x7, sp, x8", "{f}", .{(try as.nextInstruction()).?});
1075 try std.testing.expectFmt("adds x9, sp, x9", "{f}", .{(try as.nextInstruction()).?});
1076 try std.testing.expectFmt("adds x10, x10, xzr", "{f}", .{(try as.nextInstruction()).?});
1077 try std.testing.expectFmt("adds x11, x12, xzr", "{f}", .{(try as.nextInstruction()).?});
1078 try std.testing.expectFmt("cmn x13, xzr", "{f}", .{(try as.nextInstruction()).?});
1079 try std.testing.expectFmt("adds x14, sp, xzr", "{f}", .{(try as.nextInstruction()).?});
1080 try std.testing.expectFmt("cmn sp, xzr", "{f}", .{(try as.nextInstruction()).?});
1081
1082 try std.testing.expectFmt("adds w0, w0, w1", "{f}", .{(try as.nextInstruction()).?});
1083 try std.testing.expectFmt("adds w2, w3, w4, uxtb", "{f}", .{(try as.nextInstruction()).?});
1084 try std.testing.expectFmt("cmn w5, w6, uxth #1", "{f}", .{(try as.nextInstruction()).?});
1085 try std.testing.expectFmt("adds w7, wsp, w8, lsl #2", "{f}", .{(try as.nextInstruction()).?});
1086 try std.testing.expectFmt("adds w9, wsp, w9, uxtx", "{f}", .{(try as.nextInstruction()).?});
1087 try std.testing.expectFmt("adds w10, w10, wzr, uxtx #3", "{f}", .{(try as.nextInstruction()).?});
1088 try std.testing.expectFmt("adds w11, w12, wzr, sxtb #4", "{f}", .{(try as.nextInstruction()).?});
1089 try std.testing.expectFmt("cmn w13, wzr, sxth", "{f}", .{(try as.nextInstruction()).?});
1090 try std.testing.expectFmt("adds w14, wsp, wzr, sxtw #1", "{f}", .{(try as.nextInstruction()).?});
1091 try std.testing.expectFmt("cmn wsp, wzr, sxtx #2", "{f}", .{(try as.nextInstruction()).?});
1092
1093 try std.testing.expectFmt("adds x0, x0, x1", "{f}", .{(try as.nextInstruction()).?});
1094 try std.testing.expectFmt("adds x2, x3, w4, uxtb", "{f}", .{(try as.nextInstruction()).?});
1095 try std.testing.expectFmt("cmn x5, w6, uxth #1", "{f}", .{(try as.nextInstruction()).?});
1096 try std.testing.expectFmt("adds x7, sp, w8, uxtw #2", "{f}", .{(try as.nextInstruction()).?});
1097 try std.testing.expectFmt("cmn sp, x9", "{f}", .{(try as.nextInstruction()).?});
1098 try std.testing.expectFmt("adds x10, x10, xzr, uxtx #3", "{f}", .{(try as.nextInstruction()).?});
1099 try std.testing.expectFmt("adds x11, x12, wzr, sxtb #4", "{f}", .{(try as.nextInstruction()).?});
1100 try std.testing.expectFmt("cmn x13, wzr, sxth", "{f}", .{(try as.nextInstruction()).?});
1101 try std.testing.expectFmt("adds x14, sp, wzr, sxtw #1", "{f}", .{(try as.nextInstruction()).?});
1102 try std.testing.expectFmt("cmn sp, xzr, sxtx #2", "{f}", .{(try as.nextInstruction()).?});
1103
1104 try std.testing.expectFmt("adds w0, w0, #0x0", "{f}", .{(try as.nextInstruction()).?});
1105 try std.testing.expectFmt("adds w0, w1, #0x1", "{f}", .{(try as.nextInstruction()).?});
1106 try std.testing.expectFmt("adds wzr, w2, #0x2, lsl #12", "{f}", .{(try as.nextInstruction()).?});
1107 try std.testing.expectFmt("adds w3, wsp, #0x3", "{f}", .{(try as.nextInstruction()).?});
1108 try std.testing.expectFmt("adds wzr, wsp, #0xfff, lsl #12", "{f}", .{(try as.nextInstruction()).?});
1109 try std.testing.expectFmt("adds w0, w1, #0x0", "{f}", .{(try as.nextInstruction()).?});
1110 try std.testing.expectFmt("adds w2, w3, #0x0", "{f}", .{(try as.nextInstruction()).?});
1111 try std.testing.expectFmt("adds w4, wsp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1112 try std.testing.expectFmt("adds w5, wsp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1113 try std.testing.expectFmt("adds wzr, w6, #0x0", "{f}", .{(try as.nextInstruction()).?});
1114 try std.testing.expectFmt("adds wzr, w7, #0x0", "{f}", .{(try as.nextInstruction()).?});
1115 try std.testing.expectFmt("adds wzr, wsp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1116 try std.testing.expectFmt("adds wzr, wsp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1117
1118 try std.testing.expectFmt("adds x0, x0, #0x0", "{f}", .{(try as.nextInstruction()).?});
1119 try std.testing.expectFmt("adds x0, x1, #0x1", "{f}", .{(try as.nextInstruction()).?});
1120 try std.testing.expectFmt("adds xzr, x2, #0x2, lsl #12", "{f}", .{(try as.nextInstruction()).?});
1121 try std.testing.expectFmt("adds x3, sp, #0x3", "{f}", .{(try as.nextInstruction()).?});
1122 try std.testing.expectFmt("adds xzr, sp, #0xfff, lsl #12", "{f}", .{(try as.nextInstruction()).?});
1123 try std.testing.expectFmt("adds x0, x1, #0x0", "{f}", .{(try as.nextInstruction()).?});
1124 try std.testing.expectFmt("adds x2, x3, #0x0", "{f}", .{(try as.nextInstruction()).?});
1125 try std.testing.expectFmt("adds x4, sp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1126 try std.testing.expectFmt("adds x5, sp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1127 try std.testing.expectFmt("adds xzr, x6, #0x0", "{f}", .{(try as.nextInstruction()).?});
1128 try std.testing.expectFmt("adds xzr, x7, #0x0", "{f}", .{(try as.nextInstruction()).?});
1129 try std.testing.expectFmt("adds xzr, sp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1130 try std.testing.expectFmt("adds xzr, sp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1131
1132 try std.testing.expectFmt("adds w0, w0, w0", "{f}", .{(try as.nextInstruction()).?});
1133 try std.testing.expectFmt("adds w1, w1, w2", "{f}", .{(try as.nextInstruction()).?});
1134 try std.testing.expectFmt("adds w3, w4, w5, lsl #1", "{f}", .{(try as.nextInstruction()).?});
1135 try std.testing.expectFmt("adds w6, w6, wzr, lsl #31", "{f}", .{(try as.nextInstruction()).?});
1136 try std.testing.expectFmt("adds w7, wzr, w8, lsr #0", "{f}", .{(try as.nextInstruction()).?});
1137 try std.testing.expectFmt("adds w9, wzr, wzr, lsr #30", "{f}", .{(try as.nextInstruction()).?});
1138 try std.testing.expectFmt("cmn w10, w11, lsr #31", "{f}", .{(try as.nextInstruction()).?});
1139 try std.testing.expectFmt("cmn w12, wzr, asr #0", "{f}", .{(try as.nextInstruction()).?});
1140 try std.testing.expectFmt("cmn wzr, w13, asr #16", "{f}", .{(try as.nextInstruction()).?});
1141 try std.testing.expectFmt("cmn wzr, wzr, asr #31", "{f}", .{(try as.nextInstruction()).?});
1142
1143 try std.testing.expectFmt("adds x0, x0, x0", "{f}", .{(try as.nextInstruction()).?});
1144 try std.testing.expectFmt("adds x1, x1, x2", "{f}", .{(try as.nextInstruction()).?});
1145 try std.testing.expectFmt("adds x3, x4, x5, lsl #1", "{f}", .{(try as.nextInstruction()).?});
1146 try std.testing.expectFmt("adds x6, x6, xzr, lsl #63", "{f}", .{(try as.nextInstruction()).?});
1147 try std.testing.expectFmt("adds x7, xzr, x8, lsr #0", "{f}", .{(try as.nextInstruction()).?});
1148 try std.testing.expectFmt("adds x9, xzr, xzr, lsr #62", "{f}", .{(try as.nextInstruction()).?});
1149 try std.testing.expectFmt("cmn x10, x11, lsr #63", "{f}", .{(try as.nextInstruction()).?});
1150 try std.testing.expectFmt("cmn x12, xzr, asr #0", "{f}", .{(try as.nextInstruction()).?});
1151 try std.testing.expectFmt("cmn xzr, x13, asr #31", "{f}", .{(try as.nextInstruction()).?});
1152 try std.testing.expectFmt("cmn xzr, xzr, asr #63", "{f}", .{(try as.nextInstruction()).?});
1153
1154 try std.testing.expectFmt("neg w0, w0", "{f}", .{(try as.nextInstruction()).?});
1155 try std.testing.expectFmt("neg w1, w2", "{f}", .{(try as.nextInstruction()).?});
1156 try std.testing.expectFmt("neg w3, wzr, lsl #7", "{f}", .{(try as.nextInstruction()).?});
1157 try std.testing.expectFmt("neg wzr, w4, lsr #14", "{f}", .{(try as.nextInstruction()).?});
1158 try std.testing.expectFmt("neg wzr, wzr, asr #21", "{f}", .{(try as.nextInstruction()).?});
1159
1160 try std.testing.expectFmt("neg x0, x0", "{f}", .{(try as.nextInstruction()).?});
1161 try std.testing.expectFmt("neg x1, x2", "{f}", .{(try as.nextInstruction()).?});
1162 try std.testing.expectFmt("neg x3, xzr, lsl #11", "{f}", .{(try as.nextInstruction()).?});
1163 try std.testing.expectFmt("neg xzr, x4, lsr #22", "{f}", .{(try as.nextInstruction()).?});
1164 try std.testing.expectFmt("neg xzr, xzr, asr #33", "{f}", .{(try as.nextInstruction()).?});
1165
1166 try std.testing.expectFmt("sbc w0, w0, w1", "{f}", .{(try as.nextInstruction()).?});
1167 try std.testing.expectFmt("sbc w2, w3, w4", "{f}", .{(try as.nextInstruction()).?});
1168 try std.testing.expectFmt("sbc w5, w5, wzr", "{f}", .{(try as.nextInstruction()).?});
1169 try std.testing.expectFmt("sbc w6, w7, wzr", "{f}", .{(try as.nextInstruction()).?});
1170
1171 try std.testing.expectFmt("sbcs w0, w0, w1", "{f}", .{(try as.nextInstruction()).?});
1172 try std.testing.expectFmt("sbcs w2, w3, w4", "{f}", .{(try as.nextInstruction()).?});
1173 try std.testing.expectFmt("sbcs w5, w5, wzr", "{f}", .{(try as.nextInstruction()).?});
1174 try std.testing.expectFmt("sbcs w6, w7, wzr", "{f}", .{(try as.nextInstruction()).?});
1175
1176 try std.testing.expectFmt("sub w0, w0, w1", "{f}", .{(try as.nextInstruction()).?});
1177 try std.testing.expectFmt("sub w2, w3, w4", "{f}", .{(try as.nextInstruction()).?});
1178 try std.testing.expectFmt("sub wsp, w5, w6", "{f}", .{(try as.nextInstruction()).?});
1179 try std.testing.expectFmt("sub w7, wsp, w8", "{f}", .{(try as.nextInstruction()).?});
1180 try std.testing.expectFmt("sub wsp, wsp, w9", "{f}", .{(try as.nextInstruction()).?});
1181 try std.testing.expectFmt("sub w10, w10, wzr", "{f}", .{(try as.nextInstruction()).?});
1182 try std.testing.expectFmt("sub w11, w12, wzr", "{f}", .{(try as.nextInstruction()).?});
1183 try std.testing.expectFmt("sub wsp, w13, wzr", "{f}", .{(try as.nextInstruction()).?});
1184 try std.testing.expectFmt("sub w14, wsp, wzr", "{f}", .{(try as.nextInstruction()).?});
1185 try std.testing.expectFmt("sub wsp, wsp, wzr", "{f}", .{(try as.nextInstruction()).?});
1186
1187 try std.testing.expectFmt("sub x0, x0, x1", "{f}", .{(try as.nextInstruction()).?});
1188 try std.testing.expectFmt("sub x2, x3, x4", "{f}", .{(try as.nextInstruction()).?});
1189 try std.testing.expectFmt("sub sp, x5, x6", "{f}", .{(try as.nextInstruction()).?});
1190 try std.testing.expectFmt("sub x7, sp, x8", "{f}", .{(try as.nextInstruction()).?});
1191 try std.testing.expectFmt("sub sp, sp, x9", "{f}", .{(try as.nextInstruction()).?});
1192 try std.testing.expectFmt("sub x10, x10, xzr", "{f}", .{(try as.nextInstruction()).?});
1193 try std.testing.expectFmt("sub x11, x12, xzr", "{f}", .{(try as.nextInstruction()).?});
1194 try std.testing.expectFmt("sub sp, x13, xzr", "{f}", .{(try as.nextInstruction()).?});
1195 try std.testing.expectFmt("sub x14, sp, xzr", "{f}", .{(try as.nextInstruction()).?});
1196 try std.testing.expectFmt("sub sp, sp, xzr", "{f}", .{(try as.nextInstruction()).?});
1197
1198 try std.testing.expectFmt("sub w0, w0, w1", "{f}", .{(try as.nextInstruction()).?});
1199 try std.testing.expectFmt("sub w2, w3, w4, uxtb", "{f}", .{(try as.nextInstruction()).?});
1200 try std.testing.expectFmt("sub wsp, w5, w6, uxth #1", "{f}", .{(try as.nextInstruction()).?});
1201 try std.testing.expectFmt("sub w7, wsp, w8, lsl #2", "{f}", .{(try as.nextInstruction()).?});
1202 try std.testing.expectFmt("sub wsp, wsp, w9, uxtx", "{f}", .{(try as.nextInstruction()).?});
1203 try std.testing.expectFmt("sub w10, w10, wzr, uxtx #3", "{f}", .{(try as.nextInstruction()).?});
1204 try std.testing.expectFmt("sub w11, w12, wzr, sxtb #4", "{f}", .{(try as.nextInstruction()).?});
1205 try std.testing.expectFmt("sub wsp, w13, wzr, sxth", "{f}", .{(try as.nextInstruction()).?});
1206 try std.testing.expectFmt("sub w14, wsp, wzr, sxtw #1", "{f}", .{(try as.nextInstruction()).?});
1207 try std.testing.expectFmt("sub wsp, wsp, wzr, sxtx #2", "{f}", .{(try as.nextInstruction()).?});
1208
1209 try std.testing.expectFmt("sub x0, x0, x1", "{f}", .{(try as.nextInstruction()).?});
1210 try std.testing.expectFmt("sub x2, x3, w4, uxtb", "{f}", .{(try as.nextInstruction()).?});
1211 try std.testing.expectFmt("sub sp, x5, w6, uxth #1", "{f}", .{(try as.nextInstruction()).?});
1212 try std.testing.expectFmt("sub x7, sp, w8, uxtw #2", "{f}", .{(try as.nextInstruction()).?});
1213 try std.testing.expectFmt("sub sp, sp, x9", "{f}", .{(try as.nextInstruction()).?});
1214 try std.testing.expectFmt("sub x10, x10, xzr, uxtx #3", "{f}", .{(try as.nextInstruction()).?});
1215 try std.testing.expectFmt("sub x11, x12, wzr, sxtb #4", "{f}", .{(try as.nextInstruction()).?});
1216 try std.testing.expectFmt("sub sp, x13, wzr, sxth", "{f}", .{(try as.nextInstruction()).?});
1217 try std.testing.expectFmt("sub x14, sp, wzr, sxtw #1", "{f}", .{(try as.nextInstruction()).?});
1218 try std.testing.expectFmt("sub sp, sp, xzr, sxtx #2", "{f}", .{(try as.nextInstruction()).?});
1219
1220 try std.testing.expectFmt("sub w0, w0, #0x0", "{f}", .{(try as.nextInstruction()).?});
1221 try std.testing.expectFmt("sub w0, w1, #0x1", "{f}", .{(try as.nextInstruction()).?});
1222 try std.testing.expectFmt("sub wsp, w2, #0x2, lsl #12", "{f}", .{(try as.nextInstruction()).?});
1223 try std.testing.expectFmt("sub w3, wsp, #0x3", "{f}", .{(try as.nextInstruction()).?});
1224 try std.testing.expectFmt("sub wsp, wsp, #0xfff, lsl #12", "{f}", .{(try as.nextInstruction()).?});
1225 try std.testing.expectFmt("sub w0, w1, #0x0", "{f}", .{(try as.nextInstruction()).?});
1226 try std.testing.expectFmt("sub w2, w3, #0x0", "{f}", .{(try as.nextInstruction()).?});
1227 try std.testing.expectFmt("sub w4, wsp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1228 try std.testing.expectFmt("sub w5, wsp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1229 try std.testing.expectFmt("sub wsp, w6, #0x0", "{f}", .{(try as.nextInstruction()).?});
1230 try std.testing.expectFmt("sub wsp, w7, #0x0", "{f}", .{(try as.nextInstruction()).?});
1231 try std.testing.expectFmt("sub wsp, wsp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1232 try std.testing.expectFmt("sub wsp, wsp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1233
1234 try std.testing.expectFmt("sub x0, x0, #0x0", "{f}", .{(try as.nextInstruction()).?});
1235 try std.testing.expectFmt("sub x0, x1, #0x1", "{f}", .{(try as.nextInstruction()).?});
1236 try std.testing.expectFmt("sub sp, x2, #0x2, lsl #12", "{f}", .{(try as.nextInstruction()).?});
1237 try std.testing.expectFmt("sub x3, sp, #0x3", "{f}", .{(try as.nextInstruction()).?});
1238 try std.testing.expectFmt("sub sp, sp, #0xfff, lsl #12", "{f}", .{(try as.nextInstruction()).?});
1239 try std.testing.expectFmt("sub x0, x1, #0x0", "{f}", .{(try as.nextInstruction()).?});
1240 try std.testing.expectFmt("sub x2, x3, #0x0", "{f}", .{(try as.nextInstruction()).?});
1241 try std.testing.expectFmt("sub x4, sp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1242 try std.testing.expectFmt("sub x5, sp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1243 try std.testing.expectFmt("sub sp, x6, #0x0", "{f}", .{(try as.nextInstruction()).?});
1244 try std.testing.expectFmt("sub sp, x7, #0x0", "{f}", .{(try as.nextInstruction()).?});
1245 try std.testing.expectFmt("sub sp, sp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1246 try std.testing.expectFmt("sub sp, sp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1247
1248 try std.testing.expectFmt("sub w0, w0, w0", "{f}", .{(try as.nextInstruction()).?});
1249 try std.testing.expectFmt("sub w1, w1, w2", "{f}", .{(try as.nextInstruction()).?});
1250 try std.testing.expectFmt("sub w3, w4, w5, lsl #1", "{f}", .{(try as.nextInstruction()).?});
1251 try std.testing.expectFmt("sub w6, w6, wzr, lsl #31", "{f}", .{(try as.nextInstruction()).?});
1252 try std.testing.expectFmt("neg w7, w8, lsr #0", "{f}", .{(try as.nextInstruction()).?});
1253 try std.testing.expectFmt("neg w9, wzr, lsr #30", "{f}", .{(try as.nextInstruction()).?});
1254 try std.testing.expectFmt("sub wzr, w10, w11, lsr #31", "{f}", .{(try as.nextInstruction()).?});
1255 try std.testing.expectFmt("sub wzr, w12, wzr, asr #0", "{f}", .{(try as.nextInstruction()).?});
1256 try std.testing.expectFmt("neg wzr, w13, asr #16", "{f}", .{(try as.nextInstruction()).?});
1257 try std.testing.expectFmt("neg wzr, wzr, asr #31", "{f}", .{(try as.nextInstruction()).?});
1258
1259 try std.testing.expectFmt("sub x0, x0, x0", "{f}", .{(try as.nextInstruction()).?});
1260 try std.testing.expectFmt("sub x1, x1, x2", "{f}", .{(try as.nextInstruction()).?});
1261 try std.testing.expectFmt("sub x3, x4, x5, lsl #1", "{f}", .{(try as.nextInstruction()).?});
1262 try std.testing.expectFmt("sub x6, x6, xzr, lsl #63", "{f}", .{(try as.nextInstruction()).?});
1263 try std.testing.expectFmt("neg x7, x8, lsr #0", "{f}", .{(try as.nextInstruction()).?});
1264 try std.testing.expectFmt("neg x9, xzr, lsr #62", "{f}", .{(try as.nextInstruction()).?});
1265 try std.testing.expectFmt("sub xzr, x10, x11, lsr #63", "{f}", .{(try as.nextInstruction()).?});
1266 try std.testing.expectFmt("sub xzr, x12, xzr, asr #0", "{f}", .{(try as.nextInstruction()).?});
1267 try std.testing.expectFmt("neg xzr, x13, asr #31", "{f}", .{(try as.nextInstruction()).?});
1268 try std.testing.expectFmt("neg xzr, xzr, asr #63", "{f}", .{(try as.nextInstruction()).?});
1269
1270 try std.testing.expectFmt("subg x0, sp, #0x0, #0xf", "{f}", .{(try as.nextInstruction()).?});
1271 try std.testing.expectFmt("subg sp, x1, #0x3f0, #0x0", "{f}", .{(try as.nextInstruction()).?});
1272
1273 try std.testing.expectFmt("subs w0, w0, w1", "{f}", .{(try as.nextInstruction()).?});
1274 try std.testing.expectFmt("subs w2, w3, w4", "{f}", .{(try as.nextInstruction()).?});
1275 try std.testing.expectFmt("subs w5, w5, w6", "{f}", .{(try as.nextInstruction()).?});
1276 try std.testing.expectFmt("subs w7, wsp, w8", "{f}", .{(try as.nextInstruction()).?});
1277 try std.testing.expectFmt("subs w9, wsp, w9", "{f}", .{(try as.nextInstruction()).?});
1278 try std.testing.expectFmt("subs w10, w10, wzr", "{f}", .{(try as.nextInstruction()).?});
1279 try std.testing.expectFmt("subs w11, w12, wzr", "{f}", .{(try as.nextInstruction()).?});
1280 try std.testing.expectFmt("cmp w13, wzr", "{f}", .{(try as.nextInstruction()).?});
1281 try std.testing.expectFmt("subs w14, wsp, wzr", "{f}", .{(try as.nextInstruction()).?});
1282 try std.testing.expectFmt("cmp wsp, wzr", "{f}", .{(try as.nextInstruction()).?});
1283
1284 try std.testing.expectFmt("subs x0, x0, x1", "{f}", .{(try as.nextInstruction()).?});
1285 try std.testing.expectFmt("subs x2, x3, x4", "{f}", .{(try as.nextInstruction()).?});
1286 try std.testing.expectFmt("subs x5, x5, x6", "{f}", .{(try as.nextInstruction()).?});
1287 try std.testing.expectFmt("subs x7, sp, x8", "{f}", .{(try as.nextInstruction()).?});
1288 try std.testing.expectFmt("subs x9, sp, x9", "{f}", .{(try as.nextInstruction()).?});
1289 try std.testing.expectFmt("subs x10, x10, xzr", "{f}", .{(try as.nextInstruction()).?});
1290 try std.testing.expectFmt("subs x11, x12, xzr", "{f}", .{(try as.nextInstruction()).?});
1291 try std.testing.expectFmt("cmp x13, xzr", "{f}", .{(try as.nextInstruction()).?});
1292 try std.testing.expectFmt("subs x14, sp, xzr", "{f}", .{(try as.nextInstruction()).?});
1293 try std.testing.expectFmt("cmp sp, xzr", "{f}", .{(try as.nextInstruction()).?});
1294
1295 try std.testing.expectFmt("subs w0, w0, w1", "{f}", .{(try as.nextInstruction()).?});
1296 try std.testing.expectFmt("subs w2, w3, w4, uxtb", "{f}", .{(try as.nextInstruction()).?});
1297 try std.testing.expectFmt("cmp w5, w6, uxth #1", "{f}", .{(try as.nextInstruction()).?});
1298 try std.testing.expectFmt("subs w7, wsp, w8, lsl #2", "{f}", .{(try as.nextInstruction()).?});
1299 try std.testing.expectFmt("subs w9, wsp, w9, uxtx", "{f}", .{(try as.nextInstruction()).?});
1300 try std.testing.expectFmt("subs w10, w10, wzr, uxtx #3", "{f}", .{(try as.nextInstruction()).?});
1301 try std.testing.expectFmt("subs w11, w12, wzr, sxtb #4", "{f}", .{(try as.nextInstruction()).?});
1302 try std.testing.expectFmt("cmp w13, wzr, sxth", "{f}", .{(try as.nextInstruction()).?});
1303 try std.testing.expectFmt("subs w14, wsp, wzr, sxtw #1", "{f}", .{(try as.nextInstruction()).?});
1304 try std.testing.expectFmt("cmp wsp, wzr, sxtx #2", "{f}", .{(try as.nextInstruction()).?});
1305
1306 try std.testing.expectFmt("subs x0, x0, x1", "{f}", .{(try as.nextInstruction()).?});
1307 try std.testing.expectFmt("subs x2, x3, w4, uxtb", "{f}", .{(try as.nextInstruction()).?});
1308 try std.testing.expectFmt("cmp x5, w6, uxth #1", "{f}", .{(try as.nextInstruction()).?});
1309 try std.testing.expectFmt("subs x7, sp, w8, uxtw #2", "{f}", .{(try as.nextInstruction()).?});
1310 try std.testing.expectFmt("cmp sp, x9", "{f}", .{(try as.nextInstruction()).?});
1311 try std.testing.expectFmt("subs x10, x10, xzr, uxtx #3", "{f}", .{(try as.nextInstruction()).?});
1312 try std.testing.expectFmt("subs x11, x12, wzr, sxtb #4", "{f}", .{(try as.nextInstruction()).?});
1313 try std.testing.expectFmt("cmp x13, wzr, sxth", "{f}", .{(try as.nextInstruction()).?});
1314 try std.testing.expectFmt("subs x14, sp, wzr, sxtw #1", "{f}", .{(try as.nextInstruction()).?});
1315 try std.testing.expectFmt("cmp sp, xzr, sxtx #2", "{f}", .{(try as.nextInstruction()).?});
1316
1317 try std.testing.expectFmt("subs w0, w0, #0x0", "{f}", .{(try as.nextInstruction()).?});
1318 try std.testing.expectFmt("subs w0, w1, #0x1", "{f}", .{(try as.nextInstruction()).?});
1319 try std.testing.expectFmt("subs wzr, w2, #0x2, lsl #12", "{f}", .{(try as.nextInstruction()).?});
1320 try std.testing.expectFmt("subs w3, wsp, #0x3", "{f}", .{(try as.nextInstruction()).?});
1321 try std.testing.expectFmt("subs wzr, wsp, #0xfff, lsl #12", "{f}", .{(try as.nextInstruction()).?});
1322 try std.testing.expectFmt("subs w0, w1, #0x0", "{f}", .{(try as.nextInstruction()).?});
1323 try std.testing.expectFmt("subs w2, w3, #0x0", "{f}", .{(try as.nextInstruction()).?});
1324 try std.testing.expectFmt("subs w4, wsp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1325 try std.testing.expectFmt("subs w5, wsp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1326 try std.testing.expectFmt("subs wzr, w6, #0x0", "{f}", .{(try as.nextInstruction()).?});
1327 try std.testing.expectFmt("subs wzr, w7, #0x0", "{f}", .{(try as.nextInstruction()).?});
1328 try std.testing.expectFmt("subs wzr, wsp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1329 try std.testing.expectFmt("subs wzr, wsp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1330
1331 try std.testing.expectFmt("subs x0, x0, #0x0", "{f}", .{(try as.nextInstruction()).?});
1332 try std.testing.expectFmt("subs x0, x1, #0x1", "{f}", .{(try as.nextInstruction()).?});
1333 try std.testing.expectFmt("subs xzr, x2, #0x2, lsl #12", "{f}", .{(try as.nextInstruction()).?});
1334 try std.testing.expectFmt("subs x3, sp, #0x3", "{f}", .{(try as.nextInstruction()).?});
1335 try std.testing.expectFmt("subs xzr, sp, #0xfff, lsl #12", "{f}", .{(try as.nextInstruction()).?});
1336 try std.testing.expectFmt("subs x0, x1, #0x0", "{f}", .{(try as.nextInstruction()).?});
1337 try std.testing.expectFmt("subs x2, x3, #0x0", "{f}", .{(try as.nextInstruction()).?});
1338 try std.testing.expectFmt("subs x4, sp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1339 try std.testing.expectFmt("subs x5, sp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1340 try std.testing.expectFmt("subs xzr, x6, #0x0", "{f}", .{(try as.nextInstruction()).?});
1341 try std.testing.expectFmt("subs xzr, x7, #0x0", "{f}", .{(try as.nextInstruction()).?});
1342 try std.testing.expectFmt("subs xzr, sp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1343 try std.testing.expectFmt("subs xzr, sp, #0x0", "{f}", .{(try as.nextInstruction()).?});
1344
1345 try std.testing.expectFmt("subs w0, w0, w0", "{f}", .{(try as.nextInstruction()).?});
1346 try std.testing.expectFmt("subs w1, w1, w2", "{f}", .{(try as.nextInstruction()).?});
1347 try std.testing.expectFmt("subs w3, w4, w5, lsl #1", "{f}", .{(try as.nextInstruction()).?});
1348 try std.testing.expectFmt("subs w6, w6, wzr, lsl #31", "{f}", .{(try as.nextInstruction()).?});
1349 try std.testing.expectFmt("negs w7, w8, lsr #0", "{f}", .{(try as.nextInstruction()).?});
1350 try std.testing.expectFmt("negs w9, wzr, lsr #30", "{f}", .{(try as.nextInstruction()).?});
1351 try std.testing.expectFmt("cmp w10, w11, lsr #31", "{f}", .{(try as.nextInstruction()).?});
1352 try std.testing.expectFmt("cmp w12, wzr, asr #0", "{f}", .{(try as.nextInstruction()).?});
1353 try std.testing.expectFmt("cmp wzr, w13, asr #16", "{f}", .{(try as.nextInstruction()).?});
1354 try std.testing.expectFmt("cmp wzr, wzr, asr #31", "{f}", .{(try as.nextInstruction()).?});
1355
1356 try std.testing.expectFmt("subs x0, x0, x0", "{f}", .{(try as.nextInstruction()).?});
1357 try std.testing.expectFmt("subs x1, x1, x2", "{f}", .{(try as.nextInstruction()).?});
1358 try std.testing.expectFmt("subs x3, x4, x5, lsl #1", "{f}", .{(try as.nextInstruction()).?});
1359 try std.testing.expectFmt("subs x6, x6, xzr, lsl #63", "{f}", .{(try as.nextInstruction()).?});
1360 try std.testing.expectFmt("negs x7, x8, lsr #0", "{f}", .{(try as.nextInstruction()).?});
1361 try std.testing.expectFmt("negs x9, xzr, lsr #62", "{f}", .{(try as.nextInstruction()).?});
1362 try std.testing.expectFmt("cmp x10, x11, lsr #63", "{f}", .{(try as.nextInstruction()).?});
1363 try std.testing.expectFmt("cmp x12, xzr, asr #0", "{f}", .{(try as.nextInstruction()).?});
1364 try std.testing.expectFmt("cmp xzr, x13, asr #31", "{f}", .{(try as.nextInstruction()).?});
1365 try std.testing.expectFmt("cmp xzr, xzr, asr #63", "{f}", .{(try as.nextInstruction()).?});
1366
1367 try std.testing.expect(null == try as.nextInstruction());
1368}
1369test "bit manipulation" {
1370 var as: Assemble = .{
1371 .source =
1372 \\rbit w0, w1
1373 \\rbit w2, wzr
1374 \\rbit x3, x4
1375 \\rbit xzr, x5
1376 \\
1377 \\rev16 w0, w1
1378 \\rev16 w2, wzr
1379 \\rev16 x3, x4
1380 \\rev16 xzr, x5
1381 \\
1382 \\rev32 x3, x4
1383 \\rev32 xzr, x5
1384 \\
1385 \\rev w0, w1
1386 \\rev w2, wzr
1387 \\rev x3, x4
1388 \\rev xzr, x5
1389 \\
1390 \\rev64 x3, x4
1391 \\rev64 xzr, x5
1392 \\
1393 \\clz w0, w1
1394 \\clz w2, wzr
1395 \\clz x3, x4
1396 \\clz xzr, x5
1397 \\
1398 \\cls w0, w1
1399 \\cls w2, wzr
1400 \\cls x3, x4
1401 \\cls xzr, x5
1402 ,
1403 .operands = .empty,
1404 };
1405
1406 try std.testing.expectFmt("rbit w0, w1", "{f}", .{(try as.nextInstruction()).?});
1407 try std.testing.expectFmt("rbit w2, wzr", "{f}", .{(try as.nextInstruction()).?});
1408 try std.testing.expectFmt("rbit x3, x4", "{f}", .{(try as.nextInstruction()).?});
1409 try std.testing.expectFmt("rbit xzr, x5", "{f}", .{(try as.nextInstruction()).?});
1410
1411 try std.testing.expectFmt("rev16 w0, w1", "{f}", .{(try as.nextInstruction()).?});
1412 try std.testing.expectFmt("rev16 w2, wzr", "{f}", .{(try as.nextInstruction()).?});
1413 try std.testing.expectFmt("rev16 x3, x4", "{f}", .{(try as.nextInstruction()).?});
1414 try std.testing.expectFmt("rev16 xzr, x5", "{f}", .{(try as.nextInstruction()).?});
1415
1416 try std.testing.expectFmt("rev32 x3, x4", "{f}", .{(try as.nextInstruction()).?});
1417 try std.testing.expectFmt("rev32 xzr, x5", "{f}", .{(try as.nextInstruction()).?});
1418
1419 try std.testing.expectFmt("rev w0, w1", "{f}", .{(try as.nextInstruction()).?});
1420 try std.testing.expectFmt("rev w2, wzr", "{f}", .{(try as.nextInstruction()).?});
1421 try std.testing.expectFmt("rev x3, x4", "{f}", .{(try as.nextInstruction()).?});
1422 try std.testing.expectFmt("rev xzr, x5", "{f}", .{(try as.nextInstruction()).?});
1423
1424 try std.testing.expectFmt("rev x3, x4", "{f}", .{(try as.nextInstruction()).?});
1425 try std.testing.expectFmt("rev xzr, x5", "{f}", .{(try as.nextInstruction()).?});
1426
1427 try std.testing.expectFmt("clz w0, w1", "{f}", .{(try as.nextInstruction()).?});
1428 try std.testing.expectFmt("clz w2, wzr", "{f}", .{(try as.nextInstruction()).?});
1429 try std.testing.expectFmt("clz x3, x4", "{f}", .{(try as.nextInstruction()).?});
1430 try std.testing.expectFmt("clz xzr, x5", "{f}", .{(try as.nextInstruction()).?});
1431
1432 try std.testing.expectFmt("cls w0, w1", "{f}", .{(try as.nextInstruction()).?});
1433 try std.testing.expectFmt("cls w2, wzr", "{f}", .{(try as.nextInstruction()).?});
1434 try std.testing.expectFmt("cls x3, x4", "{f}", .{(try as.nextInstruction()).?});
1435 try std.testing.expectFmt("cls xzr, x5", "{f}", .{(try as.nextInstruction()).?});
1436
1437 try std.testing.expect(null == try as.nextInstruction());
1438}
1439test "bitfield" {
1440 var as: Assemble = .{
1441 .source =
1442 \\bfc w0, #1, #31
1443 \\bfc w1, #31, #1
1444 \\bfc x2, #1, #63
1445 \\bfc x3, #63, #1
1446 \\
1447 \\bfi w0, w1, #1, #31
1448 \\bfi w2, wzr, #31, #1
1449 \\bfi x3, xzr, #1, #63
1450 \\bfi x4, x5, #63, #1
1451 \\
1452 \\bfm w0, wzr, #25, #5
1453 \\bfm w1, w2, #31, #1
1454 \\bfm w3, w4, #1, #31
1455 \\bfm x5, xzr, #57, #7
1456 \\bfm x6, x7, #63, #1
1457 \\bfm x8, x9, #1, #63
1458 \\
1459 \\sbfm w0, w1, #31, #1
1460 \\sbfm w2, w3, #1, #31
1461 \\sbfm x4, x5, #63, #1
1462 \\sbfm x6, x7, #1, #63
1463 \\
1464 \\ubfm w0, w1, #31, #1
1465 \\ubfm w2, w3, #1, #31
1466 \\ubfm x4, x5, #63, #1
1467 \\ubfm x6, x7, #1, #63
1468 ,
1469 .operands = .empty,
1470 };
1471
1472 try std.testing.expectFmt("bfc w0, #1, #31", "{f}", .{(try as.nextInstruction()).?});
1473 try std.testing.expectFmt("bfc w1, #31, #1", "{f}", .{(try as.nextInstruction()).?});
1474 try std.testing.expectFmt("bfc x2, #1, #63", "{f}", .{(try as.nextInstruction()).?});
1475 try std.testing.expectFmt("bfc x3, #63, #1", "{f}", .{(try as.nextInstruction()).?});
1476
1477 try std.testing.expectFmt("bfi w0, w1, #1, #31", "{f}", .{(try as.nextInstruction()).?});
1478 try std.testing.expectFmt("bfc w2, #31, #1", "{f}", .{(try as.nextInstruction()).?});
1479 try std.testing.expectFmt("bfc x3, #1, #63", "{f}", .{(try as.nextInstruction()).?});
1480 try std.testing.expectFmt("bfi x4, x5, #63, #1", "{f}", .{(try as.nextInstruction()).?});
1481
1482 try std.testing.expectFmt("bfc w0, #7, #6", "{f}", .{(try as.nextInstruction()).?});
1483 try std.testing.expectFmt("bfi w1, w2, #1, #2", "{f}", .{(try as.nextInstruction()).?});
1484 try std.testing.expectFmt("bfxil w3, w4, #1, #31", "{f}", .{(try as.nextInstruction()).?});
1485 try std.testing.expectFmt("bfc x5, #7, #8", "{f}", .{(try as.nextInstruction()).?});
1486 try std.testing.expectFmt("bfi x6, x7, #1, #2", "{f}", .{(try as.nextInstruction()).?});
1487 try std.testing.expectFmt("bfxil x8, x9, #1, #63", "{f}", .{(try as.nextInstruction()).?});
1488
1489 try std.testing.expectFmt("sbfiz w0, w1, #1, #2", "{f}", .{(try as.nextInstruction()).?});
1490 try std.testing.expectFmt("sbfx w2, w3, #1, #31", "{f}", .{(try as.nextInstruction()).?});
1491 try std.testing.expectFmt("sbfiz x4, x5, #1, #2", "{f}", .{(try as.nextInstruction()).?});
1492 try std.testing.expectFmt("sbfx x6, x7, #1, #63", "{f}", .{(try as.nextInstruction()).?});
1493
1494 try std.testing.expectFmt("ubfiz w0, w1, #1, #2", "{f}", .{(try as.nextInstruction()).?});
1495 try std.testing.expectFmt("ubfx w2, w3, #1, #31", "{f}", .{(try as.nextInstruction()).?});
1496 try std.testing.expectFmt("ubfiz x4, x5, #1, #2", "{f}", .{(try as.nextInstruction()).?});
1497 try std.testing.expectFmt("ubfx x6, x7, #1, #63", "{f}", .{(try as.nextInstruction()).?});
1498
1499 try std.testing.expect(null == try as.nextInstruction());
1500}
1501test "branch register" {
1502 var as: Assemble = .{
1503 .source =
1504 \\ret
1505 \\br x30
1506 \\blr x30
1507 \\ret x30
1508 \\br x29
1509 \\blr x29
1510 \\ret x29
1511 \\br x2
1512 \\blr x1
1513 \\ret x0
1514 ,
1515 .operands = .empty,
1516 };
1517
1518 try std.testing.expectFmt("ret", "{f}", .{(try as.nextInstruction()).?});
1519 try std.testing.expectFmt("br x30", "{f}", .{(try as.nextInstruction()).?});
1520 try std.testing.expectFmt("blr x30", "{f}", .{(try as.nextInstruction()).?});
1521 try std.testing.expectFmt("ret", "{f}", .{(try as.nextInstruction()).?});
1522 try std.testing.expectFmt("br x29", "{f}", .{(try as.nextInstruction()).?});
1523 try std.testing.expectFmt("blr x29", "{f}", .{(try as.nextInstruction()).?});
1524 try std.testing.expectFmt("ret x29", "{f}", .{(try as.nextInstruction()).?});
1525 try std.testing.expectFmt("br x2", "{f}", .{(try as.nextInstruction()).?});
1526 try std.testing.expectFmt("blr x1", "{f}", .{(try as.nextInstruction()).?});
1527 try std.testing.expectFmt("ret x0", "{f}", .{(try as.nextInstruction()).?});
1528
1529 try std.testing.expect(null == try as.nextInstruction());
1530}
1531test "division" {
1532 var as: Assemble = .{
1533 .source =
1534 \\udiv w0, w1, w2
1535 \\udiv x3, x4, xzr
1536 \\sdiv w5, wzr, w6
1537 \\sdiv x7, x8, x9
1538 ,
1539 .operands = .empty,
1540 };
1541
1542 try std.testing.expectFmt("udiv w0, w1, w2", "{f}", .{(try as.nextInstruction()).?});
1543 try std.testing.expectFmt("udiv x3, x4, xzr", "{f}", .{(try as.nextInstruction()).?});
1544 try std.testing.expectFmt("sdiv w5, wzr, w6", "{f}", .{(try as.nextInstruction()).?});
1545 try std.testing.expectFmt("sdiv x7, x8, x9", "{f}", .{(try as.nextInstruction()).?});
1546
1547 try std.testing.expect(null == try as.nextInstruction());
1548}
1549test "exception generating" {
1550 var as: Assemble = .{
1551 .source =
1552 \\SVC #0
1553 \\HVC #0x1
1554 \\SMC #0o15
1555 \\BRK #42
1556 \\HLT #0x42
1557 \\TCANCEL #123
1558 \\DCPS1 #1234
1559 \\DCPS2 #12345
1560 \\DCPS3 #65535
1561 \\DCPS3 #0x0
1562 \\DCPS2 #0
1563 \\DCPS1
1564 ,
1565 .operands = .empty,
1566 };
1567
1568 try std.testing.expectFmt("svc #0", "{f}", .{(try as.nextInstruction()).?});
1569 try std.testing.expectFmt("hvc #0x1", "{f}", .{(try as.nextInstruction()).?});
1570 try std.testing.expectFmt("smc #0xd", "{f}", .{(try as.nextInstruction()).?});
1571 try std.testing.expectFmt("brk #0x2a", "{f}", .{(try as.nextInstruction()).?});
1572 try std.testing.expectFmt("hlt #0x42", "{f}", .{(try as.nextInstruction()).?});
1573 try std.testing.expectFmt("tcancel #0x7b", "{f}", .{(try as.nextInstruction()).?});
1574 try std.testing.expectFmt("dcps1 #0x4d2", "{f}", .{(try as.nextInstruction()).?});
1575 try std.testing.expectFmt("dcps2 #0x3039", "{f}", .{(try as.nextInstruction()).?});
1576 try std.testing.expectFmt("dcps3 #0xffff", "{f}", .{(try as.nextInstruction()).?});
1577 try std.testing.expectFmt("dcps3", "{f}", .{(try as.nextInstruction()).?});
1578 try std.testing.expectFmt("dcps2", "{f}", .{(try as.nextInstruction()).?});
1579 try std.testing.expectFmt("dcps1", "{f}", .{(try as.nextInstruction()).?});
1580
1581 try std.testing.expect(null == try as.nextInstruction());
1582}
1583test "extract" {
1584 var as: Assemble = .{
1585 .source =
1586 \\extr W0, W1, W2, #0
1587 \\extr W3, W3, W4, #1
1588 \\extr W5, W5, W5, #31
1589 \\
1590 \\extr X0, X1, X2, #0
1591 \\extr X3, X3, X4, #1
1592 \\extr X5, X5, X5, #63
1593 ,
1594 .operands = .empty,
1595 };
1596
1597 try std.testing.expectFmt("extr w0, w1, w2, #0", "{f}", .{(try as.nextInstruction()).?});
1598 try std.testing.expectFmt("extr w3, w3, w4, #1", "{f}", .{(try as.nextInstruction()).?});
1599 try std.testing.expectFmt("extr w5, w5, w5, #31", "{f}", .{(try as.nextInstruction()).?});
1600
1601 try std.testing.expectFmt("extr x0, x1, x2, #0", "{f}", .{(try as.nextInstruction()).?});
1602 try std.testing.expectFmt("extr x3, x3, x4, #1", "{f}", .{(try as.nextInstruction()).?});
1603 try std.testing.expectFmt("extr x5, x5, x5, #63", "{f}", .{(try as.nextInstruction()).?});
1604
1605 try std.testing.expect(null == try as.nextInstruction());
1606}
1607test "flags" {
1608 var as: Assemble = .{
1609 .source =
1610 \\AXFLAG
1611 \\CFINV
1612 \\XAFLAG
1613 ,
1614 .operands = .empty,
1615 };
1616
1617 try std.testing.expectFmt("axflag", "{f}", .{(try as.nextInstruction()).?});
1618 try std.testing.expectFmt("cfinv", "{f}", .{(try as.nextInstruction()).?});
1619 try std.testing.expectFmt("xaflag", "{f}", .{(try as.nextInstruction()).?});
1620
1621 try std.testing.expect(null == try as.nextInstruction());
1622}
1623test "hints" {
1624 var as: Assemble = .{
1625 .source =
1626 \\NOP
1627 \\hint #0
1628 \\YiElD
1629 \\Hint #0x1
1630 \\WfE
1631 \\hInt #02
1632 \\wFi
1633 \\hiNt #0b11
1634 \\sEv
1635 \\hinT #4
1636 \\sevl
1637 \\HINT #0b101
1638 \\hint #0x7F
1639 ,
1640 .operands = .empty,
1641 };
1642
1643 try std.testing.expectFmt("nop", "{f}", .{(try as.nextInstruction()).?});
1644 try std.testing.expectFmt("nop", "{f}", .{(try as.nextInstruction()).?});
1645 try std.testing.expectFmt("yield", "{f}", .{(try as.nextInstruction()).?});
1646 try std.testing.expectFmt("yield", "{f}", .{(try as.nextInstruction()).?});
1647 try std.testing.expectFmt("wfe", "{f}", .{(try as.nextInstruction()).?});
1648 try std.testing.expectFmt("wfe", "{f}", .{(try as.nextInstruction()).?});
1649 try std.testing.expectFmt("wfi", "{f}", .{(try as.nextInstruction()).?});
1650 try std.testing.expectFmt("wfi", "{f}", .{(try as.nextInstruction()).?});
1651 try std.testing.expectFmt("sev", "{f}", .{(try as.nextInstruction()).?});
1652 try std.testing.expectFmt("sev", "{f}", .{(try as.nextInstruction()).?});
1653 try std.testing.expectFmt("sevl", "{f}", .{(try as.nextInstruction()).?});
1654 try std.testing.expectFmt("sevl", "{f}", .{(try as.nextInstruction()).?});
1655 try std.testing.expectFmt("hint #0x7f", "{f}", .{(try as.nextInstruction()).?});
1656
1657 try std.testing.expect(null == try as.nextInstruction());
1658}
1659test "load store" {
1660 var as: Assemble = .{
1661 .source =
1662 \\ LDP w0, w1, [x2], #-256
1663 \\ LDP w3, w4, [x5], #0
1664 \\ LDP w6, w7, [sp], #252
1665 \\ LDP w0, w1, [x2, #-0x100]!
1666 \\ LDP w3, w4, [x5, #0]!
1667 \\ LDP w6, w7, [sp, #0xfc]!
1668 \\ LDP w0, w1, [x2, #-256]
1669 \\ LDP w3, w4, [x5]
1670 \\ LDP w6, w7, [x8, #0]
1671 \\ LDP w9, w10, [sp, #252]
1672 \\
1673 \\ LDP x0, x1, [x2], #-512
1674 \\ LDP x3, x4, [x5], #0
1675 \\ LDP x6, x7, [sp], #504
1676 \\ LDP x0, x1, [x2, #-0x200]!
1677 \\ LDP x3, x4, [x5, #0]!
1678 \\ LDP x6, x7, [sp, #0x1f8]!
1679 \\ LDP x0, x1, [x2, #-512]
1680 \\ LDP x3, x4, [x5]
1681 \\ LDP x6, x7, [x8, #0]
1682 \\ LDP x9, x10, [sp, #504]
1683 \\
1684 \\ LDR w0, [x1], #-256
1685 \\ LDR w2, [x3], #0
1686 \\ LDR w4, [sp], #255
1687 \\ LDR w0, [x1, #-0x100]!
1688 \\ LDR w2, [x3, #0]!
1689 \\ LDR w4, [sp, #0xff]!
1690 \\ LDR w0, [x1, #0]
1691 \\ LDR w2, [x3]
1692 \\ LDR w4, [sp, #16380]
1693 \\
1694 \\ LDR x0, [x1], #-256
1695 \\ LDR x2, [x3], #0
1696 \\ LDR x4, [sp], #255
1697 \\ LDR x0, [x1, #-0x100]!
1698 \\ LDR x2, [x3, #0]!
1699 \\ LDR x4, [sp, #0xff]!
1700 \\ LDR x0, [x1, #0]
1701 \\ LDR x2, [x3]
1702 \\ LDR x4, [sp, #32760]
1703 \\
1704 \\ STP w0, w1, [x2], #-256
1705 \\ STP w3, w4, [x5], #0
1706 \\ STP w6, w7, [sp], #252
1707 \\ STP w0, w1, [x2, #-0x100]!
1708 \\ STP w3, w4, [x5, #0]!
1709 \\ STP w6, w7, [sp, #0xfc]!
1710 \\ STP w0, w1, [x2, #-256]
1711 \\ STP w3, w4, [x5]
1712 \\ STP w6, w7, [x8, #0]
1713 \\ STP w9, w10, [sp, #252]
1714 \\
1715 \\ STP x0, x1, [x2], #-512
1716 \\ STP x3, x4, [x5], #0
1717 \\ STP x6, x7, [sp], #504
1718 \\ STP x0, x1, [x2, #-0x200]!
1719 \\ STP x3, x4, [x5, #0]!
1720 \\ STP x6, x7, [sp, #0x1f8]!
1721 \\ STP x0, x1, [x2, #-512]
1722 \\ STP x3, x4, [x5]
1723 \\ STP x6, x7, [x8, #0]
1724 \\ STP x9, x10, [sp, #504]
1725 \\
1726 \\ STR w0, [x1], #-256
1727 \\ STR w2, [x3], #0
1728 \\ STR w4, [sp], #255
1729 \\ STR w0, [x1, #-0x100]!
1730 \\ STR w2, [x3, #0]!
1731 \\ STR w4, [sp, #0xff]!
1732 \\ STR w0, [x1, #0]
1733 \\ STR w2, [x3]
1734 \\ STR w4, [sp, #16380]
1735 \\
1736 \\ STR x0, [x1], #-256
1737 \\ STR x2, [x3], #0
1738 \\ STR x4, [sp], #255
1739 \\ STR x0, [x1, #-0x100]!
1740 \\ STR x2, [x3, #0]!
1741 \\ STR x4, [sp, #0xff]!
1742 \\ STR x0, [x1, #0]
1743 \\ STR x2, [x3]
1744 \\ STR x4, [sp, #32760]
1745 ,
1746 .operands = .empty,
1747 };
1748
1749 try std.testing.expectFmt("ldp w0, w1, [x2], #-0x100", "{f}", .{(try as.nextInstruction()).?});
1750 try std.testing.expectFmt("ldp w3, w4, [x5], #0x0", "{f}", .{(try as.nextInstruction()).?});
1751 try std.testing.expectFmt("ldp w6, w7, [sp], #0xfc", "{f}", .{(try as.nextInstruction()).?});
1752 try std.testing.expectFmt("ldp w0, w1, [x2, #-0x100]!", "{f}", .{(try as.nextInstruction()).?});
1753 try std.testing.expectFmt("ldp w3, w4, [x5, #0x0]!", "{f}", .{(try as.nextInstruction()).?});
1754 try std.testing.expectFmt("ldp w6, w7, [sp, #0xfc]!", "{f}", .{(try as.nextInstruction()).?});
1755 try std.testing.expectFmt("ldp w0, w1, [x2, #-0x100]", "{f}", .{(try as.nextInstruction()).?});
1756 try std.testing.expectFmt("ldp w3, w4, [x5]", "{f}", .{(try as.nextInstruction()).?});
1757 try std.testing.expectFmt("ldp w6, w7, [x8]", "{f}", .{(try as.nextInstruction()).?});
1758 try std.testing.expectFmt("ldp w9, w10, [sp, #0xfc]", "{f}", .{(try as.nextInstruction()).?});
1759
1760 try std.testing.expectFmt("ldp x0, x1, [x2], #-0x200", "{f}", .{(try as.nextInstruction()).?});
1761 try std.testing.expectFmt("ldp x3, x4, [x5], #0x0", "{f}", .{(try as.nextInstruction()).?});
1762 try std.testing.expectFmt("ldp x6, x7, [sp], #0x1f8", "{f}", .{(try as.nextInstruction()).?});
1763 try std.testing.expectFmt("ldp x0, x1, [x2, #-0x200]!", "{f}", .{(try as.nextInstruction()).?});
1764 try std.testing.expectFmt("ldp x3, x4, [x5, #0x0]!", "{f}", .{(try as.nextInstruction()).?});
1765 try std.testing.expectFmt("ldp x6, x7, [sp, #0x1f8]!", "{f}", .{(try as.nextInstruction()).?});
1766 try std.testing.expectFmt("ldp x0, x1, [x2, #-0x200]", "{f}", .{(try as.nextInstruction()).?});
1767 try std.testing.expectFmt("ldp x3, x4, [x5]", "{f}", .{(try as.nextInstruction()).?});
1768 try std.testing.expectFmt("ldp x6, x7, [x8]", "{f}", .{(try as.nextInstruction()).?});
1769 try std.testing.expectFmt("ldp x9, x10, [sp, #0x1f8]", "{f}", .{(try as.nextInstruction()).?});
1770
1771 try std.testing.expectFmt("ldr w0, [x1], #-0x100", "{f}", .{(try as.nextInstruction()).?});
1772 try std.testing.expectFmt("ldr w2, [x3], #0x0", "{f}", .{(try as.nextInstruction()).?});
1773 try std.testing.expectFmt("ldr w4, [sp], #0xff", "{f}", .{(try as.nextInstruction()).?});
1774 try std.testing.expectFmt("ldr w0, [x1, #-0x100]!", "{f}", .{(try as.nextInstruction()).?});
1775 try std.testing.expectFmt("ldr w2, [x3, #0x0]!", "{f}", .{(try as.nextInstruction()).?});
1776 try std.testing.expectFmt("ldr w4, [sp, #0xff]!", "{f}", .{(try as.nextInstruction()).?});
1777 try std.testing.expectFmt("ldr w0, [x1]", "{f}", .{(try as.nextInstruction()).?});
1778 try std.testing.expectFmt("ldr w2, [x3]", "{f}", .{(try as.nextInstruction()).?});
1779 try std.testing.expectFmt("ldr w4, [sp, #0x3ffc]", "{f}", .{(try as.nextInstruction()).?});
1780
1781 try std.testing.expectFmt("ldr x0, [x1], #-0x100", "{f}", .{(try as.nextInstruction()).?});
1782 try std.testing.expectFmt("ldr x2, [x3], #0x0", "{f}", .{(try as.nextInstruction()).?});
1783 try std.testing.expectFmt("ldr x4, [sp], #0xff", "{f}", .{(try as.nextInstruction()).?});
1784 try std.testing.expectFmt("ldr x0, [x1, #-0x100]!", "{f}", .{(try as.nextInstruction()).?});
1785 try std.testing.expectFmt("ldr x2, [x3, #0x0]!", "{f}", .{(try as.nextInstruction()).?});
1786 try std.testing.expectFmt("ldr x4, [sp, #0xff]!", "{f}", .{(try as.nextInstruction()).?});
1787 try std.testing.expectFmt("ldr x0, [x1]", "{f}", .{(try as.nextInstruction()).?});
1788 try std.testing.expectFmt("ldr x2, [x3]", "{f}", .{(try as.nextInstruction()).?});
1789 try std.testing.expectFmt("ldr x4, [sp, #0x7ff8]", "{f}", .{(try as.nextInstruction()).?});
1790
1791 try std.testing.expectFmt("stp w0, w1, [x2], #-0x100", "{f}", .{(try as.nextInstruction()).?});
1792 try std.testing.expectFmt("stp w3, w4, [x5], #0x0", "{f}", .{(try as.nextInstruction()).?});
1793 try std.testing.expectFmt("stp w6, w7, [sp], #0xfc", "{f}", .{(try as.nextInstruction()).?});
1794 try std.testing.expectFmt("stp w0, w1, [x2, #-0x100]!", "{f}", .{(try as.nextInstruction()).?});
1795 try std.testing.expectFmt("stp w3, w4, [x5, #0x0]!", "{f}", .{(try as.nextInstruction()).?});
1796 try std.testing.expectFmt("stp w6, w7, [sp, #0xfc]!", "{f}", .{(try as.nextInstruction()).?});
1797 try std.testing.expectFmt("stp w0, w1, [x2, #-0x100]", "{f}", .{(try as.nextInstruction()).?});
1798 try std.testing.expectFmt("stp w3, w4, [x5]", "{f}", .{(try as.nextInstruction()).?});
1799 try std.testing.expectFmt("stp w6, w7, [x8]", "{f}", .{(try as.nextInstruction()).?});
1800 try std.testing.expectFmt("stp w9, w10, [sp, #0xfc]", "{f}", .{(try as.nextInstruction()).?});
1801
1802 try std.testing.expectFmt("stp x0, x1, [x2], #-0x200", "{f}", .{(try as.nextInstruction()).?});
1803 try std.testing.expectFmt("stp x3, x4, [x5], #0x0", "{f}", .{(try as.nextInstruction()).?});
1804 try std.testing.expectFmt("stp x6, x7, [sp], #0x1f8", "{f}", .{(try as.nextInstruction()).?});
1805 try std.testing.expectFmt("stp x0, x1, [x2, #-0x200]!", "{f}", .{(try as.nextInstruction()).?});
1806 try std.testing.expectFmt("stp x3, x4, [x5, #0x0]!", "{f}", .{(try as.nextInstruction()).?});
1807 try std.testing.expectFmt("stp x6, x7, [sp, #0x1f8]!", "{f}", .{(try as.nextInstruction()).?});
1808 try std.testing.expectFmt("stp x0, x1, [x2, #-0x200]", "{f}", .{(try as.nextInstruction()).?});
1809 try std.testing.expectFmt("stp x3, x4, [x5]", "{f}", .{(try as.nextInstruction()).?});
1810 try std.testing.expectFmt("stp x6, x7, [x8]", "{f}", .{(try as.nextInstruction()).?});
1811 try std.testing.expectFmt("stp x9, x10, [sp, #0x1f8]", "{f}", .{(try as.nextInstruction()).?});
1812
1813 try std.testing.expectFmt("str w0, [x1], #-0x100", "{f}", .{(try as.nextInstruction()).?});
1814 try std.testing.expectFmt("str w2, [x3], #0x0", "{f}", .{(try as.nextInstruction()).?});
1815 try std.testing.expectFmt("str w4, [sp], #0xff", "{f}", .{(try as.nextInstruction()).?});
1816 try std.testing.expectFmt("str w0, [x1, #-0x100]!", "{f}", .{(try as.nextInstruction()).?});
1817 try std.testing.expectFmt("str w2, [x3, #0x0]!", "{f}", .{(try as.nextInstruction()).?});
1818 try std.testing.expectFmt("str w4, [sp, #0xff]!", "{f}", .{(try as.nextInstruction()).?});
1819 try std.testing.expectFmt("str w0, [x1]", "{f}", .{(try as.nextInstruction()).?});
1820 try std.testing.expectFmt("str w2, [x3]", "{f}", .{(try as.nextInstruction()).?});
1821 try std.testing.expectFmt("str w4, [sp, #0x3ffc]", "{f}", .{(try as.nextInstruction()).?});
1822
1823 try std.testing.expectFmt("str x0, [x1], #-0x100", "{f}", .{(try as.nextInstruction()).?});
1824 try std.testing.expectFmt("str x2, [x3], #0x0", "{f}", .{(try as.nextInstruction()).?});
1825 try std.testing.expectFmt("str x4, [sp], #0xff", "{f}", .{(try as.nextInstruction()).?});
1826 try std.testing.expectFmt("str x0, [x1, #-0x100]!", "{f}", .{(try as.nextInstruction()).?});
1827 try std.testing.expectFmt("str x2, [x3, #0x0]!", "{f}", .{(try as.nextInstruction()).?});
1828 try std.testing.expectFmt("str x4, [sp, #0xff]!", "{f}", .{(try as.nextInstruction()).?});
1829 try std.testing.expectFmt("str x0, [x1]", "{f}", .{(try as.nextInstruction()).?});
1830 try std.testing.expectFmt("str x2, [x3]", "{f}", .{(try as.nextInstruction()).?});
1831 try std.testing.expectFmt("str x4, [sp, #0x7ff8]", "{f}", .{(try as.nextInstruction()).?});
1832
1833 try std.testing.expect(null == try as.nextInstruction());
1834}
1835test "logical" {
1836 var as: Assemble = .{
1837 .source =
1838 \\ and w0, w0, w0
1839 \\ and w1, w1, w2, lsl #0
1840 \\ and w3, w4, w5, lsl #1
1841 \\ and w6, w6, wzr, lsl #31
1842 \\ and w7, wzr, w8, lsr #0
1843 \\ and w9, wzr, wzr, lsr #30
1844 \\ and wzr, w10, w11, lsr #31
1845 \\ and wzr, w12, wzr, asr #0x0
1846 \\ and wzr, wzr, w13, asr #0x10
1847 \\ and wzr, wzr, wzr, asr #0x1f
1848 \\ and w0, w0, wzr
1849 \\ and w1, w2, wzr, lsl #0
1850 \\ and w3, wzr, w3
1851 \\ and w4, wzr, w5, lsl #0
1852 \\ and w6, wzr, wzr
1853 \\ and w7, wzr, wzr, lsl #0
1854 \\ and wzr, w8, wzr
1855 \\ and wzr, w9, wzr, lsl #0
1856 \\ and wzr, wzr, w10
1857 \\ and wzr, wzr, w11, lsl #0
1858 \\ and wzr, wzr, wzr
1859 \\ and wzr, wzr, wzr, lsl #0
1860 \\
1861 \\ and x0, x0, x0
1862 \\ and x1, x1, x2, lsl #0
1863 \\ and x3, x4, x5, lsl #1
1864 \\ and x6, x6, xzr, lsl #63
1865 \\ and x7, xzr, x8, lsr #0
1866 \\ and x9, xzr, xzr, lsr #62
1867 \\ and xzr, x10, x11, lsr #63
1868 \\ and xzr, x12, xzr, asr #0x0
1869 \\ and xzr, xzr, x13, asr #0x1F
1870 \\ and xzr, xzr, xzr, asr #0x3f
1871 \\ and x0, x0, xzr
1872 \\ and x1, x2, xzr, lsl #0
1873 \\ and x3, xzr, x3
1874 \\ and x4, xzr, x5, lsl #0
1875 \\ and x6, xzr, xzr
1876 \\ and x7, xzr, xzr, lsl #0
1877 \\ and xzr, x8, xzr
1878 \\ and xzr, x9, xzr, lsl #0
1879 \\ and xzr, xzr, x10
1880 \\ and xzr, xzr, x11, lsl #0
1881 \\ and xzr, xzr, xzr
1882 \\ and xzr, xzr, xzr, lsl #0
1883 \\
1884 \\ orr w0, w0, w0
1885 \\ orr w1, w1, w2, lsl #0
1886 \\ orr w3, w4, w5, lsl #1
1887 \\ orr w6, w6, wzr, lsl #31
1888 \\ orr w7, wzr, w8, lsr #0
1889 \\ orr w9, wzr, wzr, lsr #30
1890 \\ orr wzr, w10, w11, lsr #31
1891 \\ orr wzr, w12, wzr, asr #0x0
1892 \\ orr wzr, wzr, w13, asr #0x10
1893 \\ orr wzr, wzr, wzr, asr #0x1f
1894 \\ orr w0, w0, wzr
1895 \\ orr w1, w2, wzr, lsl #0
1896 \\ orr w3, wzr, w3
1897 \\ orr w4, wzr, w5, lsl #0
1898 \\ orr w6, wzr, wzr
1899 \\ orr w7, wzr, wzr, lsl #0
1900 \\ orr wzr, w8, wzr
1901 \\ orr wzr, w9, wzr, lsl #0
1902 \\ orr wzr, wzr, w10
1903 \\ orr wzr, wzr, w11, lsl #0
1904 \\ orr wzr, wzr, wzr
1905 \\ orr wzr, wzr, wzr, lsl #0
1906 \\
1907 \\ orr x0, x0, x0
1908 \\ orr x1, x1, x2, lsl #0
1909 \\ orr x3, x4, x5, lsl #1
1910 \\ orr x6, x6, xzr, lsl #63
1911 \\ orr x7, xzr, x8, lsr #0
1912 \\ orr x9, xzr, xzr, lsr #62
1913 \\ orr xzr, x10, x11, lsr #63
1914 \\ orr xzr, x12, xzr, asr #0x0
1915 \\ orr xzr, xzr, x13, asr #0x1F
1916 \\ orr xzr, xzr, xzr, asr #0x3f
1917 \\ orr x0, x0, xzr
1918 \\ orr x1, x2, xzr, lsl #0
1919 \\ orr x3, xzr, x3
1920 \\ orr x4, xzr, x5, lsl #0
1921 \\ orr x6, xzr, xzr
1922 \\ orr x7, xzr, xzr, lsl #0
1923 \\ orr xzr, x8, xzr
1924 \\ orr xzr, x9, xzr, lsl #0
1925 \\ orr xzr, xzr, x10
1926 \\ orr xzr, xzr, x11, lsl #0
1927 \\ orr xzr, xzr, xzr
1928 \\ orr xzr, xzr, xzr, lsl #0
1929 \\
1930 \\ eor w0, w0, w0
1931 \\ eor w1, w1, w2, lsl #0
1932 \\ eor w3, w4, w5, lsl #1
1933 \\ eor w6, w6, wzr, lsl #31
1934 \\ eor w7, wzr, w8, lsr #0
1935 \\ eor w9, wzr, wzr, lsr #30
1936 \\ eor wzr, w10, w11, lsr #31
1937 \\ eor wzr, w12, wzr, asr #0x0
1938 \\ eor wzr, wzr, w13, asr #0x10
1939 \\ eor wzr, wzr, wzr, asr #0x1f
1940 \\ eor w0, w0, wzr
1941 \\ eor w1, w2, wzr, lsl #0
1942 \\ eor w3, wzr, w3
1943 \\ eor w4, wzr, w5, lsl #0
1944 \\ eor w6, wzr, wzr
1945 \\ eor w7, wzr, wzr, lsl #0
1946 \\ eor wzr, w8, wzr
1947 \\ eor wzr, w9, wzr, lsl #0
1948 \\ eor wzr, wzr, w10
1949 \\ eor wzr, wzr, w11, lsl #0
1950 \\ eor wzr, wzr, wzr
1951 \\ eor wzr, wzr, wzr, lsl #0
1952 \\
1953 \\ eor x0, x0, x0
1954 \\ eor x1, x1, x2, lsl #0
1955 \\ eor x3, x4, x5, lsl #1
1956 \\ eor x6, x6, xzr, lsl #63
1957 \\ eor x7, xzr, x8, lsr #0
1958 \\ eor x9, xzr, xzr, lsr #62
1959 \\ eor xzr, x10, x11, lsr #63
1960 \\ eor xzr, x12, xzr, asr #0x0
1961 \\ eor xzr, xzr, x13, asr #0x1F
1962 \\ eor xzr, xzr, xzr, asr #0x3f
1963 \\ eor x0, x0, xzr
1964 \\ eor x1, x2, xzr, lsl #0
1965 \\ eor x3, xzr, x3
1966 \\ eor x4, xzr, x5, lsl #0
1967 \\ eor x6, xzr, xzr
1968 \\ eor x7, xzr, xzr, lsl #0
1969 \\ eor xzr, x8, xzr
1970 \\ eor xzr, x9, xzr, lsl #0
1971 \\ eor xzr, xzr, x10
1972 \\ eor xzr, xzr, x11, lsl #0
1973 \\ eor xzr, xzr, xzr
1974 \\ eor xzr, xzr, xzr, lsl #0
1975 \\
1976 \\ ands w0, w0, w0
1977 \\ ands w1, w1, w2, lsl #0
1978 \\ ands w3, w4, w5, lsl #1
1979 \\ ands w6, w6, wzr, lsl #31
1980 \\ ands w7, wzr, w8, lsr #0
1981 \\ ands w9, wzr, wzr, lsr #30
1982 \\ ands wzr, w10, w11, lsr #31
1983 \\ ands wzr, w12, wzr, asr #0x0
1984 \\ ands wzr, wzr, w13, asr #0x10
1985 \\ ands wzr, wzr, wzr, asr #0x1f
1986 \\ ands w0, w0, wzr
1987 \\ ands w1, w2, wzr, lsl #0
1988 \\ ands w3, wzr, w3
1989 \\ ands w4, wzr, w5, lsl #0
1990 \\ ands w6, wzr, wzr
1991 \\ ands w7, wzr, wzr, lsl #0
1992 \\ ands wzr, w8, wzr
1993 \\ ands wzr, w9, wzr, lsl #0
1994 \\ ands wzr, wzr, w10
1995 \\ ands wzr, wzr, w11, lsl #0
1996 \\ ands wzr, wzr, wzr
1997 \\ ands wzr, wzr, wzr, lsl #0
1998 \\
1999 \\ ands x0, x0, x0
2000 \\ ands x1, x1, x2, lsl #0
2001 \\ ands x3, x4, x5, lsl #1
2002 \\ ands x6, x6, xzr, lsl #63
2003 \\ ands x7, xzr, x8, lsr #0
2004 \\ ands x9, xzr, xzr, lsr #62
2005 \\ ands xzr, x10, x11, lsr #63
2006 \\ ands xzr, x12, xzr, asr #0x0
2007 \\ ands xzr, xzr, x13, asr #0x1F
2008 \\ ands xzr, xzr, xzr, asr #0x3f
2009 \\ ands x0, x0, xzr
2010 \\ ands x1, x2, xzr, lsl #0
2011 \\ ands x3, xzr, x3
2012 \\ ands x4, xzr, x5, lsl #0
2013 \\ ands x6, xzr, xzr
2014 \\ ands x7, xzr, xzr, lsl #0
2015 \\ ands xzr, x8, xzr
2016 \\ ands xzr, x9, xzr, lsl #0
2017 \\ ands xzr, xzr, x10
2018 \\ ands xzr, xzr, x11, lsl #0
2019 \\ ands xzr, xzr, xzr
2020 \\ ands xzr, xzr, xzr, lsl #0
2021 ,
2022 .operands = .empty,
2023 };
2024
2025 try std.testing.expectFmt("and w0, w0, w0", "{f}", .{(try as.nextInstruction()).?});
2026 try std.testing.expectFmt("and w1, w1, w2", "{f}", .{(try as.nextInstruction()).?});
2027 try std.testing.expectFmt("and w3, w4, w5, lsl #1", "{f}", .{(try as.nextInstruction()).?});
2028 try std.testing.expectFmt("and w6, w6, wzr, lsl #31", "{f}", .{(try as.nextInstruction()).?});
2029 try std.testing.expectFmt("and w7, wzr, w8, lsr #0", "{f}", .{(try as.nextInstruction()).?});
2030 try std.testing.expectFmt("and w9, wzr, wzr, lsr #30", "{f}", .{(try as.nextInstruction()).?});
2031 try std.testing.expectFmt("and wzr, w10, w11, lsr #31", "{f}", .{(try as.nextInstruction()).?});
2032 try std.testing.expectFmt("and wzr, w12, wzr, asr #0", "{f}", .{(try as.nextInstruction()).?});
2033 try std.testing.expectFmt("and wzr, wzr, w13, asr #16", "{f}", .{(try as.nextInstruction()).?});
2034 try std.testing.expectFmt("and wzr, wzr, wzr, asr #31", "{f}", .{(try as.nextInstruction()).?});
2035 try std.testing.expectFmt("and w0, w0, wzr", "{f}", .{(try as.nextInstruction()).?});
2036 try std.testing.expectFmt("and w1, w2, wzr", "{f}", .{(try as.nextInstruction()).?});
2037 try std.testing.expectFmt("and w3, wzr, w3", "{f}", .{(try as.nextInstruction()).?});
2038 try std.testing.expectFmt("and w4, wzr, w5", "{f}", .{(try as.nextInstruction()).?});
2039 try std.testing.expectFmt("and w6, wzr, wzr", "{f}", .{(try as.nextInstruction()).?});
2040 try std.testing.expectFmt("and w7, wzr, wzr", "{f}", .{(try as.nextInstruction()).?});
2041 try std.testing.expectFmt("and wzr, w8, wzr", "{f}", .{(try as.nextInstruction()).?});
2042 try std.testing.expectFmt("and wzr, w9, wzr", "{f}", .{(try as.nextInstruction()).?});
2043 try std.testing.expectFmt("and wzr, wzr, w10", "{f}", .{(try as.nextInstruction()).?});
2044 try std.testing.expectFmt("and wzr, wzr, w11", "{f}", .{(try as.nextInstruction()).?});
2045 try std.testing.expectFmt("and wzr, wzr, wzr", "{f}", .{(try as.nextInstruction()).?});
2046 try std.testing.expectFmt("and wzr, wzr, wzr", "{f}", .{(try as.nextInstruction()).?});
2047
2048 try std.testing.expectFmt("and x0, x0, x0", "{f}", .{(try as.nextInstruction()).?});
2049 try std.testing.expectFmt("and x1, x1, x2", "{f}", .{(try as.nextInstruction()).?});
2050 try std.testing.expectFmt("and x3, x4, x5, lsl #1", "{f}", .{(try as.nextInstruction()).?});
2051 try std.testing.expectFmt("and x6, x6, xzr, lsl #63", "{f}", .{(try as.nextInstruction()).?});
2052 try std.testing.expectFmt("and x7, xzr, x8, lsr #0", "{f}", .{(try as.nextInstruction()).?});
2053 try std.testing.expectFmt("and x9, xzr, xzr, lsr #62", "{f}", .{(try as.nextInstruction()).?});
2054 try std.testing.expectFmt("and xzr, x10, x11, lsr #63", "{f}", .{(try as.nextInstruction()).?});
2055 try std.testing.expectFmt("and xzr, x12, xzr, asr #0", "{f}", .{(try as.nextInstruction()).?});
2056 try std.testing.expectFmt("and xzr, xzr, x13, asr #31", "{f}", .{(try as.nextInstruction()).?});
2057 try std.testing.expectFmt("and xzr, xzr, xzr, asr #63", "{f}", .{(try as.nextInstruction()).?});
2058 try std.testing.expectFmt("and x0, x0, xzr", "{f}", .{(try as.nextInstruction()).?});
2059 try std.testing.expectFmt("and x1, x2, xzr", "{f}", .{(try as.nextInstruction()).?});
2060 try std.testing.expectFmt("and x3, xzr, x3", "{f}", .{(try as.nextInstruction()).?});
2061 try std.testing.expectFmt("and x4, xzr, x5", "{f}", .{(try as.nextInstruction()).?});
2062 try std.testing.expectFmt("and x6, xzr, xzr", "{f}", .{(try as.nextInstruction()).?});
2063 try std.testing.expectFmt("and x7, xzr, xzr", "{f}", .{(try as.nextInstruction()).?});
2064 try std.testing.expectFmt("and xzr, x8, xzr", "{f}", .{(try as.nextInstruction()).?});
2065 try std.testing.expectFmt("and xzr, x9, xzr", "{f}", .{(try as.nextInstruction()).?});
2066 try std.testing.expectFmt("and xzr, xzr, x10", "{f}", .{(try as.nextInstruction()).?});
2067 try std.testing.expectFmt("and xzr, xzr, x11", "{f}", .{(try as.nextInstruction()).?});
2068 try std.testing.expectFmt("and xzr, xzr, xzr", "{f}", .{(try as.nextInstruction()).?});
2069 try std.testing.expectFmt("and xzr, xzr, xzr", "{f}", .{(try as.nextInstruction()).?});
2070
2071 try std.testing.expectFmt("orr w0, w0, w0", "{f}", .{(try as.nextInstruction()).?});
2072 try std.testing.expectFmt("orr w1, w1, w2", "{f}", .{(try as.nextInstruction()).?});
2073 try std.testing.expectFmt("orr w3, w4, w5, lsl #1", "{f}", .{(try as.nextInstruction()).?});
2074 try std.testing.expectFmt("orr w6, w6, wzr, lsl #31", "{f}", .{(try as.nextInstruction()).?});
2075 try std.testing.expectFmt("orr w7, wzr, w8, lsr #0", "{f}", .{(try as.nextInstruction()).?});
2076 try std.testing.expectFmt("orr w9, wzr, wzr, lsr #30", "{f}", .{(try as.nextInstruction()).?});
2077 try std.testing.expectFmt("orr wzr, w10, w11, lsr #31", "{f}", .{(try as.nextInstruction()).?});
2078 try std.testing.expectFmt("orr wzr, w12, wzr, asr #0", "{f}", .{(try as.nextInstruction()).?});
2079 try std.testing.expectFmt("orr wzr, wzr, w13, asr #16", "{f}", .{(try as.nextInstruction()).?});
2080 try std.testing.expectFmt("orr wzr, wzr, wzr, asr #31", "{f}", .{(try as.nextInstruction()).?});
2081 try std.testing.expectFmt("orr w0, w0, wzr", "{f}", .{(try as.nextInstruction()).?});
2082 try std.testing.expectFmt("orr w1, w2, wzr", "{f}", .{(try as.nextInstruction()).?});
2083 try std.testing.expectFmt("mov w3, w3", "{f}", .{(try as.nextInstruction()).?});
2084 try std.testing.expectFmt("mov w4, w5", "{f}", .{(try as.nextInstruction()).?});
2085 try std.testing.expectFmt("mov w6, wzr", "{f}", .{(try as.nextInstruction()).?});
2086 try std.testing.expectFmt("mov w7, wzr", "{f}", .{(try as.nextInstruction()).?});
2087 try std.testing.expectFmt("orr wzr, w8, wzr", "{f}", .{(try as.nextInstruction()).?});
2088 try std.testing.expectFmt("orr wzr, w9, wzr", "{f}", .{(try as.nextInstruction()).?});
2089 try std.testing.expectFmt("mov wzr, w10", "{f}", .{(try as.nextInstruction()).?});
2090 try std.testing.expectFmt("mov wzr, w11", "{f}", .{(try as.nextInstruction()).?});
2091 try std.testing.expectFmt("mov wzr, wzr", "{f}", .{(try as.nextInstruction()).?});
2092 try std.testing.expectFmt("mov wzr, wzr", "{f}", .{(try as.nextInstruction()).?});
2093
2094 try std.testing.expectFmt("orr x0, x0, x0", "{f}", .{(try as.nextInstruction()).?});
2095 try std.testing.expectFmt("orr x1, x1, x2", "{f}", .{(try as.nextInstruction()).?});
2096 try std.testing.expectFmt("orr x3, x4, x5, lsl #1", "{f}", .{(try as.nextInstruction()).?});
2097 try std.testing.expectFmt("orr x6, x6, xzr, lsl #63", "{f}", .{(try as.nextInstruction()).?});
2098 try std.testing.expectFmt("orr x7, xzr, x8, lsr #0", "{f}", .{(try as.nextInstruction()).?});
2099 try std.testing.expectFmt("orr x9, xzr, xzr, lsr #62", "{f}", .{(try as.nextInstruction()).?});
2100 try std.testing.expectFmt("orr xzr, x10, x11, lsr #63", "{f}", .{(try as.nextInstruction()).?});
2101 try std.testing.expectFmt("orr xzr, x12, xzr, asr #0", "{f}", .{(try as.nextInstruction()).?});
2102 try std.testing.expectFmt("orr xzr, xzr, x13, asr #31", "{f}", .{(try as.nextInstruction()).?});
2103 try std.testing.expectFmt("orr xzr, xzr, xzr, asr #63", "{f}", .{(try as.nextInstruction()).?});
2104 try std.testing.expectFmt("orr x0, x0, xzr", "{f}", .{(try as.nextInstruction()).?});
2105 try std.testing.expectFmt("orr x1, x2, xzr", "{f}", .{(try as.nextInstruction()).?});
2106 try std.testing.expectFmt("mov x3, x3", "{f}", .{(try as.nextInstruction()).?});
2107 try std.testing.expectFmt("mov x4, x5", "{f}", .{(try as.nextInstruction()).?});
2108 try std.testing.expectFmt("mov x6, xzr", "{f}", .{(try as.nextInstruction()).?});
2109 try std.testing.expectFmt("mov x7, xzr", "{f}", .{(try as.nextInstruction()).?});
2110 try std.testing.expectFmt("orr xzr, x8, xzr", "{f}", .{(try as.nextInstruction()).?});
2111 try std.testing.expectFmt("orr xzr, x9, xzr", "{f}", .{(try as.nextInstruction()).?});
2112 try std.testing.expectFmt("mov xzr, x10", "{f}", .{(try as.nextInstruction()).?});
2113 try std.testing.expectFmt("mov xzr, x11", "{f}", .{(try as.nextInstruction()).?});
2114 try std.testing.expectFmt("mov xzr, xzr", "{f}", .{(try as.nextInstruction()).?});
2115 try std.testing.expectFmt("mov xzr, xzr", "{f}", .{(try as.nextInstruction()).?});
2116
2117 try std.testing.expectFmt("eor w0, w0, w0", "{f}", .{(try as.nextInstruction()).?});
2118 try std.testing.expectFmt("eor w1, w1, w2", "{f}", .{(try as.nextInstruction()).?});
2119 try std.testing.expectFmt("eor w3, w4, w5, lsl #1", "{f}", .{(try as.nextInstruction()).?});
2120 try std.testing.expectFmt("eor w6, w6, wzr, lsl #31", "{f}", .{(try as.nextInstruction()).?});
2121 try std.testing.expectFmt("eor w7, wzr, w8, lsr #0", "{f}", .{(try as.nextInstruction()).?});
2122 try std.testing.expectFmt("eor w9, wzr, wzr, lsr #30", "{f}", .{(try as.nextInstruction()).?});
2123 try std.testing.expectFmt("eor wzr, w10, w11, lsr #31", "{f}", .{(try as.nextInstruction()).?});
2124 try std.testing.expectFmt("eor wzr, w12, wzr, asr #0", "{f}", .{(try as.nextInstruction()).?});
2125 try std.testing.expectFmt("eor wzr, wzr, w13, asr #16", "{f}", .{(try as.nextInstruction()).?});
2126 try std.testing.expectFmt("eor wzr, wzr, wzr, asr #31", "{f}", .{(try as.nextInstruction()).?});
2127 try std.testing.expectFmt("eor w0, w0, wzr", "{f}", .{(try as.nextInstruction()).?});
2128 try std.testing.expectFmt("eor w1, w2, wzr", "{f}", .{(try as.nextInstruction()).?});
2129 try std.testing.expectFmt("eor w3, wzr, w3", "{f}", .{(try as.nextInstruction()).?});
2130 try std.testing.expectFmt("eor w4, wzr, w5", "{f}", .{(try as.nextInstruction()).?});
2131 try std.testing.expectFmt("eor w6, wzr, wzr", "{f}", .{(try as.nextInstruction()).?});
2132 try std.testing.expectFmt("eor w7, wzr, wzr", "{f}", .{(try as.nextInstruction()).?});
2133 try std.testing.expectFmt("eor wzr, w8, wzr", "{f}", .{(try as.nextInstruction()).?});
2134 try std.testing.expectFmt("eor wzr, w9, wzr", "{f}", .{(try as.nextInstruction()).?});
2135 try std.testing.expectFmt("eor wzr, wzr, w10", "{f}", .{(try as.nextInstruction()).?});
2136 try std.testing.expectFmt("eor wzr, wzr, w11", "{f}", .{(try as.nextInstruction()).?});
2137 try std.testing.expectFmt("eor wzr, wzr, wzr", "{f}", .{(try as.nextInstruction()).?});
2138 try std.testing.expectFmt("eor wzr, wzr, wzr", "{f}", .{(try as.nextInstruction()).?});
2139
2140 try std.testing.expectFmt("eor x0, x0, x0", "{f}", .{(try as.nextInstruction()).?});
2141 try std.testing.expectFmt("eor x1, x1, x2", "{f}", .{(try as.nextInstruction()).?});
2142 try std.testing.expectFmt("eor x3, x4, x5, lsl #1", "{f}", .{(try as.nextInstruction()).?});
2143 try std.testing.expectFmt("eor x6, x6, xzr, lsl #63", "{f}", .{(try as.nextInstruction()).?});
2144 try std.testing.expectFmt("eor x7, xzr, x8, lsr #0", "{f}", .{(try as.nextInstruction()).?});
2145 try std.testing.expectFmt("eor x9, xzr, xzr, lsr #62", "{f}", .{(try as.nextInstruction()).?});
2146 try std.testing.expectFmt("eor xzr, x10, x11, lsr #63", "{f}", .{(try as.nextInstruction()).?});
2147 try std.testing.expectFmt("eor xzr, x12, xzr, asr #0", "{f}", .{(try as.nextInstruction()).?});
2148 try std.testing.expectFmt("eor xzr, xzr, x13, asr #31", "{f}", .{(try as.nextInstruction()).?});
2149 try std.testing.expectFmt("eor xzr, xzr, xzr, asr #63", "{f}", .{(try as.nextInstruction()).?});
2150 try std.testing.expectFmt("eor x0, x0, xzr", "{f}", .{(try as.nextInstruction()).?});
2151 try std.testing.expectFmt("eor x1, x2, xzr", "{f}", .{(try as.nextInstruction()).?});
2152 try std.testing.expectFmt("eor x3, xzr, x3", "{f}", .{(try as.nextInstruction()).?});
2153 try std.testing.expectFmt("eor x4, xzr, x5", "{f}", .{(try as.nextInstruction()).?});
2154 try std.testing.expectFmt("eor x6, xzr, xzr", "{f}", .{(try as.nextInstruction()).?});
2155 try std.testing.expectFmt("eor x7, xzr, xzr", "{f}", .{(try as.nextInstruction()).?});
2156 try std.testing.expectFmt("eor xzr, x8, xzr", "{f}", .{(try as.nextInstruction()).?});
2157 try std.testing.expectFmt("eor xzr, x9, xzr", "{f}", .{(try as.nextInstruction()).?});
2158 try std.testing.expectFmt("eor xzr, xzr, x10", "{f}", .{(try as.nextInstruction()).?});
2159 try std.testing.expectFmt("eor xzr, xzr, x11", "{f}", .{(try as.nextInstruction()).?});
2160 try std.testing.expectFmt("eor xzr, xzr, xzr", "{f}", .{(try as.nextInstruction()).?});
2161 try std.testing.expectFmt("eor xzr, xzr, xzr", "{f}", .{(try as.nextInstruction()).?});
2162
2163 try std.testing.expectFmt("ands w0, w0, w0", "{f}", .{(try as.nextInstruction()).?});
2164 try std.testing.expectFmt("ands w1, w1, w2", "{f}", .{(try as.nextInstruction()).?});
2165 try std.testing.expectFmt("ands w3, w4, w5, lsl #1", "{f}", .{(try as.nextInstruction()).?});
2166 try std.testing.expectFmt("ands w6, w6, wzr, lsl #31", "{f}", .{(try as.nextInstruction()).?});
2167 try std.testing.expectFmt("ands w7, wzr, w8, lsr #0", "{f}", .{(try as.nextInstruction()).?});
2168 try std.testing.expectFmt("ands w9, wzr, wzr, lsr #30", "{f}", .{(try as.nextInstruction()).?});
2169 try std.testing.expectFmt("tst w10, w11, lsr #31", "{f}", .{(try as.nextInstruction()).?});
2170 try std.testing.expectFmt("tst w12, wzr, asr #0", "{f}", .{(try as.nextInstruction()).?});
2171 try std.testing.expectFmt("tst wzr, w13, asr #16", "{f}", .{(try as.nextInstruction()).?});
2172 try std.testing.expectFmt("tst wzr, wzr, asr #31", "{f}", .{(try as.nextInstruction()).?});
2173 try std.testing.expectFmt("ands w0, w0, wzr", "{f}", .{(try as.nextInstruction()).?});
2174 try std.testing.expectFmt("ands w1, w2, wzr", "{f}", .{(try as.nextInstruction()).?});
2175 try std.testing.expectFmt("ands w3, wzr, w3", "{f}", .{(try as.nextInstruction()).?});
2176 try std.testing.expectFmt("ands w4, wzr, w5", "{f}", .{(try as.nextInstruction()).?});
2177 try std.testing.expectFmt("ands w6, wzr, wzr", "{f}", .{(try as.nextInstruction()).?});
2178 try std.testing.expectFmt("ands w7, wzr, wzr", "{f}", .{(try as.nextInstruction()).?});
2179 try std.testing.expectFmt("tst w8, wzr", "{f}", .{(try as.nextInstruction()).?});
2180 try std.testing.expectFmt("tst w9, wzr", "{f}", .{(try as.nextInstruction()).?});
2181 try std.testing.expectFmt("tst wzr, w10", "{f}", .{(try as.nextInstruction()).?});
2182 try std.testing.expectFmt("tst wzr, w11", "{f}", .{(try as.nextInstruction()).?});
2183 try std.testing.expectFmt("tst wzr, wzr", "{f}", .{(try as.nextInstruction()).?});
2184 try std.testing.expectFmt("tst wzr, wzr", "{f}", .{(try as.nextInstruction()).?});
2185
2186 try std.testing.expectFmt("ands x0, x0, x0", "{f}", .{(try as.nextInstruction()).?});
2187 try std.testing.expectFmt("ands x1, x1, x2", "{f}", .{(try as.nextInstruction()).?});
2188 try std.testing.expectFmt("ands x3, x4, x5, lsl #1", "{f}", .{(try as.nextInstruction()).?});
2189 try std.testing.expectFmt("ands x6, x6, xzr, lsl #63", "{f}", .{(try as.nextInstruction()).?});
2190 try std.testing.expectFmt("ands x7, xzr, x8, lsr #0", "{f}", .{(try as.nextInstruction()).?});
2191 try std.testing.expectFmt("ands x9, xzr, xzr, lsr #62", "{f}", .{(try as.nextInstruction()).?});
2192 try std.testing.expectFmt("tst x10, x11, lsr #63", "{f}", .{(try as.nextInstruction()).?});
2193 try std.testing.expectFmt("tst x12, xzr, asr #0", "{f}", .{(try as.nextInstruction()).?});
2194 try std.testing.expectFmt("tst xzr, x13, asr #31", "{f}", .{(try as.nextInstruction()).?});
2195 try std.testing.expectFmt("tst xzr, xzr, asr #63", "{f}", .{(try as.nextInstruction()).?});
2196 try std.testing.expectFmt("ands x0, x0, xzr", "{f}", .{(try as.nextInstruction()).?});
2197 try std.testing.expectFmt("ands x1, x2, xzr", "{f}", .{(try as.nextInstruction()).?});
2198 try std.testing.expectFmt("ands x3, xzr, x3", "{f}", .{(try as.nextInstruction()).?});
2199 try std.testing.expectFmt("ands x4, xzr, x5", "{f}", .{(try as.nextInstruction()).?});
2200 try std.testing.expectFmt("ands x6, xzr, xzr", "{f}", .{(try as.nextInstruction()).?});
2201 try std.testing.expectFmt("ands x7, xzr, xzr", "{f}", .{(try as.nextInstruction()).?});
2202 try std.testing.expectFmt("tst x8, xzr", "{f}", .{(try as.nextInstruction()).?});
2203 try std.testing.expectFmt("tst x9, xzr", "{f}", .{(try as.nextInstruction()).?});
2204 try std.testing.expectFmt("tst xzr, x10", "{f}", .{(try as.nextInstruction()).?});
2205 try std.testing.expectFmt("tst xzr, x11", "{f}", .{(try as.nextInstruction()).?});
2206 try std.testing.expectFmt("tst xzr, xzr", "{f}", .{(try as.nextInstruction()).?});
2207 try std.testing.expectFmt("tst xzr, xzr", "{f}", .{(try as.nextInstruction()).?});
2208
2209 try std.testing.expect(null == try as.nextInstruction());
2210}
2211test "mov" {
2212 var as: Assemble = .{
2213 .source =
2214 \\MOV W0, #0
2215 \\MOV WZR, #0xffff
2216 \\
2217 \\MOV X0, #0
2218 \\MOV XZR, #0xffff
2219 \\
2220 \\MOV W0, WSP
2221 \\MOV WSP, W1
2222 \\MOV WSP, WSP
2223 \\MOV X0, SP
2224 \\MOV SP, X1
2225 \\MOV SP, SP
2226 \\
2227 \\MOV W0, W0
2228 \\MOV W1, W2
2229 \\MOV W3, WZR
2230 \\MOV WZR, W4
2231 \\MOV WZR, WZR
2232 \\MOV X0, X0
2233 \\MOV X1, X2
2234 \\MOV X3, XZR
2235 \\MOV XZR, X4
2236 \\MOV XZR, XZR
2237 \\
2238 \\MOVK W0, #0
2239 \\MOVK W1, #1, lsl #0
2240 \\MOVK W2, #2, lsl #16
2241 \\MOVK X3, #3
2242 \\MOVK X4, #4, lsl #0x00
2243 \\MOVK X5, #5, lsl #0x10
2244 \\MOVK X6, #6, lsl #0x20
2245 \\MOVK X7, #7, lsl #0x30
2246 \\
2247 \\MOVN W0, #8
2248 \\MOVN W1, #9, lsl #0
2249 \\MOVN W2, #10, lsl #16
2250 \\MOVN X3, #11
2251 \\MOVN X4, #12, lsl #0x00
2252 \\MOVN X5, #13, lsl #0x10
2253 \\MOVN X6, #14, lsl #0x20
2254 \\MOVN X7, #15, lsl #0x30
2255 \\
2256 \\MOVN WZR, #0, lsl #0
2257 \\MOVN WZR, #0, lsl #16
2258 \\MOVN XZR, #0, lsl #0
2259 \\MOVN XZR, #0, lsl #16
2260 \\MOVN XZR, #0, lsl #32
2261 \\MOVN XZR, #0, lsl #48
2262 \\
2263 \\MOVN WZR, #0xffff, lsl #0
2264 \\MOVN WZR, #0xffff, lsl #16
2265 \\MOVN XZR, #0xffff, lsl #0
2266 \\MOVN XZR, #0xffff, lsl #16
2267 \\MOVN XZR, #0xffff, lsl #32
2268 \\MOVN XZR, #0xffff, lsl #48
2269 \\
2270 \\MOVZ W0, #16
2271 \\MOVZ W1, #17, lsl #0
2272 \\MOVZ W2, #18, lsl #16
2273 \\MOVZ X3, #19
2274 \\MOVZ X4, #20, lsl #0x00
2275 \\MOVZ X5, #21, lsl #0x10
2276 \\MOVZ X6, #22, lsl #0x20
2277 \\MOVZ X7, #23, lsl #0x30
2278 \\
2279 \\MOVZ WZR, #0, lsl #0
2280 \\MOVZ WZR, #0, lsl #16
2281 \\MOVZ XZR, #0, lsl #0
2282 \\MOVZ XZR, #0, lsl #16
2283 \\MOVZ XZR, #0, lsl #32
2284 \\MOVZ XZR, #0, lsl #48
2285 \\
2286 \\MOVZ WZR, #0xffff, lsl #0
2287 \\MOVZ WZR, #0xffff, lsl #16
2288 \\MOVZ XZR, #0xffff, lsl #0
2289 \\MOVZ XZR, #0xffff, lsl #16
2290 \\MOVZ XZR, #0xffff, lsl #32
2291 \\MOVZ XZR, #0xffff, lsl #48
2292 \\
2293 \\DUP B0, V1.B[15]
2294 \\DUP H2, V3.H[7]
2295 \\DUP S4, V5.S[3]
2296 \\DUP D6, V7.D[1]
2297 \\
2298 \\DUP V0.8B, V1.B[0]
2299 \\DUP V2.16B, V3.B[15]
2300 \\DUP V4.4H, V5.H[0]
2301 \\DUP V6.8H, V7.H[7]
2302 \\DUP V8.2S, V9.S[0]
2303 \\DUP V10.4S, V11.S[3]
2304 \\DUP V12.2D, V13.D[1]
2305 \\
2306 \\DUP V0.8B, W1
2307 \\DUP V2.16B, W3
2308 \\DUP V4.4H, W5
2309 \\DUP V6.8H, W7
2310 \\DUP V8.2S, W9
2311 \\DUP V10.4S, W11
2312 \\DUP V12.2D, X13
2313 \\
2314 \\FMOV V0.4H, #-31
2315 \\FMOV V1.8H, #-2.625
2316 \\FMOV V2.2S, #-1
2317 \\FMOV V3.4S, #-.2421875
2318 \\FMOV V4.2D, #.2421875
2319 \\FMOV H5, H6
2320 \\FMOV S7, S8
2321 \\FMOV D9, D10
2322 \\FMOV W11, H12
2323 \\FMOV X13, H14
2324 \\FMOV H15, W16
2325 \\FMOV S17, W18
2326 \\FMOV W19, S20
2327 \\FMOV H21, X22
2328 \\FMOV D23, X24
2329 \\FMOV V25.D[0x1], X26
2330 \\FMOV X27, D28
2331 \\FMOV X29, V30 . D [ 0X1 ]
2332 \\FMOV H31, #1
2333 \\FMOV S30, #2.625
2334 \\FMOV D29, #31
2335 \\
2336 \\INS V0.B[0], V1.B[15]
2337 \\INS V2.H[0], V3.H[7]
2338 \\INS V4.S[0], V5.S[3]
2339 \\INS V6.D[0], V7.D[1]
2340 \\
2341 \\INS V0.B[15], W1
2342 \\INS V2.H[7], W3
2343 \\INS V4.S[3], W5
2344 \\INS V6.D[1], X7
2345 \\
2346 \\MOV B0, V1.B [ 0xf]
2347 \\MOV H2, V3.H [ 0x7]
2348 \\MOV S4, V5.S [ 0x3]
2349 \\MOV D6, V7.D [ 0x1]
2350 \\
2351 \\MOV V0.B[0], V1.B[15]
2352 \\MOV V2.H[0], V3.H[7]
2353 \\MOV V4.S[0], V5.S[3]
2354 \\MOV V6.D[0], V7.D[1]
2355 \\
2356 \\MOV V0.B[15], W1
2357 \\MOV V2.H[7], W3
2358 \\MOV V4.S[3], W5
2359 \\MOV V6.D[1], X7
2360 \\
2361 \\MOV V0.8B, V1.8B
2362 \\MOV V2.16B, V3.16B
2363 \\
2364 \\MOV W0, V1.S[0x3]
2365 \\MOV X2, V3.D[0x1]
2366 \\
2367 \\SMOV W0, V1.B[0xF]
2368 \\SMOV W2, V3.H[0x7]
2369 \\SMOV X4, V5.B[0xF]
2370 \\SMOV X6, V7.H[0x7]
2371 \\SMOV X8, V9.S[0x3]
2372 \\
2373 \\UMOV W0, V1.B[0xF]
2374 \\UMOV W2, V3.H[0x7]
2375 \\UMOV W4, V5.S[0x3]
2376 \\UMOV X6, V7.D[0x1]
2377 ,
2378 .operands = .empty,
2379 };
2380
2381 try std.testing.expectFmt("mov w0, #0x0", "{f}", .{(try as.nextInstruction()).?});
2382 try std.testing.expectFmt("mov wzr, #0xffff", "{f}", .{(try as.nextInstruction()).?});
2383 try std.testing.expectFmt("mov x0, #0x0", "{f}", .{(try as.nextInstruction()).?});
2384 try std.testing.expectFmt("mov xzr, #0xffff", "{f}", .{(try as.nextInstruction()).?});
2385
2386 try std.testing.expectFmt("mov w0, wsp", "{f}", .{(try as.nextInstruction()).?});
2387 try std.testing.expectFmt("mov wsp, w1", "{f}", .{(try as.nextInstruction()).?});
2388 try std.testing.expectFmt("mov wsp, wsp", "{f}", .{(try as.nextInstruction()).?});
2389 try std.testing.expectFmt("mov x0, sp", "{f}", .{(try as.nextInstruction()).?});
2390 try std.testing.expectFmt("mov sp, x1", "{f}", .{(try as.nextInstruction()).?});
2391 try std.testing.expectFmt("mov sp, sp", "{f}", .{(try as.nextInstruction()).?});
2392
2393 try std.testing.expectFmt("mov w0, w0", "{f}", .{(try as.nextInstruction()).?});
2394 try std.testing.expectFmt("mov w1, w2", "{f}", .{(try as.nextInstruction()).?});
2395 try std.testing.expectFmt("mov w3, wzr", "{f}", .{(try as.nextInstruction()).?});
2396 try std.testing.expectFmt("mov wzr, w4", "{f}", .{(try as.nextInstruction()).?});
2397 try std.testing.expectFmt("mov wzr, wzr", "{f}", .{(try as.nextInstruction()).?});
2398 try std.testing.expectFmt("mov x0, x0", "{f}", .{(try as.nextInstruction()).?});
2399 try std.testing.expectFmt("mov x1, x2", "{f}", .{(try as.nextInstruction()).?});
2400 try std.testing.expectFmt("mov x3, xzr", "{f}", .{(try as.nextInstruction()).?});
2401 try std.testing.expectFmt("mov xzr, x4", "{f}", .{(try as.nextInstruction()).?});
2402 try std.testing.expectFmt("mov xzr, xzr", "{f}", .{(try as.nextInstruction()).?});
2403
2404 try std.testing.expectFmt("movk w0, #0x0", "{f}", .{(try as.nextInstruction()).?});
2405 try std.testing.expectFmt("movk w1, #0x1", "{f}", .{(try as.nextInstruction()).?});
2406 try std.testing.expectFmt("movk w2, #0x2, lsl #16", "{f}", .{(try as.nextInstruction()).?});
2407 try std.testing.expectFmt("movk x3, #0x3", "{f}", .{(try as.nextInstruction()).?});
2408 try std.testing.expectFmt("movk x4, #0x4", "{f}", .{(try as.nextInstruction()).?});
2409 try std.testing.expectFmt("movk x5, #0x5, lsl #16", "{f}", .{(try as.nextInstruction()).?});
2410 try std.testing.expectFmt("movk x6, #0x6, lsl #32", "{f}", .{(try as.nextInstruction()).?});
2411 try std.testing.expectFmt("movk x7, #0x7, lsl #48", "{f}", .{(try as.nextInstruction()).?});
2412
2413 try std.testing.expectFmt("mov w0, #-0x9", "{f}", .{(try as.nextInstruction()).?});
2414 try std.testing.expectFmt("mov w1, #-0xa", "{f}", .{(try as.nextInstruction()).?});
2415 try std.testing.expectFmt("mov w2, #-0xa0001", "{f}", .{(try as.nextInstruction()).?});
2416 try std.testing.expectFmt("mov x3, #-0xc", "{f}", .{(try as.nextInstruction()).?});
2417 try std.testing.expectFmt("mov x4, #-0xd", "{f}", .{(try as.nextInstruction()).?});
2418 try std.testing.expectFmt("mov x5, #-0xd0001", "{f}", .{(try as.nextInstruction()).?});
2419 try std.testing.expectFmt("mov x6, #-0xe00000001", "{f}", .{(try as.nextInstruction()).?});
2420 try std.testing.expectFmt("mov x7, #-0xf000000000001", "{f}", .{(try as.nextInstruction()).?});
2421
2422 try std.testing.expectFmt("mov wzr, #-0x1", "{f}", .{(try as.nextInstruction()).?});
2423 try std.testing.expectFmt("movn wzr, #0x0, lsl #16", "{f}", .{(try as.nextInstruction()).?});
2424 try std.testing.expectFmt("mov xzr, #-0x1", "{f}", .{(try as.nextInstruction()).?});
2425 try std.testing.expectFmt("movn xzr, #0x0, lsl #16", "{f}", .{(try as.nextInstruction()).?});
2426 try std.testing.expectFmt("movn xzr, #0x0, lsl #32", "{f}", .{(try as.nextInstruction()).?});
2427 try std.testing.expectFmt("movn xzr, #0x0, lsl #48", "{f}", .{(try as.nextInstruction()).?});
2428
2429 try std.testing.expectFmt("movn wzr, #0xffff", "{f}", .{(try as.nextInstruction()).?});
2430 try std.testing.expectFmt("movn wzr, #0xffff, lsl #16", "{f}", .{(try as.nextInstruction()).?});
2431 try std.testing.expectFmt("mov xzr, #-0x10000", "{f}", .{(try as.nextInstruction()).?});
2432 try std.testing.expectFmt("mov xzr, #-0xffff0001", "{f}", .{(try as.nextInstruction()).?});
2433 try std.testing.expectFmt("mov xzr, #-0xffff00000001", "{f}", .{(try as.nextInstruction()).?});
2434 try std.testing.expectFmt("mov xzr, #0xffffffffffff", "{f}", .{(try as.nextInstruction()).?});
2435
2436 try std.testing.expectFmt("mov w0, #0x10", "{f}", .{(try as.nextInstruction()).?});
2437 try std.testing.expectFmt("mov w1, #0x11", "{f}", .{(try as.nextInstruction()).?});
2438 try std.testing.expectFmt("mov w2, #0x120000", "{f}", .{(try as.nextInstruction()).?});
2439 try std.testing.expectFmt("mov x3, #0x13", "{f}", .{(try as.nextInstruction()).?});
2440 try std.testing.expectFmt("mov x4, #0x14", "{f}", .{(try as.nextInstruction()).?});
2441 try std.testing.expectFmt("mov x5, #0x150000", "{f}", .{(try as.nextInstruction()).?});
2442 try std.testing.expectFmt("mov x6, #0x1600000000", "{f}", .{(try as.nextInstruction()).?});
2443 try std.testing.expectFmt("mov x7, #0x17000000000000", "{f}", .{(try as.nextInstruction()).?});
2444
2445 try std.testing.expectFmt("mov wzr, #0x0", "{f}", .{(try as.nextInstruction()).?});
2446 try std.testing.expectFmt("movz wzr, #0x0, lsl #16", "{f}", .{(try as.nextInstruction()).?});
2447 try std.testing.expectFmt("mov xzr, #0x0", "{f}", .{(try as.nextInstruction()).?});
2448 try std.testing.expectFmt("movz xzr, #0x0, lsl #16", "{f}", .{(try as.nextInstruction()).?});
2449 try std.testing.expectFmt("movz xzr, #0x0, lsl #32", "{f}", .{(try as.nextInstruction()).?});
2450 try std.testing.expectFmt("movz xzr, #0x0, lsl #48", "{f}", .{(try as.nextInstruction()).?});
2451
2452 try std.testing.expectFmt("mov wzr, #0xffff", "{f}", .{(try as.nextInstruction()).?});
2453 try std.testing.expectFmt("mov wzr, #-0x10000", "{f}", .{(try as.nextInstruction()).?});
2454 try std.testing.expectFmt("mov xzr, #0xffff", "{f}", .{(try as.nextInstruction()).?});
2455 try std.testing.expectFmt("mov xzr, #0xffff0000", "{f}", .{(try as.nextInstruction()).?});
2456 try std.testing.expectFmt("mov xzr, #0xffff00000000", "{f}", .{(try as.nextInstruction()).?});
2457 try std.testing.expectFmt("mov xzr, #-0x1000000000000", "{f}", .{(try as.nextInstruction()).?});
2458
2459 try std.testing.expectFmt("mov b0, v1.b[15]", "{f}", .{(try as.nextInstruction()).?});
2460 try std.testing.expectFmt("mov h2, v3.h[7]", "{f}", .{(try as.nextInstruction()).?});
2461 try std.testing.expectFmt("mov s4, v5.s[3]", "{f}", .{(try as.nextInstruction()).?});
2462 try std.testing.expectFmt("mov d6, v7.d[1]", "{f}", .{(try as.nextInstruction()).?});
2463
2464 try std.testing.expectFmt("dup v0.8b, v1.b[0]", "{f}", .{(try as.nextInstruction()).?});
2465 try std.testing.expectFmt("dup v2.16b, v3.b[15]", "{f}", .{(try as.nextInstruction()).?});
2466 try std.testing.expectFmt("dup v4.4h, v5.h[0]", "{f}", .{(try as.nextInstruction()).?});
2467 try std.testing.expectFmt("dup v6.8h, v7.h[7]", "{f}", .{(try as.nextInstruction()).?});
2468 try std.testing.expectFmt("dup v8.2s, v9.s[0]", "{f}", .{(try as.nextInstruction()).?});
2469 try std.testing.expectFmt("dup v10.4s, v11.s[3]", "{f}", .{(try as.nextInstruction()).?});
2470 try std.testing.expectFmt("dup v12.2d, v13.d[1]", "{f}", .{(try as.nextInstruction()).?});
2471
2472 try std.testing.expectFmt("dup v0.8b, w1", "{f}", .{(try as.nextInstruction()).?});
2473 try std.testing.expectFmt("dup v2.16b, w3", "{f}", .{(try as.nextInstruction()).?});
2474 try std.testing.expectFmt("dup v4.4h, w5", "{f}", .{(try as.nextInstruction()).?});
2475 try std.testing.expectFmt("dup v6.8h, w7", "{f}", .{(try as.nextInstruction()).?});
2476 try std.testing.expectFmt("dup v8.2s, w9", "{f}", .{(try as.nextInstruction()).?});
2477 try std.testing.expectFmt("dup v10.4s, w11", "{f}", .{(try as.nextInstruction()).?});
2478 try std.testing.expectFmt("dup v12.2d, x13", "{f}", .{(try as.nextInstruction()).?});
2479
2480 try std.testing.expectFmt("fmov v0.4h, #-31.0", "{f}", .{(try as.nextInstruction()).?});
2481 try std.testing.expectFmt("fmov v1.8h, #-2.625", "{f}", .{(try as.nextInstruction()).?});
2482 try std.testing.expectFmt("fmov v2.2s, #-1.0", "{f}", .{(try as.nextInstruction()).?});
2483 try std.testing.expectFmt("fmov v3.4s, #-0.2421875", "{f}", .{(try as.nextInstruction()).?});
2484 try std.testing.expectFmt("fmov v4.2d, #0.2421875", "{f}", .{(try as.nextInstruction()).?});
2485 try std.testing.expectFmt("fmov h5, h6", "{f}", .{(try as.nextInstruction()).?});
2486 try std.testing.expectFmt("fmov s7, s8", "{f}", .{(try as.nextInstruction()).?});
2487 try std.testing.expectFmt("fmov d9, d10", "{f}", .{(try as.nextInstruction()).?});
2488 try std.testing.expectFmt("fmov w11, h12", "{f}", .{(try as.nextInstruction()).?});
2489 try std.testing.expectFmt("fmov x13, h14", "{f}", .{(try as.nextInstruction()).?});
2490 try std.testing.expectFmt("fmov h15, w16", "{f}", .{(try as.nextInstruction()).?});
2491 try std.testing.expectFmt("fmov s17, w18", "{f}", .{(try as.nextInstruction()).?});
2492 try std.testing.expectFmt("fmov w19, s20", "{f}", .{(try as.nextInstruction()).?});
2493 try std.testing.expectFmt("fmov h21, x22", "{f}", .{(try as.nextInstruction()).?});
2494 try std.testing.expectFmt("fmov d23, x24", "{f}", .{(try as.nextInstruction()).?});
2495 try std.testing.expectFmt("fmov v25.d[1], x26", "{f}", .{(try as.nextInstruction()).?});
2496 try std.testing.expectFmt("fmov x27, d28", "{f}", .{(try as.nextInstruction()).?});
2497 try std.testing.expectFmt("fmov x29, v30.d[1]", "{f}", .{(try as.nextInstruction()).?});
2498 try std.testing.expectFmt("fmov h31, #1.0", "{f}", .{(try as.nextInstruction()).?});
2499 try std.testing.expectFmt("fmov s30, #2.625", "{f}", .{(try as.nextInstruction()).?});
2500 try std.testing.expectFmt("fmov d29, #31.0", "{f}", .{(try as.nextInstruction()).?});
2501
2502 try std.testing.expectFmt("mov v0.b[0], v1.b[15]", "{f}", .{(try as.nextInstruction()).?});
2503 try std.testing.expectFmt("mov v2.h[0], v3.h[7]", "{f}", .{(try as.nextInstruction()).?});
2504 try std.testing.expectFmt("mov v4.s[0], v5.s[3]", "{f}", .{(try as.nextInstruction()).?});
2505 try std.testing.expectFmt("mov v6.d[0], v7.d[1]", "{f}", .{(try as.nextInstruction()).?});
2506
2507 try std.testing.expectFmt("mov v0.b[15], w1", "{f}", .{(try as.nextInstruction()).?});
2508 try std.testing.expectFmt("mov v2.h[7], w3", "{f}", .{(try as.nextInstruction()).?});
2509 try std.testing.expectFmt("mov v4.s[3], w5", "{f}", .{(try as.nextInstruction()).?});
2510 try std.testing.expectFmt("mov v6.d[1], x7", "{f}", .{(try as.nextInstruction()).?});
2511
2512 try std.testing.expectFmt("mov b0, v1.b[15]", "{f}", .{(try as.nextInstruction()).?});
2513 try std.testing.expectFmt("mov h2, v3.h[7]", "{f}", .{(try as.nextInstruction()).?});
2514 try std.testing.expectFmt("mov s4, v5.s[3]", "{f}", .{(try as.nextInstruction()).?});
2515 try std.testing.expectFmt("mov d6, v7.d[1]", "{f}", .{(try as.nextInstruction()).?});
2516
2517 try std.testing.expectFmt("mov v0.b[0], v1.b[15]", "{f}", .{(try as.nextInstruction()).?});
2518 try std.testing.expectFmt("mov v2.h[0], v3.h[7]", "{f}", .{(try as.nextInstruction()).?});
2519 try std.testing.expectFmt("mov v4.s[0], v5.s[3]", "{f}", .{(try as.nextInstruction()).?});
2520 try std.testing.expectFmt("mov v6.d[0], v7.d[1]", "{f}", .{(try as.nextInstruction()).?});
2521
2522 try std.testing.expectFmt("mov v0.b[15], w1", "{f}", .{(try as.nextInstruction()).?});
2523 try std.testing.expectFmt("mov v2.h[7], w3", "{f}", .{(try as.nextInstruction()).?});
2524 try std.testing.expectFmt("mov v4.s[3], w5", "{f}", .{(try as.nextInstruction()).?});
2525 try std.testing.expectFmt("mov v6.d[1], x7", "{f}", .{(try as.nextInstruction()).?});
2526
2527 try std.testing.expectFmt("mov v0.8b, v1.8b", "{f}", .{(try as.nextInstruction()).?});
2528 try std.testing.expectFmt("mov v2.16b, v3.16b", "{f}", .{(try as.nextInstruction()).?});
2529
2530 try std.testing.expectFmt("mov w0, v1.s[3]", "{f}", .{(try as.nextInstruction()).?});
2531 try std.testing.expectFmt("mov x2, v3.d[1]", "{f}", .{(try as.nextInstruction()).?});
2532
2533 try std.testing.expectFmt("smov w0, v1.b[15]", "{f}", .{(try as.nextInstruction()).?});
2534 try std.testing.expectFmt("smov w2, v3.h[7]", "{f}", .{(try as.nextInstruction()).?});
2535 try std.testing.expectFmt("smov x4, v5.b[15]", "{f}", .{(try as.nextInstruction()).?});
2536 try std.testing.expectFmt("smov x6, v7.h[7]", "{f}", .{(try as.nextInstruction()).?});
2537 try std.testing.expectFmt("smov x8, v9.s[3]", "{f}", .{(try as.nextInstruction()).?});
2538
2539 try std.testing.expectFmt("umov w0, v1.b[15]", "{f}", .{(try as.nextInstruction()).?});
2540 try std.testing.expectFmt("umov w2, v3.h[7]", "{f}", .{(try as.nextInstruction()).?});
2541 try std.testing.expectFmt("mov w4, v5.s[3]", "{f}", .{(try as.nextInstruction()).?});
2542 try std.testing.expectFmt("mov x6, v7.d[1]", "{f}", .{(try as.nextInstruction()).?});
2543
2544 try std.testing.expect(null == try as.nextInstruction());
2545}
2546test "multiply" {
2547 var as: Assemble = .{
2548 .source =
2549 \\madd w0, w1, w2, w3
2550 \\madd w4, w5, w6, wzr
2551 \\mul w7, w8, w9
2552 \\madd x10, x11, x12, x13
2553 \\madd x14, x15, x16, xzr
2554 \\mul x17, x18, x19
2555 \\
2556 \\msub w0, w1, w2, w3
2557 \\msub w4, w5, w6, wzr
2558 \\mneg w7, w8, w9
2559 \\msub x10, x11, x12, x13
2560 \\msub x14, x15, x16, xzr
2561 \\mneg x17, x18, x19
2562 \\
2563 \\smaddl x0, w1, w2, x3
2564 \\smaddl x4, w5, w6, xzr
2565 \\smull x7, w8, w9
2566 \\
2567 \\smsubl x0, w1, w2, x3
2568 \\smsubl x4, w5, w6, xzr
2569 \\smnegl x7, w8, w9
2570 \\
2571 \\smulh x0, x1, x2
2572 \\smulh x3, x4, xzr
2573 \\
2574 \\umaddl x0, w1, w2, x3
2575 \\umaddl x4, w5, w6, xzr
2576 \\umull x7, w8, w9
2577 \\
2578 \\umsubl x0, w1, w2, x3
2579 \\umsubl x4, w5, w6, xzr
2580 \\umnegl x7, w8, w9
2581 \\
2582 \\umulh x0, x1, x2
2583 \\umulh x3, x4, xzr
2584 ,
2585 .operands = .empty,
2586 };
2587
2588 try std.testing.expectFmt("madd w0, w1, w2, w3", "{f}", .{(try as.nextInstruction()).?});
2589 try std.testing.expectFmt("mul w4, w5, w6", "{f}", .{(try as.nextInstruction()).?});
2590 try std.testing.expectFmt("mul w7, w8, w9", "{f}", .{(try as.nextInstruction()).?});
2591 try std.testing.expectFmt("madd x10, x11, x12, x13", "{f}", .{(try as.nextInstruction()).?});
2592 try std.testing.expectFmt("mul x14, x15, x16", "{f}", .{(try as.nextInstruction()).?});
2593 try std.testing.expectFmt("mul x17, x18, x19", "{f}", .{(try as.nextInstruction()).?});
2594
2595 try std.testing.expectFmt("msub w0, w1, w2, w3", "{f}", .{(try as.nextInstruction()).?});
2596 try std.testing.expectFmt("mneg w4, w5, w6", "{f}", .{(try as.nextInstruction()).?});
2597 try std.testing.expectFmt("mneg w7, w8, w9", "{f}", .{(try as.nextInstruction()).?});
2598 try std.testing.expectFmt("msub x10, x11, x12, x13", "{f}", .{(try as.nextInstruction()).?});
2599 try std.testing.expectFmt("mneg x14, x15, x16", "{f}", .{(try as.nextInstruction()).?});
2600 try std.testing.expectFmt("mneg x17, x18, x19", "{f}", .{(try as.nextInstruction()).?});
2601
2602 try std.testing.expectFmt("smaddl x0, w1, w2, x3", "{f}", .{(try as.nextInstruction()).?});
2603 try std.testing.expectFmt("smull x4, w5, w6", "{f}", .{(try as.nextInstruction()).?});
2604 try std.testing.expectFmt("smull x7, w8, w9", "{f}", .{(try as.nextInstruction()).?});
2605
2606 try std.testing.expectFmt("smsubl x0, w1, w2, x3", "{f}", .{(try as.nextInstruction()).?});
2607 try std.testing.expectFmt("smnegl x4, w5, w6", "{f}", .{(try as.nextInstruction()).?});
2608 try std.testing.expectFmt("smnegl x7, w8, w9", "{f}", .{(try as.nextInstruction()).?});
2609
2610 try std.testing.expectFmt("smulh x0, x1, x2", "{f}", .{(try as.nextInstruction()).?});
2611 try std.testing.expectFmt("smulh x3, x4, xzr", "{f}", .{(try as.nextInstruction()).?});
2612
2613 try std.testing.expectFmt("umaddl x0, w1, w2, x3", "{f}", .{(try as.nextInstruction()).?});
2614 try std.testing.expectFmt("umull x4, w5, w6", "{f}", .{(try as.nextInstruction()).?});
2615 try std.testing.expectFmt("umull x7, w8, w9", "{f}", .{(try as.nextInstruction()).?});
2616
2617 try std.testing.expectFmt("umsubl x0, w1, w2, x3", "{f}", .{(try as.nextInstruction()).?});
2618 try std.testing.expectFmt("umnegl x4, w5, w6", "{f}", .{(try as.nextInstruction()).?});
2619 try std.testing.expectFmt("umnegl x7, w8, w9", "{f}", .{(try as.nextInstruction()).?});
2620
2621 try std.testing.expectFmt("umulh x0, x1, x2", "{f}", .{(try as.nextInstruction()).?});
2622 try std.testing.expectFmt("umulh x3, x4, xzr", "{f}", .{(try as.nextInstruction()).?});
2623
2624 try std.testing.expect(null == try as.nextInstruction());
2625}
2626test "reserved" {
2627 var as: Assemble = .{
2628 .source = "\n\nudf #0x0\n\t\n\tudf\t#01234\n \nudf#65535",
2629 .operands = .empty,
2630 };
2631
2632 try std.testing.expectFmt("udf #0x0", "{f}", .{(try as.nextInstruction()).?});
2633 try std.testing.expectFmt("udf #0x4d2", "{f}", .{(try as.nextInstruction()).?});
2634 try std.testing.expectFmt("udf #0xffff", "{f}", .{(try as.nextInstruction()).?});
2635
2636 try std.testing.expect(null == try as.nextInstruction());
2637}
2638test "shift" {
2639 var as: Assemble = .{
2640 .source =
2641 \\lsl w0, w1, w2
2642 \\lslv w3, w4, wzr
2643 \\lsl x5, x6, xzr
2644 \\lslv x7, x8, x9
2645 \\
2646 \\lsr w0, w1, w2
2647 \\lsrv w3, w4, wzr
2648 \\lsr x5, x6, xzr
2649 \\lsrv x7, x8, x9
2650 \\
2651 \\asr w0, w1, w2
2652 \\asrv w3, w4, wzr
2653 \\asr x5, x6, xzr
2654 \\asrv x7, x8, x9
2655 \\
2656 \\ror w0, w1, w2
2657 \\rorv w3, w4, wzr
2658 \\ror x5, x6, xzr
2659 \\rorv x7, x8, x9
2660 ,
2661 .operands = .empty,
2662 };
2663
2664 try std.testing.expectFmt("lsl w0, w1, w2", "{f}", .{(try as.nextInstruction()).?});
2665 try std.testing.expectFmt("lsl w3, w4, wzr", "{f}", .{(try as.nextInstruction()).?});
2666 try std.testing.expectFmt("lsl x5, x6, xzr", "{f}", .{(try as.nextInstruction()).?});
2667 try std.testing.expectFmt("lsl x7, x8, x9", "{f}", .{(try as.nextInstruction()).?});
2668
2669 try std.testing.expectFmt("lsr w0, w1, w2", "{f}", .{(try as.nextInstruction()).?});
2670 try std.testing.expectFmt("lsr w3, w4, wzr", "{f}", .{(try as.nextInstruction()).?});
2671 try std.testing.expectFmt("lsr x5, x6, xzr", "{f}", .{(try as.nextInstruction()).?});
2672 try std.testing.expectFmt("lsr x7, x8, x9", "{f}", .{(try as.nextInstruction()).?});
2673
2674 try std.testing.expectFmt("asr w0, w1, w2", "{f}", .{(try as.nextInstruction()).?});
2675 try std.testing.expectFmt("asr w3, w4, wzr", "{f}", .{(try as.nextInstruction()).?});
2676 try std.testing.expectFmt("asr x5, x6, xzr", "{f}", .{(try as.nextInstruction()).?});
2677 try std.testing.expectFmt("asr x7, x8, x9", "{f}", .{(try as.nextInstruction()).?});
2678
2679 try std.testing.expectFmt("ror w0, w1, w2", "{f}", .{(try as.nextInstruction()).?});
2680 try std.testing.expectFmt("ror w3, w4, wzr", "{f}", .{(try as.nextInstruction()).?});
2681 try std.testing.expectFmt("ror x5, x6, xzr", "{f}", .{(try as.nextInstruction()).?});
2682 try std.testing.expectFmt("ror x7, x8, x9", "{f}", .{(try as.nextInstruction()).?});
2683
2684 try std.testing.expect(null == try as.nextInstruction());
2685}
2686test "unary vector" {
2687 var as: Assemble = .{
2688 .source =
2689 \\SUQADD B0, B1
2690 \\SUQADD H2, H3
2691 \\SUQADD S4, S5
2692 \\SUQADD D6, D7
2693 \\SUQADD V8.8B, V9.8B
2694 \\SUQADD V10.16B, V11.16B
2695 \\SUQADD V12.4H, V13.4H
2696 \\SUQADD V14.8H, V15.8H
2697 \\SUQADD V16.2S, V17.2S
2698 \\SUQADD V18.4S, V19.4S
2699 \\SUQADD V20.2D, V21.2D
2700 \\
2701 \\CNT V0.8B, V1.8B
2702 \\CNT V2.16B, V3.16B
2703 \\
2704 \\SQABS B0, B1
2705 \\SQABS H2, H3
2706 \\SQABS S4, S5
2707 \\SQABS D6, D7
2708 \\SQABS V8.8B, V9.8B
2709 \\SQABS V10.16B, V11.16B
2710 \\SQABS V12.4H, V13.4H
2711 \\SQABS V14.8H, V15.8H
2712 \\SQABS V16.2S, V17.2S
2713 \\SQABS V18.4S, V19.4S
2714 \\SQABS V20.2D, V21.2D
2715 \\
2716 \\CMGT D0, D1, #00
2717 \\CMGT V2.8B, V3.8B, #0
2718 \\CMGT V4.16B, V5.16B, #0
2719 \\CMGT V6.4H, V7.4H, #0
2720 \\CMGT V8.8H, V9.8H, #0
2721 \\CMGT V10.2S, V11.2S, #0
2722 \\CMGT V12.4S, V13.4S, #0
2723 \\CMGT V14.2D, V15.2D, #0
2724 \\
2725 \\CMEQ D0, D1, #00
2726 \\CMEQ V2.8B, V3.8B, #0
2727 \\CMEQ V4.16B, V5.16B, #0
2728 \\CMEQ V6.4H, V7.4H, #0
2729 \\CMEQ V8.8H, V9.8H, #0
2730 \\CMEQ V10.2S, V11.2S, #0
2731 \\CMEQ V12.4S, V13.4S, #0
2732 \\CMEQ V14.2D, V15.2D, #0
2733 \\
2734 \\CMLT D0, D1, #00
2735 \\CMLT V2.8B, V3.8B, #0
2736 \\CMLT V4.16B, V5.16B, #0
2737 \\CMLT V6.4H, V7.4H, #0
2738 \\CMLT V8.8H, V9.8H, #0
2739 \\CMLT V10.2S, V11.2S, #0
2740 \\CMLT V12.4S, V13.4S, #0
2741 \\CMLT V14.2D, V15.2D, #0
2742 \\
2743 \\ABS D0, D1
2744 \\ABS V2.8B, V3.8B
2745 \\ABS V4.16B, V5.16B
2746 \\ABS V6.4H, V7.4H
2747 \\ABS V8.8H, V9.8H
2748 \\ABS V10.2S, V11.2S
2749 \\ABS V12.4S, V13.4S
2750 \\ABS V14.2D, V15.2D
2751 \\
2752 \\SQXTN B0, H1
2753 \\SQXTN H2, S3
2754 \\SQXTN S4, D5
2755 \\SQXTN V6.8B, V7.8H
2756 \\SQXTN2 V8.16B, V9.8H
2757 \\SQXTN V10.4H, V11.4S
2758 \\SQXTN2 V12.8H, V13.4S
2759 \\SQXTN V14.2S, V15.2D
2760 \\SQXTN2 V16.4S, V17.2D
2761 \\
2762 \\FRINTN V0.4H, V1.4H
2763 \\FRINTN V2.8H, V3.8H
2764 \\FRINTN V4.2S, V5.2S
2765 \\FRINTN V6.4S, V7.4S
2766 \\FRINTN V8.2D, V9.2D
2767 \\FRINTN H10, H11
2768 \\FRINTN S12, S13
2769 \\FRINTN D14, D15
2770 \\
2771 \\FRINTM V0.4H, V1.4H
2772 \\FRINTM V2.8H, V3.8H
2773 \\FRINTM V4.2S, V5.2S
2774 \\FRINTM V6.4S, V7.4S
2775 \\FRINTM V8.2D, V9.2D
2776 \\FRINTM H10, H11
2777 \\FRINTM S12, S13
2778 \\FRINTM D14, D15
2779 \\
2780 \\FCVTNS H0, H1
2781 \\FCVTNS S2, S3
2782 \\FCVTNS D4, D5
2783 \\FCVTNS V6.4H, V7.4H
2784 \\FCVTNS V8.8H, V9.8H
2785 \\FCVTNS V10.2S, V11.2S
2786 \\FCVTNS V12.4S, V13.4S
2787 \\FCVTNS V14.2D, V15.2D
2788 \\FCVTNS W16, H17
2789 \\FCVTNS X18, H19
2790 \\FCVTNS W20, S21
2791 \\FCVTNS X22, S23
2792 \\FCVTNS W24, D25
2793 \\FCVTNS X26, D27
2794 \\
2795 \\FCVTMS H0, H1
2796 \\FCVTMS S2, S3
2797 \\FCVTMS D4, D5
2798 \\FCVTMS V6.4H, V7.4H
2799 \\FCVTMS V8.8H, V9.8H
2800 \\FCVTMS V10.2S, V11.2S
2801 \\FCVTMS V12.4S, V13.4S
2802 \\FCVTMS V14.2D, V15.2D
2803 \\FCVTMS W16, H17
2804 \\FCVTMS X18, H19
2805 \\FCVTMS W20, S21
2806 \\FCVTMS X22, S23
2807 \\FCVTMS W24, D25
2808 \\FCVTMS X26, D27
2809 \\
2810 \\FCVTAS H0, H1
2811 \\FCVTAS S2, S3
2812 \\FCVTAS D4, D5
2813 \\FCVTAS V6.4H, V7.4H
2814 \\FCVTAS V8.8H, V9.8H
2815 \\FCVTAS V10.2S, V11.2S
2816 \\FCVTAS V12.4S, V13.4S
2817 \\FCVTAS V14.2D, V15.2D
2818 \\FCVTAS W16, H17
2819 \\FCVTAS X18, H19
2820 \\FCVTAS W20, S21
2821 \\FCVTAS X22, S23
2822 \\FCVTAS W24, D25
2823 \\FCVTAS X26, D27
2824 \\
2825 \\SCVTF H0, H1
2826 \\SCVTF S2, S3
2827 \\SCVTF D4, D5
2828 \\SCVTF V6.4H, V7.4H
2829 \\SCVTF V8.8H, V9.8H
2830 \\SCVTF V10.2S, V11.2S
2831 \\SCVTF V12.4S, V13.4S
2832 \\SCVTF V14.2D, V15.2D
2833 \\SCVTF H16, W17
2834 \\SCVTF H18, X19
2835 \\SCVTF S20, W21
2836 \\SCVTF S22, X23
2837 \\SCVTF D24, W25
2838 \\SCVTF D26, X27
2839 \\
2840 \\FCMGT H0, H1, #0.0
2841 \\FCMGT S2, S3, # 0.0
2842 \\FCMGT D4, D5, #+0.0
2843 \\FCMGT V6.4H, V7.4H, # +0.0
2844 \\FCMGT V8.8H, V9.8H, #0
2845 \\FCMGT V10.2S, V11.2S, # 0
2846 \\FCMGT V12.4S, V13.4S, #+0
2847 \\FCMGT V14.2D, V15.2D, # +0
2848 \\
2849 \\FCMEQ H0, H1, #0.0
2850 \\FCMEQ S2, S3, # 0.0
2851 \\FCMEQ D4, D5, #+0.0
2852 \\FCMEQ V6.4H, V7.4H, # +0.0
2853 \\FCMEQ V8.8H, V9.8H, #0
2854 \\FCMEQ V10.2S, V11.2S, # 0
2855 \\FCMEQ V12.4S, V13.4S, #+0
2856 \\FCMEQ V14.2D, V15.2D, # +0
2857 \\
2858 \\FCMLT H0, H1, #0.0
2859 \\FCMLT S2, S3, # 0.0
2860 \\FCMLT D4, D5, #+0.0
2861 \\FCMLT V6.4H, V7.4H, # +0.0
2862 \\FCMLT V8.8H, V9.8H, #0
2863 \\FCMLT V10.2S, V11.2S, # 0
2864 \\FCMLT V12.4S, V13.4S, #+0
2865 \\FCMLT V14.2D, V15.2D, # +0
2866 \\
2867 \\FRINTP V0.4H, V1.4H
2868 \\FRINTP V2.8H, V3.8H
2869 \\FRINTP V4.2S, V5.2S
2870 \\FRINTP V6.4S, V7.4S
2871 \\FRINTP V8.2D, V9.2D
2872 \\FRINTP H10, H11
2873 \\FRINTP S12, S13
2874 \\FRINTP D14, D15
2875 \\
2876 \\FRINTZ V0.4H, V1.4H
2877 \\FRINTZ V2.8H, V3.8H
2878 \\FRINTZ V4.2S, V5.2S
2879 \\FRINTZ V6.4S, V7.4S
2880 \\FRINTZ V8.2D, V9.2D
2881 \\FRINTZ H10, H11
2882 \\FRINTZ S12, S13
2883 \\FRINTZ D14, D15
2884 \\
2885 \\FCVTPS H0, H1
2886 \\FCVTPS S2, S3
2887 \\FCVTPS D4, D5
2888 \\FCVTPS V6.4H, V7.4H
2889 \\FCVTPS V8.8H, V9.8H
2890 \\FCVTPS V10.2S, V11.2S
2891 \\FCVTPS V12.4S, V13.4S
2892 \\FCVTPS V14.2D, V15.2D
2893 \\FCVTPS W16, H17
2894 \\FCVTPS X18, H19
2895 \\FCVTPS W20, S21
2896 \\FCVTPS X22, S23
2897 \\FCVTPS W24, D25
2898 \\FCVTPS X26, D27
2899 \\
2900 \\FCVTZS H0, H1
2901 \\FCVTZS S2, S3
2902 \\FCVTZS D4, D5
2903 \\FCVTZS V6.4H, V7.4H
2904 \\FCVTZS V8.8H, V9.8H
2905 \\FCVTZS V10.2S, V11.2S
2906 \\FCVTZS V12.4S, V13.4S
2907 \\FCVTZS V14.2D, V15.2D
2908 \\FCVTZS W16, H17
2909 \\FCVTZS X18, H19
2910 \\FCVTZS W20, S21
2911 \\FCVTZS X22, S23
2912 \\FCVTZS W24, D25
2913 \\FCVTZS X26, D27
2914 \\
2915 \\CMGE D0, D1, #00
2916 \\CMGE V2.8B, V3.8B, #0
2917 \\CMGE V4.16B, V5.16B, #0
2918 \\CMGE V6.4H, V7.4H, #0
2919 \\CMGE V8.8H, V9.8H, #0
2920 \\CMGE V10.2S, V11.2S, #0
2921 \\CMGE V12.4S, V13.4S, #0
2922 \\CMGE V14.2D, V15.2D, #0
2923 \\
2924 \\CMLE D0, D1, #00
2925 \\CMLE V2.8B, V3.8B, #0
2926 \\CMLE V4.16B, V5.16B, #0
2927 \\CMLE V6.4H, V7.4H, #0
2928 \\CMLE V8.8H, V9.8H, #0
2929 \\CMLE V10.2S, V11.2S, #0
2930 \\CMLE V12.4S, V13.4S, #0
2931 \\CMLE V14.2D, V15.2D, #0
2932 \\
2933 \\NEG D0, D1
2934 \\NEG V2.8B, V3.8B
2935 \\NEG V4.16B, V5.16B
2936 \\NEG V6.4H, V7.4H
2937 \\NEG V8.8H, V9.8H
2938 \\NEG V10.2S, V11.2S
2939 \\NEG V12.4S, V13.4S
2940 \\NEG V14.2D, V15.2D
2941 \\
2942 \\FCVTNU H0, H1
2943 \\FCVTNU S2, S3
2944 \\FCVTNU D4, D5
2945 \\FCVTNU V6.4H, V7.4H
2946 \\FCVTNU V8.8H, V9.8H
2947 \\FCVTNU V10.2S, V11.2S
2948 \\FCVTNU V12.4S, V13.4S
2949 \\FCVTNU V14.2D, V15.2D
2950 \\FCVTNU W16, H17
2951 \\FCVTNU X18, H19
2952 \\FCVTNU W20, S21
2953 \\FCVTNU X22, S23
2954 \\FCVTNU W24, D25
2955 \\FCVTNU X26, D27
2956 \\
2957 \\FCVTMU H0, H1
2958 \\FCVTMU S2, S3
2959 \\FCVTMU D4, D5
2960 \\FCVTMU V6.4H, V7.4H
2961 \\FCVTMU V8.8H, V9.8H
2962 \\FCVTMU V10.2S, V11.2S
2963 \\FCVTMU V12.4S, V13.4S
2964 \\FCVTMU V14.2D, V15.2D
2965 \\FCVTMU W16, H17
2966 \\FCVTMU X18, H19
2967 \\FCVTMU W20, S21
2968 \\FCVTMU X22, S23
2969 \\FCVTMU W24, D25
2970 \\FCVTMU X26, D27
2971 \\
2972 \\FCVTAU H0, H1
2973 \\FCVTAU S2, S3
2974 \\FCVTAU D4, D5
2975 \\FCVTAU V6.4H, V7.4H
2976 \\FCVTAU V8.8H, V9.8H
2977 \\FCVTAU V10.2S, V11.2S
2978 \\FCVTAU V12.4S, V13.4S
2979 \\FCVTAU V14.2D, V15.2D
2980 \\FCVTAU W16, H17
2981 \\FCVTAU X18, H19
2982 \\FCVTAU W20, S21
2983 \\FCVTAU X22, S23
2984 \\FCVTAU W24, D25
2985 \\FCVTAU X26, D27
2986 \\
2987 \\UCVTF H0, H1
2988 \\UCVTF S2, S3
2989 \\UCVTF D4, D5
2990 \\UCVTF V6.4H, V7.4H
2991 \\UCVTF V8.8H, V9.8H
2992 \\UCVTF V10.2S, V11.2S
2993 \\UCVTF V12.4S, V13.4S
2994 \\UCVTF V14.2D, V15.2D
2995 \\UCVTF H16, W17
2996 \\UCVTF H18, X19
2997 \\UCVTF S20, W21
2998 \\UCVTF S22, X23
2999 \\UCVTF D24, W25
3000 \\UCVTF D26, X27
3001 \\
3002 \\NOT V0.8B, V1.8B
3003 \\NOT V2.16B, V3.16B
3004 \\
3005 \\FCMGE H0, H1, #0.0
3006 \\FCMGE S2, S3, # 0.0
3007 \\FCMGE D4, D5, #+0.0
3008 \\FCMGE V6.4H, V7.4H, # +0.0
3009 \\FCMGE V8.8H, V9.8H, #0
3010 \\FCMGE V10.2S, V11.2S, # 0
3011 \\FCMGE V12.4S, V13.4S, #+0
3012 \\FCMGE V14.2D, V15.2D, # +0
3013 \\
3014 \\FCMLE H0, H1, #0.0
3015 \\FCMLE S2, S3, # 0.0
3016 \\FCMLE D4, D5, #+0.0
3017 \\FCMLE V6.4H, V7.4H, # +0.0
3018 \\FCMLE V8.8H, V9.8H, #0
3019 \\FCMLE V10.2S, V11.2S, # 0
3020 \\FCMLE V12.4S, V13.4S, #+0
3021 \\FCMLE V14.2D, V15.2D, # +0
3022 \\
3023 \\FRINTI V0.4H, V1.4H
3024 \\FRINTI V2.8H, V3.8H
3025 \\FRINTI V4.2S, V5.2S
3026 \\FRINTI V6.4S, V7.4S
3027 \\FRINTI V8.2D, V9.2D
3028 \\FRINTI H10, H11
3029 \\FRINTI S12, S13
3030 \\FRINTI D14, D15
3031 \\
3032 \\FCVTPU H0, H1
3033 \\FCVTPU S2, S3
3034 \\FCVTPU D4, D5
3035 \\FCVTPU V6.4H, V7.4H
3036 \\FCVTPU V8.8H, V9.8H
3037 \\FCVTPU V10.2S, V11.2S
3038 \\FCVTPU V12.4S, V13.4S
3039 \\FCVTPU V14.2D, V15.2D
3040 \\FCVTPU W16, H17
3041 \\FCVTPU X18, H19
3042 \\FCVTPU W20, S21
3043 \\FCVTPU X22, S23
3044 \\FCVTPU W24, D25
3045 \\FCVTPU X26, D27
3046 \\
3047 \\FCVTZU H0, H1
3048 \\FCVTZU S2, S3
3049 \\FCVTZU D4, D5
3050 \\FCVTZU V6.4H, V7.4H
3051 \\FCVTZU V8.8H, V9.8H
3052 \\FCVTZU V10.2S, V11.2S
3053 \\FCVTZU V12.4S, V13.4S
3054 \\FCVTZU V14.2D, V15.2D
3055 \\FCVTZU W16, H17
3056 \\FCVTZU X18, H19
3057 \\FCVTZU W20, S21
3058 \\FCVTZU X22, S23
3059 \\FCVTZU W24, D25
3060 \\FCVTZU X26, D27
3061 ,
3062 .operands = .empty,
3063 };
3064
3065 try std.testing.expectFmt("suqadd b0, b1", "{f}", .{(try as.nextInstruction()).?});
3066 try std.testing.expectFmt("suqadd h2, h3", "{f}", .{(try as.nextInstruction()).?});
3067 try std.testing.expectFmt("suqadd s4, s5", "{f}", .{(try as.nextInstruction()).?});
3068 try std.testing.expectFmt("suqadd d6, d7", "{f}", .{(try as.nextInstruction()).?});
3069 try std.testing.expectFmt("suqadd v8.8b, v9.8b", "{f}", .{(try as.nextInstruction()).?});
3070 try std.testing.expectFmt("suqadd v10.16b, v11.16b", "{f}", .{(try as.nextInstruction()).?});
3071 try std.testing.expectFmt("suqadd v12.4h, v13.4h", "{f}", .{(try as.nextInstruction()).?});
3072 try std.testing.expectFmt("suqadd v14.8h, v15.8h", "{f}", .{(try as.nextInstruction()).?});
3073 try std.testing.expectFmt("suqadd v16.2s, v17.2s", "{f}", .{(try as.nextInstruction()).?});
3074 try std.testing.expectFmt("suqadd v18.4s, v19.4s", "{f}", .{(try as.nextInstruction()).?});
3075 try std.testing.expectFmt("suqadd v20.2d, v21.2d", "{f}", .{(try as.nextInstruction()).?});
3076
3077 try std.testing.expectFmt("cnt v0.8b, v1.8b", "{f}", .{(try as.nextInstruction()).?});
3078 try std.testing.expectFmt("cnt v2.16b, v3.16b", "{f}", .{(try as.nextInstruction()).?});
3079
3080 try std.testing.expectFmt("sqabs b0, b1", "{f}", .{(try as.nextInstruction()).?});
3081 try std.testing.expectFmt("sqabs h2, h3", "{f}", .{(try as.nextInstruction()).?});
3082 try std.testing.expectFmt("sqabs s4, s5", "{f}", .{(try as.nextInstruction()).?});
3083 try std.testing.expectFmt("sqabs d6, d7", "{f}", .{(try as.nextInstruction()).?});
3084 try std.testing.expectFmt("sqabs v8.8b, v9.8b", "{f}", .{(try as.nextInstruction()).?});
3085 try std.testing.expectFmt("sqabs v10.16b, v11.16b", "{f}", .{(try as.nextInstruction()).?});
3086 try std.testing.expectFmt("sqabs v12.4h, v13.4h", "{f}", .{(try as.nextInstruction()).?});
3087 try std.testing.expectFmt("sqabs v14.8h, v15.8h", "{f}", .{(try as.nextInstruction()).?});
3088 try std.testing.expectFmt("sqabs v16.2s, v17.2s", "{f}", .{(try as.nextInstruction()).?});
3089 try std.testing.expectFmt("sqabs v18.4s, v19.4s", "{f}", .{(try as.nextInstruction()).?});
3090 try std.testing.expectFmt("sqabs v20.2d, v21.2d", "{f}", .{(try as.nextInstruction()).?});
3091
3092 try std.testing.expectFmt("cmgt d0, d1, #0", "{f}", .{(try as.nextInstruction()).?});
3093 try std.testing.expectFmt("cmgt v2.8b, v3.8b, #0", "{f}", .{(try as.nextInstruction()).?});
3094 try std.testing.expectFmt("cmgt v4.16b, v5.16b, #0", "{f}", .{(try as.nextInstruction()).?});
3095 try std.testing.expectFmt("cmgt v6.4h, v7.4h, #0", "{f}", .{(try as.nextInstruction()).?});
3096 try std.testing.expectFmt("cmgt v8.8h, v9.8h, #0", "{f}", .{(try as.nextInstruction()).?});
3097 try std.testing.expectFmt("cmgt v10.2s, v11.2s, #0", "{f}", .{(try as.nextInstruction()).?});
3098 try std.testing.expectFmt("cmgt v12.4s, v13.4s, #0", "{f}", .{(try as.nextInstruction()).?});
3099 try std.testing.expectFmt("cmgt v14.2d, v15.2d, #0", "{f}", .{(try as.nextInstruction()).?});
3100
3101 try std.testing.expectFmt("cmeq d0, d1, #0", "{f}", .{(try as.nextInstruction()).?});
3102 try std.testing.expectFmt("cmeq v2.8b, v3.8b, #0", "{f}", .{(try as.nextInstruction()).?});
3103 try std.testing.expectFmt("cmeq v4.16b, v5.16b, #0", "{f}", .{(try as.nextInstruction()).?});
3104 try std.testing.expectFmt("cmeq v6.4h, v7.4h, #0", "{f}", .{(try as.nextInstruction()).?});
3105 try std.testing.expectFmt("cmeq v8.8h, v9.8h, #0", "{f}", .{(try as.nextInstruction()).?});
3106 try std.testing.expectFmt("cmeq v10.2s, v11.2s, #0", "{f}", .{(try as.nextInstruction()).?});
3107 try std.testing.expectFmt("cmeq v12.4s, v13.4s, #0", "{f}", .{(try as.nextInstruction()).?});
3108 try std.testing.expectFmt("cmeq v14.2d, v15.2d, #0", "{f}", .{(try as.nextInstruction()).?});
3109
3110 try std.testing.expectFmt("cmlt d0, d1, #0", "{f}", .{(try as.nextInstruction()).?});
3111 try std.testing.expectFmt("cmlt v2.8b, v3.8b, #0", "{f}", .{(try as.nextInstruction()).?});
3112 try std.testing.expectFmt("cmlt v4.16b, v5.16b, #0", "{f}", .{(try as.nextInstruction()).?});
3113 try std.testing.expectFmt("cmlt v6.4h, v7.4h, #0", "{f}", .{(try as.nextInstruction()).?});
3114 try std.testing.expectFmt("cmlt v8.8h, v9.8h, #0", "{f}", .{(try as.nextInstruction()).?});
3115 try std.testing.expectFmt("cmlt v10.2s, v11.2s, #0", "{f}", .{(try as.nextInstruction()).?});
3116 try std.testing.expectFmt("cmlt v12.4s, v13.4s, #0", "{f}", .{(try as.nextInstruction()).?});
3117 try std.testing.expectFmt("cmlt v14.2d, v15.2d, #0", "{f}", .{(try as.nextInstruction()).?});
3118
3119 try std.testing.expectFmt("abs d0, d1", "{f}", .{(try as.nextInstruction()).?});
3120 try std.testing.expectFmt("abs v2.8b, v3.8b", "{f}", .{(try as.nextInstruction()).?});
3121 try std.testing.expectFmt("abs v4.16b, v5.16b", "{f}", .{(try as.nextInstruction()).?});
3122 try std.testing.expectFmt("abs v6.4h, v7.4h", "{f}", .{(try as.nextInstruction()).?});
3123 try std.testing.expectFmt("abs v8.8h, v9.8h", "{f}", .{(try as.nextInstruction()).?});
3124 try std.testing.expectFmt("abs v10.2s, v11.2s", "{f}", .{(try as.nextInstruction()).?});
3125 try std.testing.expectFmt("abs v12.4s, v13.4s", "{f}", .{(try as.nextInstruction()).?});
3126 try std.testing.expectFmt("abs v14.2d, v15.2d", "{f}", .{(try as.nextInstruction()).?});
3127
3128 try std.testing.expectFmt("sqxtn b0, h1", "{f}", .{(try as.nextInstruction()).?});
3129 try std.testing.expectFmt("sqxtn h2, s3", "{f}", .{(try as.nextInstruction()).?});
3130 try std.testing.expectFmt("sqxtn s4, d5", "{f}", .{(try as.nextInstruction()).?});
3131 try std.testing.expectFmt("sqxtn v6.8b, v7.8h", "{f}", .{(try as.nextInstruction()).?});
3132 try std.testing.expectFmt("sqxtn2 v8.16b, v9.8h", "{f}", .{(try as.nextInstruction()).?});
3133 try std.testing.expectFmt("sqxtn v10.4h, v11.4s", "{f}", .{(try as.nextInstruction()).?});
3134 try std.testing.expectFmt("sqxtn2 v12.8h, v13.4s", "{f}", .{(try as.nextInstruction()).?});
3135 try std.testing.expectFmt("sqxtn v14.2s, v15.2d", "{f}", .{(try as.nextInstruction()).?});
3136 try std.testing.expectFmt("sqxtn2 v16.4s, v17.2d", "{f}", .{(try as.nextInstruction()).?});
3137
3138 try std.testing.expectFmt("frintn v0.4h, v1.4h", "{f}", .{(try as.nextInstruction()).?});
3139 try std.testing.expectFmt("frintn v2.8h, v3.8h", "{f}", .{(try as.nextInstruction()).?});
3140 try std.testing.expectFmt("frintn v4.2s, v5.2s", "{f}", .{(try as.nextInstruction()).?});
3141 try std.testing.expectFmt("frintn v6.4s, v7.4s", "{f}", .{(try as.nextInstruction()).?});
3142 try std.testing.expectFmt("frintn v8.2d, v9.2d", "{f}", .{(try as.nextInstruction()).?});
3143 try std.testing.expectFmt("frintn h10, h11", "{f}", .{(try as.nextInstruction()).?});
3144 try std.testing.expectFmt("frintn s12, s13", "{f}", .{(try as.nextInstruction()).?});
3145 try std.testing.expectFmt("frintn d14, d15", "{f}", .{(try as.nextInstruction()).?});
3146
3147 try std.testing.expectFmt("frintm v0.4h, v1.4h", "{f}", .{(try as.nextInstruction()).?});
3148 try std.testing.expectFmt("frintm v2.8h, v3.8h", "{f}", .{(try as.nextInstruction()).?});
3149 try std.testing.expectFmt("frintm v4.2s, v5.2s", "{f}", .{(try as.nextInstruction()).?});
3150 try std.testing.expectFmt("frintm v6.4s, v7.4s", "{f}", .{(try as.nextInstruction()).?});
3151 try std.testing.expectFmt("frintm v8.2d, v9.2d", "{f}", .{(try as.nextInstruction()).?});
3152 try std.testing.expectFmt("frintm h10, h11", "{f}", .{(try as.nextInstruction()).?});
3153 try std.testing.expectFmt("frintm s12, s13", "{f}", .{(try as.nextInstruction()).?});
3154 try std.testing.expectFmt("frintm d14, d15", "{f}", .{(try as.nextInstruction()).?});
3155
3156 try std.testing.expectFmt("fcvtns h0, h1", "{f}", .{(try as.nextInstruction()).?});
3157 try std.testing.expectFmt("fcvtns s2, s3", "{f}", .{(try as.nextInstruction()).?});
3158 try std.testing.expectFmt("fcvtns d4, d5", "{f}", .{(try as.nextInstruction()).?});
3159 try std.testing.expectFmt("fcvtns v6.4h, v7.4h", "{f}", .{(try as.nextInstruction()).?});
3160 try std.testing.expectFmt("fcvtns v8.8h, v9.8h", "{f}", .{(try as.nextInstruction()).?});
3161 try std.testing.expectFmt("fcvtns v10.2s, v11.2s", "{f}", .{(try as.nextInstruction()).?});
3162 try std.testing.expectFmt("fcvtns v12.4s, v13.4s", "{f}", .{(try as.nextInstruction()).?});
3163 try std.testing.expectFmt("fcvtns v14.2d, v15.2d", "{f}", .{(try as.nextInstruction()).?});
3164 try std.testing.expectFmt("fcvtns w16, h17", "{f}", .{(try as.nextInstruction()).?});
3165 try std.testing.expectFmt("fcvtns x18, h19", "{f}", .{(try as.nextInstruction()).?});
3166 try std.testing.expectFmt("fcvtns w20, s21", "{f}", .{(try as.nextInstruction()).?});
3167 try std.testing.expectFmt("fcvtns x22, s23", "{f}", .{(try as.nextInstruction()).?});
3168 try std.testing.expectFmt("fcvtns w24, d25", "{f}", .{(try as.nextInstruction()).?});
3169 try std.testing.expectFmt("fcvtns x26, d27", "{f}", .{(try as.nextInstruction()).?});
3170
3171 try std.testing.expectFmt("fcvtms h0, h1", "{f}", .{(try as.nextInstruction()).?});
3172 try std.testing.expectFmt("fcvtms s2, s3", "{f}", .{(try as.nextInstruction()).?});
3173 try std.testing.expectFmt("fcvtms d4, d5", "{f}", .{(try as.nextInstruction()).?});
3174 try std.testing.expectFmt("fcvtms v6.4h, v7.4h", "{f}", .{(try as.nextInstruction()).?});
3175 try std.testing.expectFmt("fcvtms v8.8h, v9.8h", "{f}", .{(try as.nextInstruction()).?});
3176 try std.testing.expectFmt("fcvtms v10.2s, v11.2s", "{f}", .{(try as.nextInstruction()).?});
3177 try std.testing.expectFmt("fcvtms v12.4s, v13.4s", "{f}", .{(try as.nextInstruction()).?});
3178 try std.testing.expectFmt("fcvtms v14.2d, v15.2d", "{f}", .{(try as.nextInstruction()).?});
3179 try std.testing.expectFmt("fcvtms w16, h17", "{f}", .{(try as.nextInstruction()).?});
3180 try std.testing.expectFmt("fcvtms x18, h19", "{f}", .{(try as.nextInstruction()).?});
3181 try std.testing.expectFmt("fcvtms w20, s21", "{f}", .{(try as.nextInstruction()).?});
3182 try std.testing.expectFmt("fcvtms x22, s23", "{f}", .{(try as.nextInstruction()).?});
3183 try std.testing.expectFmt("fcvtms w24, d25", "{f}", .{(try as.nextInstruction()).?});
3184 try std.testing.expectFmt("fcvtms x26, d27", "{f}", .{(try as.nextInstruction()).?});
3185
3186 try std.testing.expectFmt("fcvtas h0, h1", "{f}", .{(try as.nextInstruction()).?});
3187 try std.testing.expectFmt("fcvtas s2, s3", "{f}", .{(try as.nextInstruction()).?});
3188 try std.testing.expectFmt("fcvtas d4, d5", "{f}", .{(try as.nextInstruction()).?});
3189 try std.testing.expectFmt("fcvtas v6.4h, v7.4h", "{f}", .{(try as.nextInstruction()).?});
3190 try std.testing.expectFmt("fcvtas v8.8h, v9.8h", "{f}", .{(try as.nextInstruction()).?});
3191 try std.testing.expectFmt("fcvtas v10.2s, v11.2s", "{f}", .{(try as.nextInstruction()).?});
3192 try std.testing.expectFmt("fcvtas v12.4s, v13.4s", "{f}", .{(try as.nextInstruction()).?});
3193 try std.testing.expectFmt("fcvtas v14.2d, v15.2d", "{f}", .{(try as.nextInstruction()).?});
3194 try std.testing.expectFmt("fcvtas w16, h17", "{f}", .{(try as.nextInstruction()).?});
3195 try std.testing.expectFmt("fcvtas x18, h19", "{f}", .{(try as.nextInstruction()).?});
3196 try std.testing.expectFmt("fcvtas w20, s21", "{f}", .{(try as.nextInstruction()).?});
3197 try std.testing.expectFmt("fcvtas x22, s23", "{f}", .{(try as.nextInstruction()).?});
3198 try std.testing.expectFmt("fcvtas w24, d25", "{f}", .{(try as.nextInstruction()).?});
3199 try std.testing.expectFmt("fcvtas x26, d27", "{f}", .{(try as.nextInstruction()).?});
3200
3201 try std.testing.expectFmt("scvtf h0, h1", "{f}", .{(try as.nextInstruction()).?});
3202 try std.testing.expectFmt("scvtf s2, s3", "{f}", .{(try as.nextInstruction()).?});
3203 try std.testing.expectFmt("scvtf d4, d5", "{f}", .{(try as.nextInstruction()).?});
3204 try std.testing.expectFmt("scvtf v6.4h, v7.4h", "{f}", .{(try as.nextInstruction()).?});
3205 try std.testing.expectFmt("scvtf v8.8h, v9.8h", "{f}", .{(try as.nextInstruction()).?});
3206 try std.testing.expectFmt("scvtf v10.2s, v11.2s", "{f}", .{(try as.nextInstruction()).?});
3207 try std.testing.expectFmt("scvtf v12.4s, v13.4s", "{f}", .{(try as.nextInstruction()).?});
3208 try std.testing.expectFmt("scvtf v14.2d, v15.2d", "{f}", .{(try as.nextInstruction()).?});
3209 try std.testing.expectFmt("scvtf h16, w17", "{f}", .{(try as.nextInstruction()).?});
3210 try std.testing.expectFmt("scvtf h18, x19", "{f}", .{(try as.nextInstruction()).?});
3211 try std.testing.expectFmt("scvtf s20, w21", "{f}", .{(try as.nextInstruction()).?});
3212 try std.testing.expectFmt("scvtf s22, x23", "{f}", .{(try as.nextInstruction()).?});
3213 try std.testing.expectFmt("scvtf d24, w25", "{f}", .{(try as.nextInstruction()).?});
3214 try std.testing.expectFmt("scvtf d26, x27", "{f}", .{(try as.nextInstruction()).?});
3215
3216 try std.testing.expectFmt("fcmgt h0, h1, #0.0", "{f}", .{(try as.nextInstruction()).?});
3217 try std.testing.expectFmt("fcmgt s2, s3, #0.0", "{f}", .{(try as.nextInstruction()).?});
3218 try std.testing.expectFmt("fcmgt d4, d5, #0.0", "{f}", .{(try as.nextInstruction()).?});
3219 try std.testing.expectFmt("fcmgt v6.4h, v7.4h, #0.0", "{f}", .{(try as.nextInstruction()).?});
3220 try std.testing.expectFmt("fcmgt v8.8h, v9.8h, #0.0", "{f}", .{(try as.nextInstruction()).?});
3221 try std.testing.expectFmt("fcmgt v10.2s, v11.2s, #0.0", "{f}", .{(try as.nextInstruction()).?});
3222 try std.testing.expectFmt("fcmgt v12.4s, v13.4s, #0.0", "{f}", .{(try as.nextInstruction()).?});
3223 try std.testing.expectFmt("fcmgt v14.2d, v15.2d, #0.0", "{f}", .{(try as.nextInstruction()).?});
3224
3225 try std.testing.expectFmt("fcmeq h0, h1, #0.0", "{f}", .{(try as.nextInstruction()).?});
3226 try std.testing.expectFmt("fcmeq s2, s3, #0.0", "{f}", .{(try as.nextInstruction()).?});
3227 try std.testing.expectFmt("fcmeq d4, d5, #0.0", "{f}", .{(try as.nextInstruction()).?});
3228 try std.testing.expectFmt("fcmeq v6.4h, v7.4h, #0.0", "{f}", .{(try as.nextInstruction()).?});
3229 try std.testing.expectFmt("fcmeq v8.8h, v9.8h, #0.0", "{f}", .{(try as.nextInstruction()).?});
3230 try std.testing.expectFmt("fcmeq v10.2s, v11.2s, #0.0", "{f}", .{(try as.nextInstruction()).?});
3231 try std.testing.expectFmt("fcmeq v12.4s, v13.4s, #0.0", "{f}", .{(try as.nextInstruction()).?});
3232 try std.testing.expectFmt("fcmeq v14.2d, v15.2d, #0.0", "{f}", .{(try as.nextInstruction()).?});
3233
3234 try std.testing.expectFmt("fcmlt h0, h1, #0.0", "{f}", .{(try as.nextInstruction()).?});
3235 try std.testing.expectFmt("fcmlt s2, s3, #0.0", "{f}", .{(try as.nextInstruction()).?});
3236 try std.testing.expectFmt("fcmlt d4, d5, #0.0", "{f}", .{(try as.nextInstruction()).?});
3237 try std.testing.expectFmt("fcmlt v6.4h, v7.4h, #0.0", "{f}", .{(try as.nextInstruction()).?});
3238 try std.testing.expectFmt("fcmlt v8.8h, v9.8h, #0.0", "{f}", .{(try as.nextInstruction()).?});
3239 try std.testing.expectFmt("fcmlt v10.2s, v11.2s, #0.0", "{f}", .{(try as.nextInstruction()).?});
3240 try std.testing.expectFmt("fcmlt v12.4s, v13.4s, #0.0", "{f}", .{(try as.nextInstruction()).?});
3241 try std.testing.expectFmt("fcmlt v14.2d, v15.2d, #0.0", "{f}", .{(try as.nextInstruction()).?});
3242
3243 try std.testing.expectFmt("frintp v0.4h, v1.4h", "{f}", .{(try as.nextInstruction()).?});
3244 try std.testing.expectFmt("frintp v2.8h, v3.8h", "{f}", .{(try as.nextInstruction()).?});
3245 try std.testing.expectFmt("frintp v4.2s, v5.2s", "{f}", .{(try as.nextInstruction()).?});
3246 try std.testing.expectFmt("frintp v6.4s, v7.4s", "{f}", .{(try as.nextInstruction()).?});
3247 try std.testing.expectFmt("frintp v8.2d, v9.2d", "{f}", .{(try as.nextInstruction()).?});
3248 try std.testing.expectFmt("frintp h10, h11", "{f}", .{(try as.nextInstruction()).?});
3249 try std.testing.expectFmt("frintp s12, s13", "{f}", .{(try as.nextInstruction()).?});
3250 try std.testing.expectFmt("frintp d14, d15", "{f}", .{(try as.nextInstruction()).?});
3251
3252 try std.testing.expectFmt("frintz v0.4h, v1.4h", "{f}", .{(try as.nextInstruction()).?});
3253 try std.testing.expectFmt("frintz v2.8h, v3.8h", "{f}", .{(try as.nextInstruction()).?});
3254 try std.testing.expectFmt("frintz v4.2s, v5.2s", "{f}", .{(try as.nextInstruction()).?});
3255 try std.testing.expectFmt("frintz v6.4s, v7.4s", "{f}", .{(try as.nextInstruction()).?});
3256 try std.testing.expectFmt("frintz v8.2d, v9.2d", "{f}", .{(try as.nextInstruction()).?});
3257 try std.testing.expectFmt("frintz h10, h11", "{f}", .{(try as.nextInstruction()).?});
3258 try std.testing.expectFmt("frintz s12, s13", "{f}", .{(try as.nextInstruction()).?});
3259 try std.testing.expectFmt("frintz d14, d15", "{f}", .{(try as.nextInstruction()).?});
3260
3261 try std.testing.expectFmt("fcvtps h0, h1", "{f}", .{(try as.nextInstruction()).?});
3262 try std.testing.expectFmt("fcvtps s2, s3", "{f}", .{(try as.nextInstruction()).?});
3263 try std.testing.expectFmt("fcvtps d4, d5", "{f}", .{(try as.nextInstruction()).?});
3264 try std.testing.expectFmt("fcvtps v6.4h, v7.4h", "{f}", .{(try as.nextInstruction()).?});
3265 try std.testing.expectFmt("fcvtps v8.8h, v9.8h", "{f}", .{(try as.nextInstruction()).?});
3266 try std.testing.expectFmt("fcvtps v10.2s, v11.2s", "{f}", .{(try as.nextInstruction()).?});
3267 try std.testing.expectFmt("fcvtps v12.4s, v13.4s", "{f}", .{(try as.nextInstruction()).?});
3268 try std.testing.expectFmt("fcvtps v14.2d, v15.2d", "{f}", .{(try as.nextInstruction()).?});
3269 try std.testing.expectFmt("fcvtps w16, h17", "{f}", .{(try as.nextInstruction()).?});
3270 try std.testing.expectFmt("fcvtps x18, h19", "{f}", .{(try as.nextInstruction()).?});
3271 try std.testing.expectFmt("fcvtps w20, s21", "{f}", .{(try as.nextInstruction()).?});
3272 try std.testing.expectFmt("fcvtps x22, s23", "{f}", .{(try as.nextInstruction()).?});
3273 try std.testing.expectFmt("fcvtps w24, d25", "{f}", .{(try as.nextInstruction()).?});
3274 try std.testing.expectFmt("fcvtps x26, d27", "{f}", .{(try as.nextInstruction()).?});
3275
3276 try std.testing.expectFmt("fcvtzs h0, h1", "{f}", .{(try as.nextInstruction()).?});
3277 try std.testing.expectFmt("fcvtzs s2, s3", "{f}", .{(try as.nextInstruction()).?});
3278 try std.testing.expectFmt("fcvtzs d4, d5", "{f}", .{(try as.nextInstruction()).?});
3279 try std.testing.expectFmt("fcvtzs v6.4h, v7.4h", "{f}", .{(try as.nextInstruction()).?});
3280 try std.testing.expectFmt("fcvtzs v8.8h, v9.8h", "{f}", .{(try as.nextInstruction()).?});
3281 try std.testing.expectFmt("fcvtzs v10.2s, v11.2s", "{f}", .{(try as.nextInstruction()).?});
3282 try std.testing.expectFmt("fcvtzs v12.4s, v13.4s", "{f}", .{(try as.nextInstruction()).?});
3283 try std.testing.expectFmt("fcvtzs v14.2d, v15.2d", "{f}", .{(try as.nextInstruction()).?});
3284 try std.testing.expectFmt("fcvtzs w16, h17", "{f}", .{(try as.nextInstruction()).?});
3285 try std.testing.expectFmt("fcvtzs x18, h19", "{f}", .{(try as.nextInstruction()).?});
3286 try std.testing.expectFmt("fcvtzs w20, s21", "{f}", .{(try as.nextInstruction()).?});
3287 try std.testing.expectFmt("fcvtzs x22, s23", "{f}", .{(try as.nextInstruction()).?});
3288 try std.testing.expectFmt("fcvtzs w24, d25", "{f}", .{(try as.nextInstruction()).?});
3289 try std.testing.expectFmt("fcvtzs x26, d27", "{f}", .{(try as.nextInstruction()).?});
3290
3291 try std.testing.expectFmt("cmge d0, d1, #0", "{f}", .{(try as.nextInstruction()).?});
3292 try std.testing.expectFmt("cmge v2.8b, v3.8b, #0", "{f}", .{(try as.nextInstruction()).?});
3293 try std.testing.expectFmt("cmge v4.16b, v5.16b, #0", "{f}", .{(try as.nextInstruction()).?});
3294 try std.testing.expectFmt("cmge v6.4h, v7.4h, #0", "{f}", .{(try as.nextInstruction()).?});
3295 try std.testing.expectFmt("cmge v8.8h, v9.8h, #0", "{f}", .{(try as.nextInstruction()).?});
3296 try std.testing.expectFmt("cmge v10.2s, v11.2s, #0", "{f}", .{(try as.nextInstruction()).?});
3297 try std.testing.expectFmt("cmge v12.4s, v13.4s, #0", "{f}", .{(try as.nextInstruction()).?});
3298 try std.testing.expectFmt("cmge v14.2d, v15.2d, #0", "{f}", .{(try as.nextInstruction()).?});
3299
3300 try std.testing.expectFmt("cmle d0, d1, #0", "{f}", .{(try as.nextInstruction()).?});
3301 try std.testing.expectFmt("cmle v2.8b, v3.8b, #0", "{f}", .{(try as.nextInstruction()).?});
3302 try std.testing.expectFmt("cmle v4.16b, v5.16b, #0", "{f}", .{(try as.nextInstruction()).?});
3303 try std.testing.expectFmt("cmle v6.4h, v7.4h, #0", "{f}", .{(try as.nextInstruction()).?});
3304 try std.testing.expectFmt("cmle v8.8h, v9.8h, #0", "{f}", .{(try as.nextInstruction()).?});
3305 try std.testing.expectFmt("cmle v10.2s, v11.2s, #0", "{f}", .{(try as.nextInstruction()).?});
3306 try std.testing.expectFmt("cmle v12.4s, v13.4s, #0", "{f}", .{(try as.nextInstruction()).?});
3307 try std.testing.expectFmt("cmle v14.2d, v15.2d, #0", "{f}", .{(try as.nextInstruction()).?});
3308
3309 try std.testing.expectFmt("neg d0, d1", "{f}", .{(try as.nextInstruction()).?});
3310 try std.testing.expectFmt("neg v2.8b, v3.8b", "{f}", .{(try as.nextInstruction()).?});
3311 try std.testing.expectFmt("neg v4.16b, v5.16b", "{f}", .{(try as.nextInstruction()).?});
3312 try std.testing.expectFmt("neg v6.4h, v7.4h", "{f}", .{(try as.nextInstruction()).?});
3313 try std.testing.expectFmt("neg v8.8h, v9.8h", "{f}", .{(try as.nextInstruction()).?});
3314 try std.testing.expectFmt("neg v10.2s, v11.2s", "{f}", .{(try as.nextInstruction()).?});
3315 try std.testing.expectFmt("neg v12.4s, v13.4s", "{f}", .{(try as.nextInstruction()).?});
3316 try std.testing.expectFmt("neg v14.2d, v15.2d", "{f}", .{(try as.nextInstruction()).?});
3317
3318 try std.testing.expectFmt("fcvtnu h0, h1", "{f}", .{(try as.nextInstruction()).?});
3319 try std.testing.expectFmt("fcvtnu s2, s3", "{f}", .{(try as.nextInstruction()).?});
3320 try std.testing.expectFmt("fcvtnu d4, d5", "{f}", .{(try as.nextInstruction()).?});
3321 try std.testing.expectFmt("fcvtnu v6.4h, v7.4h", "{f}", .{(try as.nextInstruction()).?});
3322 try std.testing.expectFmt("fcvtnu v8.8h, v9.8h", "{f}", .{(try as.nextInstruction()).?});
3323 try std.testing.expectFmt("fcvtnu v10.2s, v11.2s", "{f}", .{(try as.nextInstruction()).?});
3324 try std.testing.expectFmt("fcvtnu v12.4s, v13.4s", "{f}", .{(try as.nextInstruction()).?});
3325 try std.testing.expectFmt("fcvtnu v14.2d, v15.2d", "{f}", .{(try as.nextInstruction()).?});
3326 try std.testing.expectFmt("fcvtnu w16, h17", "{f}", .{(try as.nextInstruction()).?});
3327 try std.testing.expectFmt("fcvtnu x18, h19", "{f}", .{(try as.nextInstruction()).?});
3328 try std.testing.expectFmt("fcvtnu w20, s21", "{f}", .{(try as.nextInstruction()).?});
3329 try std.testing.expectFmt("fcvtnu x22, s23", "{f}", .{(try as.nextInstruction()).?});
3330 try std.testing.expectFmt("fcvtnu w24, d25", "{f}", .{(try as.nextInstruction()).?});
3331 try std.testing.expectFmt("fcvtnu x26, d27", "{f}", .{(try as.nextInstruction()).?});
3332
3333 try std.testing.expectFmt("fcvtmu h0, h1", "{f}", .{(try as.nextInstruction()).?});
3334 try std.testing.expectFmt("fcvtmu s2, s3", "{f}", .{(try as.nextInstruction()).?});
3335 try std.testing.expectFmt("fcvtmu d4, d5", "{f}", .{(try as.nextInstruction()).?});
3336 try std.testing.expectFmt("fcvtmu v6.4h, v7.4h", "{f}", .{(try as.nextInstruction()).?});
3337 try std.testing.expectFmt("fcvtmu v8.8h, v9.8h", "{f}", .{(try as.nextInstruction()).?});
3338 try std.testing.expectFmt("fcvtmu v10.2s, v11.2s", "{f}", .{(try as.nextInstruction()).?});
3339 try std.testing.expectFmt("fcvtmu v12.4s, v13.4s", "{f}", .{(try as.nextInstruction()).?});
3340 try std.testing.expectFmt("fcvtmu v14.2d, v15.2d", "{f}", .{(try as.nextInstruction()).?});
3341 try std.testing.expectFmt("fcvtmu w16, h17", "{f}", .{(try as.nextInstruction()).?});
3342 try std.testing.expectFmt("fcvtmu x18, h19", "{f}", .{(try as.nextInstruction()).?});
3343 try std.testing.expectFmt("fcvtmu w20, s21", "{f}", .{(try as.nextInstruction()).?});
3344 try std.testing.expectFmt("fcvtmu x22, s23", "{f}", .{(try as.nextInstruction()).?});
3345 try std.testing.expectFmt("fcvtmu w24, d25", "{f}", .{(try as.nextInstruction()).?});
3346 try std.testing.expectFmt("fcvtmu x26, d27", "{f}", .{(try as.nextInstruction()).?});
3347
3348 try std.testing.expectFmt("fcvtau h0, h1", "{f}", .{(try as.nextInstruction()).?});
3349 try std.testing.expectFmt("fcvtau s2, s3", "{f}", .{(try as.nextInstruction()).?});
3350 try std.testing.expectFmt("fcvtau d4, d5", "{f}", .{(try as.nextInstruction()).?});
3351 try std.testing.expectFmt("fcvtau v6.4h, v7.4h", "{f}", .{(try as.nextInstruction()).?});
3352 try std.testing.expectFmt("fcvtau v8.8h, v9.8h", "{f}", .{(try as.nextInstruction()).?});
3353 try std.testing.expectFmt("fcvtau v10.2s, v11.2s", "{f}", .{(try as.nextInstruction()).?});
3354 try std.testing.expectFmt("fcvtau v12.4s, v13.4s", "{f}", .{(try as.nextInstruction()).?});
3355 try std.testing.expectFmt("fcvtau v14.2d, v15.2d", "{f}", .{(try as.nextInstruction()).?});
3356 try std.testing.expectFmt("fcvtau w16, h17", "{f}", .{(try as.nextInstruction()).?});
3357 try std.testing.expectFmt("fcvtau x18, h19", "{f}", .{(try as.nextInstruction()).?});
3358 try std.testing.expectFmt("fcvtau w20, s21", "{f}", .{(try as.nextInstruction()).?});
3359 try std.testing.expectFmt("fcvtau x22, s23", "{f}", .{(try as.nextInstruction()).?});
3360 try std.testing.expectFmt("fcvtau w24, d25", "{f}", .{(try as.nextInstruction()).?});
3361 try std.testing.expectFmt("fcvtau x26, d27", "{f}", .{(try as.nextInstruction()).?});
3362
3363 try std.testing.expectFmt("ucvtf h0, h1", "{f}", .{(try as.nextInstruction()).?});
3364 try std.testing.expectFmt("ucvtf s2, s3", "{f}", .{(try as.nextInstruction()).?});
3365 try std.testing.expectFmt("ucvtf d4, d5", "{f}", .{(try as.nextInstruction()).?});
3366 try std.testing.expectFmt("ucvtf v6.4h, v7.4h", "{f}", .{(try as.nextInstruction()).?});
3367 try std.testing.expectFmt("ucvtf v8.8h, v9.8h", "{f}", .{(try as.nextInstruction()).?});
3368 try std.testing.expectFmt("ucvtf v10.2s, v11.2s", "{f}", .{(try as.nextInstruction()).?});
3369 try std.testing.expectFmt("ucvtf v12.4s, v13.4s", "{f}", .{(try as.nextInstruction()).?});
3370 try std.testing.expectFmt("ucvtf v14.2d, v15.2d", "{f}", .{(try as.nextInstruction()).?});
3371 try std.testing.expectFmt("ucvtf h16, w17", "{f}", .{(try as.nextInstruction()).?});
3372 try std.testing.expectFmt("ucvtf h18, x19", "{f}", .{(try as.nextInstruction()).?});
3373 try std.testing.expectFmt("ucvtf s20, w21", "{f}", .{(try as.nextInstruction()).?});
3374 try std.testing.expectFmt("ucvtf s22, x23", "{f}", .{(try as.nextInstruction()).?});
3375 try std.testing.expectFmt("ucvtf d24, w25", "{f}", .{(try as.nextInstruction()).?});
3376 try std.testing.expectFmt("ucvtf d26, x27", "{f}", .{(try as.nextInstruction()).?});
3377
3378 try std.testing.expectFmt("not v0.8b, v1.8b", "{f}", .{(try as.nextInstruction()).?});
3379 try std.testing.expectFmt("not v2.16b, v3.16b", "{f}", .{(try as.nextInstruction()).?});
3380
3381 try std.testing.expectFmt("fcmge h0, h1, #0.0", "{f}", .{(try as.nextInstruction()).?});
3382 try std.testing.expectFmt("fcmge s2, s3, #0.0", "{f}", .{(try as.nextInstruction()).?});
3383 try std.testing.expectFmt("fcmge d4, d5, #0.0", "{f}", .{(try as.nextInstruction()).?});
3384 try std.testing.expectFmt("fcmge v6.4h, v7.4h, #0.0", "{f}", .{(try as.nextInstruction()).?});
3385 try std.testing.expectFmt("fcmge v8.8h, v9.8h, #0.0", "{f}", .{(try as.nextInstruction()).?});
3386 try std.testing.expectFmt("fcmge v10.2s, v11.2s, #0.0", "{f}", .{(try as.nextInstruction()).?});
3387 try std.testing.expectFmt("fcmge v12.4s, v13.4s, #0.0", "{f}", .{(try as.nextInstruction()).?});
3388 try std.testing.expectFmt("fcmge v14.2d, v15.2d, #0.0", "{f}", .{(try as.nextInstruction()).?});
3389
3390 try std.testing.expectFmt("fcmle h0, h1, #0.0", "{f}", .{(try as.nextInstruction()).?});
3391 try std.testing.expectFmt("fcmle s2, s3, #0.0", "{f}", .{(try as.nextInstruction()).?});
3392 try std.testing.expectFmt("fcmle d4, d5, #0.0", "{f}", .{(try as.nextInstruction()).?});
3393 try std.testing.expectFmt("fcmle v6.4h, v7.4h, #0.0", "{f}", .{(try as.nextInstruction()).?});
3394 try std.testing.expectFmt("fcmle v8.8h, v9.8h, #0.0", "{f}", .{(try as.nextInstruction()).?});
3395 try std.testing.expectFmt("fcmle v10.2s, v11.2s, #0.0", "{f}", .{(try as.nextInstruction()).?});
3396 try std.testing.expectFmt("fcmle v12.4s, v13.4s, #0.0", "{f}", .{(try as.nextInstruction()).?});
3397 try std.testing.expectFmt("fcmle v14.2d, v15.2d, #0.0", "{f}", .{(try as.nextInstruction()).?});
3398
3399 try std.testing.expectFmt("frinti v0.4h, v1.4h", "{f}", .{(try as.nextInstruction()).?});
3400 try std.testing.expectFmt("frinti v2.8h, v3.8h", "{f}", .{(try as.nextInstruction()).?});
3401 try std.testing.expectFmt("frinti v4.2s, v5.2s", "{f}", .{(try as.nextInstruction()).?});
3402 try std.testing.expectFmt("frinti v6.4s, v7.4s", "{f}", .{(try as.nextInstruction()).?});
3403 try std.testing.expectFmt("frinti v8.2d, v9.2d", "{f}", .{(try as.nextInstruction()).?});
3404 try std.testing.expectFmt("frinti h10, h11", "{f}", .{(try as.nextInstruction()).?});
3405 try std.testing.expectFmt("frinti s12, s13", "{f}", .{(try as.nextInstruction()).?});
3406 try std.testing.expectFmt("frinti d14, d15", "{f}", .{(try as.nextInstruction()).?});
3407
3408 try std.testing.expectFmt("fcvtpu h0, h1", "{f}", .{(try as.nextInstruction()).?});
3409 try std.testing.expectFmt("fcvtpu s2, s3", "{f}", .{(try as.nextInstruction()).?});
3410 try std.testing.expectFmt("fcvtpu d4, d5", "{f}", .{(try as.nextInstruction()).?});
3411 try std.testing.expectFmt("fcvtpu v6.4h, v7.4h", "{f}", .{(try as.nextInstruction()).?});
3412 try std.testing.expectFmt("fcvtpu v8.8h, v9.8h", "{f}", .{(try as.nextInstruction()).?});
3413 try std.testing.expectFmt("fcvtpu v10.2s, v11.2s", "{f}", .{(try as.nextInstruction()).?});
3414 try std.testing.expectFmt("fcvtpu v12.4s, v13.4s", "{f}", .{(try as.nextInstruction()).?});
3415 try std.testing.expectFmt("fcvtpu v14.2d, v15.2d", "{f}", .{(try as.nextInstruction()).?});
3416 try std.testing.expectFmt("fcvtpu w16, h17", "{f}", .{(try as.nextInstruction()).?});
3417 try std.testing.expectFmt("fcvtpu x18, h19", "{f}", .{(try as.nextInstruction()).?});
3418 try std.testing.expectFmt("fcvtpu w20, s21", "{f}", .{(try as.nextInstruction()).?});
3419 try std.testing.expectFmt("fcvtpu x22, s23", "{f}", .{(try as.nextInstruction()).?});
3420 try std.testing.expectFmt("fcvtpu w24, d25", "{f}", .{(try as.nextInstruction()).?});
3421 try std.testing.expectFmt("fcvtpu x26, d27", "{f}", .{(try as.nextInstruction()).?});
3422
3423 try std.testing.expectFmt("fcvtzu h0, h1", "{f}", .{(try as.nextInstruction()).?});
3424 try std.testing.expectFmt("fcvtzu s2, s3", "{f}", .{(try as.nextInstruction()).?});
3425 try std.testing.expectFmt("fcvtzu d4, d5", "{f}", .{(try as.nextInstruction()).?});
3426 try std.testing.expectFmt("fcvtzu v6.4h, v7.4h", "{f}", .{(try as.nextInstruction()).?});
3427 try std.testing.expectFmt("fcvtzu v8.8h, v9.8h", "{f}", .{(try as.nextInstruction()).?});
3428 try std.testing.expectFmt("fcvtzu v10.2s, v11.2s", "{f}", .{(try as.nextInstruction()).?});
3429 try std.testing.expectFmt("fcvtzu v12.4s, v13.4s", "{f}", .{(try as.nextInstruction()).?});
3430 try std.testing.expectFmt("fcvtzu v14.2d, v15.2d", "{f}", .{(try as.nextInstruction()).?});
3431 try std.testing.expectFmt("fcvtzu w16, h17", "{f}", .{(try as.nextInstruction()).?});
3432 try std.testing.expectFmt("fcvtzu x18, h19", "{f}", .{(try as.nextInstruction()).?});
3433 try std.testing.expectFmt("fcvtzu w20, s21", "{f}", .{(try as.nextInstruction()).?});
3434 try std.testing.expectFmt("fcvtzu x22, s23", "{f}", .{(try as.nextInstruction()).?});
3435 try std.testing.expectFmt("fcvtzu w24, d25", "{f}", .{(try as.nextInstruction()).?});
3436 try std.testing.expectFmt("fcvtzu x26, d27", "{f}", .{(try as.nextInstruction()).?});
3437
3438 try std.testing.expect(null == try as.nextInstruction());
3439}
3440
3441const aarch64 = @import("../aarch64.zig");
3442const Assemble = @This();
3443const assert = std.debug.assert;
3444const Instruction = aarch64.encoding.Instruction;
3445const std = @import("std");
3446const log = std.log.scoped(.@"asm");