authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-02-27 12:19:16-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-02-28 14:51:55-05:00
logbafa895561a6603351be8d5c3521c9a447645d08
tree7b37ffe56cae4cf95ddce2cf6e803b281be06031
parent36aa3c8e7ff1c945c9014bcd5431a4eedd217e8c
signaturelock-open Commit is signed but in an unrecognized format.

compiler-rt: inline at call site to workaround a bug

The bug is #2154

1 files changed, 6 insertions(+), 6 deletions(-)

lib/std/special/compiler_rt/truncXfYf2.zig+6-6
......@@ -1,23 +1,23 @@
11const std = @import("std");
22
33pub fn __truncsfhf2(a: f32) callconv(.C) u16 {
4 return @bitCast(u16, truncXfYf2(f16, f32, a));
4 return @bitCast(u16, @call(.{ .modifier = .always_inline }, truncXfYf2, .{ f16, f32, a }));
55}
66
77pub fn __truncdfhf2(a: f64) callconv(.C) u16 {
8 return @bitCast(u16, truncXfYf2(f16, f64, a));
8 return @bitCast(u16, @call(.{ .modifier = .always_inline }, truncXfYf2, .{ f16, f64, a }));
99}
1010
1111pub fn __trunctfsf2(a: f128) callconv(.C) f32 {
12 return truncXfYf2(f32, f128, a);
12 return @call(.{ .modifier = .always_inline }, truncXfYf2, .{ f32, f128, a });
1313}
1414
1515pub fn __trunctfdf2(a: f128) callconv(.C) f64 {
16 return truncXfYf2(f64, f128, a);
16 return @call(.{ .modifier = .always_inline }, truncXfYf2, .{ f64, f128, a });
1717}
1818
1919pub fn __truncdfsf2(a: f64) callconv(.C) f32 {
20 return truncXfYf2(f32, f64, a);
20 return @call(.{ .modifier = .always_inline }, truncXfYf2, .{ f32, f64, a });
2121}
2222
2323pub fn __aeabi_d2f(a: f64) callconv(.AAPCS) f32 {
......@@ -35,7 +35,7 @@ pub fn __aeabi_f2h(a: f32) callconv(.AAPCS) u16 {
3535 return @call(.{ .modifier = .always_inline }, __truncsfhf2, .{a});
3636}
3737
38inline fn truncXfYf2(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t {
38fn truncXfYf2(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t {
3939 const src_rep_t = std.meta.IntType(false, @typeInfo(src_t).Float.bits);
4040 const dst_rep_t = std.meta.IntType(false, @typeInfo(dst_t).Float.bits);
4141 const srcSigBits = std.math.floatMantissaBits(src_t);