| ... | @@ -3218,31 +3218,31 @@ const DeclGen = struct { | ... | @@ -3218,31 +3218,31 @@ const DeclGen = struct { |
| 3218 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 3218 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 3219 | const operand_id = try self.resolve(ty_op.operand); | 3219 | const operand_id = try self.resolve(ty_op.operand); |
| 3220 | const result_ty = self.typeOfIndex(inst); | 3220 | const result_ty = self.typeOfIndex(inst); |
| 3221 | const result_ty_id = try self.resolveTypeId(result_ty); | | |
| 3222 | const info = try self.arithmeticTypeInfo(result_ty); | 3221 | const info = try self.arithmeticTypeInfo(result_ty); |
| 3223 | | 3222 | |
| 3224 | const result_id = self.spv.allocId(); | 3223 | var wip = try self.elementWise(result_ty); |
| 3225 | switch (info.class) { | 3224 | defer wip.deinit(); |
| 3226 | .bool => { | 3225 | |
| 3227 | try self.func.body.emit(self.spv.gpa, .OpLogicalNot, .{ | 3226 | for (0..wip.results.len) |i| { |
| 3228 | .id_result_type = result_ty_id, | 3227 | const args = .{ |
| 3229 | .id_result = result_id, | 3228 | .id_result_type = wip.scalar_ty_id, |
| 3230 | .operand = operand_id, | 3229 | .id_result = wip.allocId(i), |
| 3231 | }); | 3230 | .operand = try wip.elementAt(result_ty, operand_id, i), |
| 3232 | }, | 3231 | }; |
| 3233 | .float => unreachable, | 3232 | switch (info.class) { |
| 3234 | .composite_integer => unreachable, // TODO | 3233 | .bool => { |
| 3235 | .strange_integer, .integer => { | 3234 | try self.func.body.emit(self.spv.gpa, .OpLogicalNot, args); |
| 3236 | // Note: strange integer bits will be masked before operations that do not hold under modulo. | 3235 | }, |
| 3237 | try self.func.body.emit(self.spv.gpa, .OpNot, .{ | 3236 | .float => unreachable, |
| 3238 | .id_result_type = result_ty_id, | 3237 | .composite_integer => unreachable, // TODO |
| 3239 | .id_result = result_id, | 3238 | .strange_integer, .integer => { |
| 3240 | .operand = operand_id, | 3239 | // Note: strange integer bits will be masked before operations that do not hold under modulo. |
| 3241 | }); | 3240 | try self.func.body.emit(self.spv.gpa, .OpNot, args); |
| 3242 | }, | 3241 | }, |
| | 3242 | } |
| 3243 | } | 3243 | } |
| 3244 | | 3244 | |
| 3245 | return result_id; | 3245 | return try wip.finalize(); |
| 3246 | } | 3246 | } |
| 3247 | | 3247 | |
| 3248 | fn airArrayToSlice(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { | 3248 | fn airArrayToSlice(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| ... | @@ -3305,7 +3305,6 @@ const DeclGen = struct { | ... | @@ -3305,7 +3305,6 @@ const DeclGen = struct { |
| 3305 | const elements: []const Air.Inst.Ref = @ptrCast(self.air.extra[ty_pl.payload..][0..len]); | 3305 | const elements: []const Air.Inst.Ref = @ptrCast(self.air.extra[ty_pl.payload..][0..len]); |
| 3306 | | 3306 | |
| 3307 | switch (result_ty.zigTypeTag(mod)) { | 3307 | switch (result_ty.zigTypeTag(mod)) { |
| 3308 | .Vector => unreachable, // TODO | | |
| 3309 | .Struct => { | 3308 | .Struct => { |
| 3310 | if (mod.typeToPackedStruct(result_ty)) |struct_type| { | 3309 | if (mod.typeToPackedStruct(result_ty)) |struct_type| { |
| 3311 | _ = struct_type; | 3310 | _ = struct_type; |
| ... | @@ -3353,7 +3352,7 @@ const DeclGen = struct { | ... | @@ -3353,7 +3352,7 @@ const DeclGen = struct { |
| 3353 | constituents[0..index], | 3352 | constituents[0..index], |
| 3354 | ); | 3353 | ); |
| 3355 | }, | 3354 | }, |
| 3356 | .Array => { | 3355 | .Vector, .Array => { |
| 3357 | const array_info = result_ty.arrayInfo(mod); | 3356 | const array_info = result_ty.arrayInfo(mod); |
| 3358 | const n_elems: usize = @intCast(result_ty.arrayLenIncludingSentinel(mod)); | 3357 | const n_elems: usize = @intCast(result_ty.arrayLenIncludingSentinel(mod)); |
| 3359 | const elem_ids = try self.gpa.alloc(IdRef, n_elems); | 3358 | const elem_ids = try self.gpa.alloc(IdRef, n_elems); |