diff options
| author | David Rubin <87927264+Rexicon226@users.noreply.github.com> | 2024-10-12 20:59:12 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-12 20:59:12 -0700 |
| commit | e131a2c8e20de13256954cbb38ca3502cdfca07b (patch) | |
| tree | 4734479898bf5a21d931f52d84039136351e17ee /src/codegen/llvm.zig | |
| parent | ba1331090c19662dc0eff4d38f80df6ec58c675a (diff) | |
| download | zig-e131a2c8e20de13256954cbb38ca3502cdfca07b.tar.gz zig-e131a2c8e20de13256954cbb38ca3502cdfca07b.zip | |
implement packed struct equality (#21679)
Diffstat (limited to 'src/codegen/llvm.zig')
| -rw-r--r-- | src/codegen/llvm.zig | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 623aa995d4..bd59cef569 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -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); |
