aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2024-05-01 23:39:59 -0400
committerAndrew Kelley <andrew@ziglang.org>2024-05-08 19:37:29 -0700
commit08cecc1c7e453042123f8ec6a240a49cbf3b165a (patch)
tree41782f843f057d6727e272f9cf08235a4676b7d3 /src
parente9efed9ed117c1b6f5fc138999d82e0dbb1f13bf (diff)
downloadzig-08cecc1c7e453042123f8ec6a240a49cbf3b165a.tar.gz
zig-08cecc1c7e453042123f8ec6a240a49cbf3b165a.zip
x86_64: fix C abi of incomplete sse register
Diffstat (limited to 'src')
-rw-r--r--src/arch/x86_64/abi.zig7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/arch/x86_64/abi.zig b/src/arch/x86_64/abi.zig
index 0ae69eb09c..0371e84497 100644
--- a/src/arch/x86_64/abi.zig
+++ b/src/arch/x86_64/abi.zig
@@ -285,17 +285,16 @@ pub fn classifySystemV(ty: Type, zcu: *Zcu, target: std.Target, ctx: Context) [8
// "If one of the classes is MEMORY, the whole argument is passed in memory"
// "If X87UP is not preceded by X87, the whole argument is passed in memory."
- var found_sseup = false;
- for (result, 0..) |item, i| switch (item) {
+ for (result, 0..) |class, i| switch (class) {
.memory => return memory_class,
.x87up => if (i == 0 or result[i - 1] != .x87) return memory_class,
- .sseup => found_sseup = true,
else => continue,
};
// "If the size of the aggregate exceeds two eightbytes and the first eight-
// byte isn’t SSE or any other eightbyte isn’t SSEUP, the whole argument
// is passed in memory."
- if (ty_size > 16 and (result[0] != .sse or !found_sseup)) return memory_class;
+ if (ty_size > 16 and (result[0] != .sse or
+ std.mem.indexOfNone(Class, result[1..], &.{ .sseup, .none }) != null)) return memory_class;
// "If SSEUP is not preceded by SSE or SSEUP, it is converted to SSE."
for (&result, 0..) |*item, i| {