diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-10-05 14:20:12 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-10-05 14:22:38 -0700 |
| commit | 4ee91bb8a83fbddaf266500196525308525e2605 (patch) | |
| tree | 5aa0ee6ec57501a7607013cc0a9688341d11f5b8 /lib/std/special/compiler_rt.zig | |
| parent | 5e153b53828875a0c5b6c893ff40add07ac0aafd (diff) | |
| download | zig-4ee91bb8a83fbddaf266500196525308525e2605.tar.gz zig-4ee91bb8a83fbddaf266500196525308525e2605.zip | |
stage1: work around LLVM's buggy fma lowering
* move fmaq from freestanding libc to compiler_rt, unconditionally
exported weak_odr.
* stage1: add fmaf, fmal, fmaq as symbols that compiler-rt might
generate calls to.
* stage1: lower `@mulAdd` directly to a call to `fmaq` instead of to
the LLVM intrinsic because LLVM will lower it to `fmal` even when the
target's `long double` is not equivalent to `f128`.
This commit is intended to fix the test suite which is failing on the
previous commit.
Diffstat (limited to 'lib/std/special/compiler_rt.zig')
| -rw-r--r-- | lib/std/special/compiler_rt.zig | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/std/special/compiler_rt.zig b/lib/std/special/compiler_rt.zig index ce3373abac..1b3e80ed12 100644 --- a/lib/std/special/compiler_rt.zig +++ b/lib/std/special/compiler_rt.zig @@ -616,9 +616,15 @@ comptime { @export(__mulodi4, .{ .name = "__mulodi4", .linkage = linkage }); _ = @import("compiler_rt/atomics.zig"); + + @export(fmaq, .{ .name = "fmaq", .linkage = linkage }); } } +fn fmaq(a: f128, b: f128, c: f128) callconv(.C) f128 { + return std.math.fma(f128, a, b, c); +} + // Avoid dragging in the runtime safety mechanisms into this .o file, // unless we're trying to test this file. pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace) noreturn { |
