| ... | @@ -4601,7 +4601,12 @@ fn isNull(self: *Self, operand_bind: ReadArg.Bind, operand_ty: Type) !MCValue { | ... | @@ -4601,7 +4601,12 @@ fn isNull(self: *Self, operand_bind: ReadArg.Bind, operand_ty: Type) !MCValue { |
| 4601 | const imm_bind: ReadArg.Bind = .{ .mcv = .{ .immediate = 0 } }; | 4601 | const imm_bind: ReadArg.Bind = .{ .mcv = .{ .immediate = 0 } }; |
| 4602 | return self.cmp(operand_bind, imm_bind, Type.usize, .eq); | 4602 | return self.cmp(operand_bind, imm_bind, Type.usize, .eq); |
| 4603 | } else { | 4603 | } else { |
| 4604 | return self.fail("TODO implement non-pointer optionals", .{}); | 4604 | var buf: Type.Payload.ElemType = undefined; |
| | 4605 | const payload_ty = operand_ty.optionalChild(&buf); |
| | 4606 | const sentinel_ty = if (payload_ty.hasRuntimeBitsIgnoreComptime()) Type.bool else operand_ty; |
| | 4607 | |
| | 4608 | const imm_bind: ReadArg.Bind = .{ .mcv = .{ .immediate = 0 } }; |
| | 4609 | return self.cmp(operand_bind, imm_bind, sentinel_ty, .eq); |
| 4605 | } | 4610 | } |
| 4606 | } | 4611 | } |
| 4607 | | 4612 | |