implement packed struct equality (#21679)
This commit is contained in:
@@ -6032,6 +6032,7 @@ pub const FuncGen = struct {
|
||||
const o = self.ng.object;
|
||||
const pt = o.pt;
|
||||
const zcu = pt.zcu;
|
||||
const ip = &zcu.intern_pool;
|
||||
const scalar_ty = operand_ty.scalarType(zcu);
|
||||
const int_ty = switch (scalar_ty.zigTypeTag(zcu)) {
|
||||
.@"enum" => scalar_ty.intTagType(zcu),
|
||||
@@ -6110,6 +6111,12 @@ pub const FuncGen = struct {
|
||||
return phi.toValue();
|
||||
},
|
||||
.float => return self.buildFloatCmp(fast, op, operand_ty, .{ lhs, rhs }),
|
||||
.@"struct" => blk: {
|
||||
const struct_obj = ip.loadStructType(scalar_ty.toIntern());
|
||||
assert(struct_obj.layout == .@"packed");
|
||||
const backing_index = struct_obj.backingIntTypeUnordered(ip);
|
||||
break :blk Type.fromInterned(backing_index);
|
||||
},
|
||||
else => unreachable,
|
||||
};
|
||||
const is_signed = int_ty.isSignedInt(zcu);
|
||||
|
||||
Reference in New Issue
Block a user