From f9717f87f55cac0d986b6e3a47eba899a63912fb Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Tue, 25 Jul 2023 22:15:02 -0400 Subject: [PATCH] llvm: fix data layout on ios Closes #16549 --- src/codegen/llvm.zig | 4 ++-- test/llvm_targets.zig | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index b030a5cc7e..436ca0cc30 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -429,7 +429,7 @@ const DataLayoutBuilder = struct { if (backendSupportsF16(self.target)) try self.typeAlignment(.float, 16, 16, 16, false, writer); try self.typeAlignment(.float, 32, 32, 32, false, writer); try self.typeAlignment(.float, 64, 64, 64, false, writer); - if (backendSupportsF80(self.target)) try self.typeAlignment(.float, 80, 0, 0, false, writer); + if (self.target.cpu.arch.isX86()) try self.typeAlignment(.float, 80, 0, 0, false, writer); try self.typeAlignment(.float, 128, 128, 128, false, writer); } switch (self.target.cpu.arch) { @@ -585,7 +585,7 @@ const DataLayoutBuilder = struct { abi = size; pref = size; } else switch (self.target.os.tag) { - .macos => {}, + .macos, .ios => {}, .uefi, .windows => { pref = size; force_abi = size >= 32; diff --git a/test/llvm_targets.zig b/test/llvm_targets.zig index d042ce500c..3bd864c3d2 100644 --- a/test/llvm_targets.zig +++ b/test/llvm_targets.zig @@ -3,6 +3,8 @@ const Cases = @import("src/Cases.zig"); const targets = [_]std.zig.CrossTarget{ .{ .cpu_arch = .aarch64, .os_tag = .freestanding, .abi = .none }, + .{ .cpu_arch = .aarch64, .os_tag = .ios, .abi = .none }, + .{ .cpu_arch = .aarch64, .os_tag = .ios, .abi = .simulator }, .{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = .none }, .{ .cpu_arch = .aarch64, .os_tag = .macos, .abi = .none }, .{ .cpu_arch = .aarch64, .os_tag = .uefi, .abi = .none }, @@ -102,6 +104,14 @@ const targets = [_]std.zig.CrossTarget{ .{ .cpu_arch = .x86, .os_tag = .windows, .abi = .msvc }, .{ .cpu_arch = .x86_64, .os_tag = .freebsd, .abi = .none }, .{ .cpu_arch = .x86_64, .os_tag = .freestanding, .abi = .none }, + .{ + .cpu_arch = .x86_64, + .os_tag = .freestanding, + .abi = .none, + .cpu_features_add = std.Target.x86.featureSet(&.{.soft_float}), + .cpu_features_sub = std.Target.x86.featureSet(&.{ .mmx, .sse, .sse2, .avx, .avx2 }), + }, + .{ .cpu_arch = .x86_64, .os_tag = .ios, .abi = .simulator }, .{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .none }, .{ .cpu_arch = .x86_64, .os_tag = .macos, .abi = .none }, .{ .cpu_arch = .x86_64, .os_tag = .uefi, .abi = .none },