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 @@...@@ -1,23 +1,23 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn __truncsfhf2(a: f32) callconv(.C) u16 {3pub 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 }));
5}5}
66
7pub fn __truncdfhf2(a: f64) callconv(.C) u16 {7pub 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 }));
9}9}
1010
11pub fn __trunctfsf2(a: f128) callconv(.C) f32 {11pub fn __trunctfsf2(a: f128) callconv(.C) f32 {
12 return truncXfYf2(f32, f128, a);12 return @call(.{ .modifier = .always_inline }, truncXfYf2, .{ f32, f128, a });
13}13}
1414
15pub fn __trunctfdf2(a: f128) callconv(.C) f64 {15pub fn __trunctfdf2(a: f128) callconv(.C) f64 {
16 return truncXfYf2(f64, f128, a);16 return @call(.{ .modifier = .always_inline }, truncXfYf2, .{ f64, f128, a });
17}17}
1818
19pub fn __truncdfsf2(a: f64) callconv(.C) f32 {19pub fn __truncdfsf2(a: f64) callconv(.C) f32 {
20 return truncXfYf2(f32, f64, a);20 return @call(.{ .modifier = .always_inline }, truncXfYf2, .{ f32, f64, a });
21}21}
2222
23pub fn __aeabi_d2f(a: f64) callconv(.AAPCS) f32 {23pub fn __aeabi_d2f(a: f64) callconv(.AAPCS) f32 {
...@@ -35,7 +35,7 @@ pub fn __aeabi_f2h(a: f32) callconv(.AAPCS) u16 {...@@ -35,7 +35,7 @@ pub fn __aeabi_f2h(a: f32) callconv(.AAPCS) u16 {
35 return @call(.{ .modifier = .always_inline }, __truncsfhf2, .{a});35 return @call(.{ .modifier = .always_inline }, __truncsfhf2, .{a});
36}36}
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 {
39 const src_rep_t = std.meta.IntType(false, @typeInfo(src_t).Float.bits);39 const src_rep_t = std.meta.IntType(false, @typeInfo(src_t).Float.bits);
40 const dst_rep_t = std.meta.IntType(false, @typeInfo(dst_t).Float.bits);40 const dst_rep_t = std.meta.IntType(false, @typeInfo(dst_t).Float.bits);
41 const srcSigBits = std.math.floatMantissaBits(src_t);41 const srcSigBits = std.math.floatMantissaBits(src_t);