| ... | ... | @@ -611,7 +611,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { |
| 611 | 611 | .select => @panic("TODO try self.airSelect(inst)"), |
| 612 | 612 | .shuffle => @panic("TODO try self.airShuffle(inst)"), |
| 613 | 613 | .reduce => @panic("TODO try self.airReduce(inst)"), |
| 614 | | .aggregate_init => @panic("TODO try self.airAggregateInit(inst)"), |
| 614 | .aggregate_init => try self.airAggregateInit(inst), |
| 615 | 615 | .union_init => @panic("TODO try self.airUnionInit(inst)"), |
| 616 | 616 | .prefetch => @panic("TODO try self.airPrefetch(inst)"), |
| 617 | 617 | .mul_add => @panic("TODO try self.airMulAdd(inst)"), |
| ... | ... | @@ -777,6 +777,28 @@ fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 777 | 777 | return self.finishAir(inst, result, .{ extra.lhs, extra.rhs, .none }); |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void { |
| 781 | const vector_ty = self.air.typeOfIndex(inst); |
| 782 | const len = vector_ty.vectorLen(); |
| 783 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 784 | const elements = @ptrCast([]const Air.Inst.Ref, self.air.extra[ty_pl.payload..][0..len]); |
| 785 | const result: MCValue = res: { |
| 786 | if (self.liveness.isUnused(inst)) break :res MCValue.dead; |
| 787 | return self.fail("TODO implement airAggregateInit for {}", .{self.target.cpu.arch}); |
| 788 | }; |
| 789 | |
| 790 | if (elements.len <= Liveness.bpi - 1) { |
| 791 | var buf = [1]Air.Inst.Ref{.none} ** (Liveness.bpi - 1); |
| 792 | std.mem.copy(Air.Inst.Ref, &buf, elements); |
| 793 | return self.finishAir(inst, result, buf); |
| 794 | } |
| 795 | var bt = try self.iterateBigTomb(inst, elements.len); |
| 796 | for (elements) |elem| { |
| 797 | bt.feed(elem); |
| 798 | } |
| 799 | return bt.finishAir(result); |
| 800 | } |
| 801 | |
| 780 | 802 | fn airAlloc(self: *Self, inst: Air.Inst.Index) !void { |
| 781 | 803 | const stack_offset = try self.allocMemPtr(inst); |
| 782 | 804 | return self.finishAir(inst, .{ .ptr_stack_offset = stack_offset }, .{ .none, .none, .none }); |