| ... | ... | @@ -2403,13 +2403,31 @@ pub const DeclGen = struct { |
| 2403 | 2403 | if (self.liveness.isUnused(inst)) return null; |
| 2404 | 2404 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 2405 | 2405 | const operand_id = try self.resolve(ty_op.operand); |
| 2406 | const result_ty = self.typeOfIndex(inst); |
| 2407 | const result_ty_id = try self.resolveTypeId(result_ty); |
| 2408 | const info = try self.arithmeticTypeInfo(result_ty); |
| 2409 | |
| 2406 | 2410 | const result_id = self.spv.allocId(); |
| 2407 | | const result_type_id = try self.resolveTypeId(Type.bool); |
| 2408 | | try self.func.body.emit(self.spv.gpa, .OpLogicalNot, .{ |
| 2409 | | .id_result_type = result_type_id, |
| 2410 | | .id_result = result_id, |
| 2411 | | .operand = operand_id, |
| 2412 | | }); |
| 2411 | switch (info.class) { |
| 2412 | .bool => { |
| 2413 | try self.func.body.emit(self.spv.gpa, .OpLogicalNot, .{ |
| 2414 | .id_result_type = result_ty_id, |
| 2415 | .id_result = result_id, |
| 2416 | .operand = operand_id, |
| 2417 | }); |
| 2418 | }, |
| 2419 | .float => unreachable, |
| 2420 | .composite_integer => unreachable, // TODO |
| 2421 | .strange_integer, .integer => { |
| 2422 | // Note: strange integer bits will be masked before operations that do not hold under modulo. |
| 2423 | try self.func.body.emit(self.spv.gpa, .OpNot, .{ |
| 2424 | .id_result_type = result_ty_id, |
| 2425 | .id_result = result_id, |
| 2426 | .operand = operand_id, |
| 2427 | }); |
| 2428 | }, |
| 2429 | } |
| 2430 | |
| 2413 | 2431 | return result_id; |
| 2414 | 2432 | } |
| 2415 | 2433 | |