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