authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-04-27 18:26:47-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-04-27 18:26:47-07:00
log51f8ce182573e940ee090c1df146a83de63d6b5c
tree4101f385da70705f001fc6d7ac0406c7ce0195a5
parent1ac21cdec5747e2c7788c566a2998b2bee54eb47

compiler-rt: fix powerpc f128 suffix


1 files changed, 9 insertions(+), 5 deletions(-)

lib/std/special/compiler_rt.zig+9-5
...@@ -8,6 +8,7 @@ const abi = builtin.abi;...@@ -8,6 +8,7 @@ const abi = builtin.abi;
8const is_gnu = abi.isGnu();8const is_gnu = abi.isGnu();
9const is_mingw = os_tag == .windows and is_gnu;9const is_mingw = os_tag == .windows and is_gnu;
10const is_darwin = std.Target.Os.Tag.isDarwin(os_tag);10const is_darwin = std.Target.Os.Tag.isDarwin(os_tag);
11const is_ppc = arch.isPPC() or arch.isPPC64();
1112
12const linkage = if (is_test)13const linkage = if (is_test)
13 std.builtin.GlobalLinkage.Internal14 std.builtin.GlobalLinkage.Internal
...@@ -795,7 +796,7 @@ comptime {...@@ -795,7 +796,7 @@ comptime {
795 @export(_Qp_qtod, .{ .name = "_Qp_qtod", .linkage = linkage });796 @export(_Qp_qtod, .{ .name = "_Qp_qtod", .linkage = linkage });
796 }797 }
797798
798 if ((arch.isPPC() or arch.isPPC64()) and !is_test) {799 if (is_ppc and !is_test) {
799 @export(__addtf3, .{ .name = "__addkf3", .linkage = linkage });800 @export(__addtf3, .{ .name = "__addkf3", .linkage = linkage });
800 @export(__subtf3, .{ .name = "__subkf3", .linkage = linkage });801 @export(__subtf3, .{ .name = "__subkf3", .linkage = linkage });
801 @export(__multf3, .{ .name = "__mulkf3", .linkage = linkage });802 @export(__multf3, .{ .name = "__mulkf3", .linkage = linkage });
...@@ -820,10 +821,6 @@ comptime {...@@ -820,10 +821,6 @@ comptime {
820 @export(__letf2, .{ .name = "__lekf2", .linkage = linkage });821 @export(__letf2, .{ .name = "__lekf2", .linkage = linkage });
821 @export(__getf2, .{ .name = "__gtkf2", .linkage = linkage });822 @export(__getf2, .{ .name = "__gtkf2", .linkage = linkage });
822 @export(__unordtf2, .{ .name = "__unordkf2", .linkage = linkage });823 @export(__unordtf2, .{ .name = "__unordkf2", .linkage = linkage });
823
824 // LLVM PPC backend lowers f128 fma to `fmaf128`.
825 const fmaq = @import("./compiler_rt/fma.zig").fmaq;
826 @export(fmaq, .{ .name = "fmaf128", .linkage = linkage });
827 }824 }
828}825}
829826
...@@ -845,6 +842,8 @@ inline fn mathExport(double_name: []const u8, comptime import: type, is_standard...@@ -845,6 +842,8 @@ inline fn mathExport(double_name: []const u8, comptime import: type, is_standard
845 @export(xf80_fn, .{ .name = xf80_name, .linkage = linkage });842 @export(xf80_fn, .{ .name = xf80_name, .linkage = linkage });
846 @export(quad_fn, .{ .name = quad_name, .linkage = linkage });843 @export(quad_fn, .{ .name = quad_name, .linkage = linkage });
847844
845 if (is_test) return;
846
848 const pairs = .{847 const pairs = .{
849 .{ f16, half_fn },848 .{ f16, half_fn },
850 .{ f32, float_fn },849 .{ f32, float_fn },
...@@ -864,6 +863,11 @@ inline fn mathExport(double_name: []const u8, comptime import: type, is_standard...@@ -864,6 +863,11 @@ inline fn mathExport(double_name: []const u8, comptime import: type, is_standard
864 }863 }
865 }864 }
866 }865 }
866
867 if (is_ppc and is_standard) {
868 // LLVM PPC backend lowers f128 ops with the suffix `f128` instead of `l`.
869 @export(quad_fn, .{ .name = double_name ++ "f128", .linkage = linkage });
870 }
867}871}
868872
869// Avoid dragging in the runtime safety mechanisms into this .o file,873// Avoid dragging in the runtime safety mechanisms into this .o file,