mirror of
https://github.com/ziglang/zig.git
synced 2026-02-17 06:49:23 +00:00
aarch64: implement isNull() for non-pointer optionals
This commit is contained in:
parent
0de56d1722
commit
35bd5363ee
@ -4601,7 +4601,12 @@ fn isNull(self: *Self, operand_bind: ReadArg.Bind, operand_ty: Type) !MCValue {
|
||||
const imm_bind: ReadArg.Bind = .{ .mcv = .{ .immediate = 0 } };
|
||||
return self.cmp(operand_bind, imm_bind, Type.usize, .eq);
|
||||
} else {
|
||||
return self.fail("TODO implement non-pointer optionals", .{});
|
||||
var buf: Type.Payload.ElemType = undefined;
|
||||
const payload_ty = operand_ty.optionalChild(&buf);
|
||||
const sentinel_ty = if (payload_ty.hasRuntimeBitsIgnoreComptime()) Type.bool else operand_ty;
|
||||
|
||||
const imm_bind: ReadArg.Bind = .{ .mcv = .{ .immediate = 0 } };
|
||||
return self.cmp(operand_bind, imm_bind, sentinel_ty, .eq);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user