authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-01-07 17:44:20+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-07 13:42:47-05:00
loge81b505960b106a042e4cb890971ba365a5ef180
tree751dc190a6b9c95a9cfd33057657e2a55b94b691
parent4e4ba6c3e1273fda8137f9f7e26325051f92bfa4

Use the correct calling convention for AEABI intrinsics


38 files changed, 194 insertions(+), 156 deletions(-)

lib/std/fmt.zig-24
...@@ -1292,10 +1292,6 @@ test "cstr" {...@@ -1292,10 +1292,6 @@ test "cstr" {
1292}1292}
12931293
1294test "filesize" {1294test "filesize" {
1295 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
1296 // TODO https://github.com/ziglang/zig/issues/3289
1297 return error.SkipZigTest;
1298 }
1299 try testFmt("file size: 63MiB\n", "file size: {Bi}\n", .{@as(usize, 63 * 1024 * 1024)});1295 try testFmt("file size: 63MiB\n", "file size: {Bi}\n", .{@as(usize, 63 * 1024 * 1024)});
1300 try testFmt("file size: 66.06MB\n", "file size: {B:.2}\n", .{@as(usize, 63 * 1024 * 1024)});1296 try testFmt("file size: 66.06MB\n", "file size: {B:.2}\n", .{@as(usize, 63 * 1024 * 1024)});
1301}1297}
...@@ -1330,10 +1326,6 @@ test "enum" {...@@ -1330,10 +1326,6 @@ test "enum" {
1330}1326}
13311327
1332test "float.scientific" {1328test "float.scientific" {
1333 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
1334 // TODO https://github.com/ziglang/zig/issues/3289
1335 return error.SkipZigTest;
1336 }
1337 try testFmt("f32: 1.34000003e+00", "f32: {e}", .{@as(f32, 1.34)});1329 try testFmt("f32: 1.34000003e+00", "f32: {e}", .{@as(f32, 1.34)});
1338 try testFmt("f32: 1.23400001e+01", "f32: {e}", .{@as(f32, 12.34)});1330 try testFmt("f32: 1.23400001e+01", "f32: {e}", .{@as(f32, 12.34)});
1339 try testFmt("f64: -1.234e+11", "f64: {e}", .{@as(f64, -12.34e10)});1331 try testFmt("f64: -1.234e+11", "f64: {e}", .{@as(f64, -12.34e10)});
...@@ -1341,10 +1333,6 @@ test "float.scientific" {...@@ -1341,10 +1333,6 @@ test "float.scientific" {
1341}1333}
13421334
1343test "float.scientific.precision" {1335test "float.scientific.precision" {
1344 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
1345 // TODO https://github.com/ziglang/zig/issues/3289
1346 return error.SkipZigTest;
1347 }
1348 try testFmt("f64: 1.40971e-42", "f64: {e:.5}", .{@as(f64, 1.409706e-42)});1336 try testFmt("f64: 1.40971e-42", "f64: {e:.5}", .{@as(f64, 1.409706e-42)});
1349 try testFmt("f64: 1.00000e-09", "f64: {e:.5}", .{@as(f64, @bitCast(f32, @as(u32, 814313563)))});1337 try testFmt("f64: 1.00000e-09", "f64: {e:.5}", .{@as(f64, @bitCast(f32, @as(u32, 814313563)))});
1350 try testFmt("f64: 7.81250e-03", "f64: {e:.5}", .{@as(f64, @bitCast(f32, @as(u32, 1006632960)))});1338 try testFmt("f64: 7.81250e-03", "f64: {e:.5}", .{@as(f64, @bitCast(f32, @as(u32, 1006632960)))});
...@@ -1354,10 +1342,6 @@ test "float.scientific.precision" {...@@ -1354,10 +1342,6 @@ test "float.scientific.precision" {
1354}1342}
13551343
1356test "float.special" {1344test "float.special" {
1357 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
1358 // TODO https://github.com/ziglang/zig/issues/3289
1359 return error.SkipZigTest;
1360 }
1361 try testFmt("f64: nan", "f64: {}", .{math.nan_f64});1345 try testFmt("f64: nan", "f64: {}", .{math.nan_f64});
1362 // negative nan is not defined by IEE 754,1346 // negative nan is not defined by IEE 754,
1363 // and ARM thus normalizes it to positive nan1347 // and ARM thus normalizes it to positive nan
...@@ -1369,10 +1353,6 @@ test "float.special" {...@@ -1369,10 +1353,6 @@ test "float.special" {
1369}1353}
13701354
1371test "float.decimal" {1355test "float.decimal" {
1372 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
1373 // TODO https://github.com/ziglang/zig/issues/3289
1374 return error.SkipZigTest;
1375 }
1376 try testFmt("f64: 152314000000000000000000000000", "f64: {d}", .{@as(f64, 1.52314e+29)});1356 try testFmt("f64: 152314000000000000000000000000", "f64: {d}", .{@as(f64, 1.52314e+29)});
1377 try testFmt("f32: 1.1", "f32: {d:.1}", .{@as(f32, 1.1234)});1357 try testFmt("f32: 1.1", "f32: {d:.1}", .{@as(f32, 1.1234)});
1378 try testFmt("f32: 1234.57", "f32: {d:.2}", .{@as(f32, 1234.567)});1358 try testFmt("f32: 1234.57", "f32: {d:.2}", .{@as(f32, 1234.567)});
...@@ -1391,10 +1371,6 @@ test "float.decimal" {...@@ -1391,10 +1371,6 @@ test "float.decimal" {
1391}1371}
13921372
1393test "float.libc.sanity" {1373test "float.libc.sanity" {
1394 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
1395 // TODO https://github.com/ziglang/zig/issues/3289
1396 return error.SkipZigTest;
1397 }
1398 try testFmt("f64: 0.00001", "f64: {d:.5}", .{@as(f64, @bitCast(f32, @as(u32, 916964781)))});1374 try testFmt("f64: 0.00001", "f64: {d:.5}", .{@as(f64, @bitCast(f32, @as(u32, 916964781)))});
1399 try testFmt("f64: 0.00001", "f64: {d:.5}", .{@as(f64, @bitCast(f32, @as(u32, 925353389)))});1375 try testFmt("f64: 0.00001", "f64: {d:.5}", .{@as(f64, @bitCast(f32, @as(u32, 925353389)))});
1400 try testFmt("f64: 0.10000", "f64: {d:.5}", .{@as(f64, @bitCast(f32, @as(u32, 1036831278)))});1376 try testFmt("f64: 0.10000", "f64: {d:.5}", .{@as(f64, @bitCast(f32, @as(u32, 1036831278)))});
lib/std/fmt/parse_float.zig-4
...@@ -382,10 +382,6 @@ pub fn parseFloat(comptime T: type, s: []const u8) !T {...@@ -382,10 +382,6 @@ pub fn parseFloat(comptime T: type, s: []const u8) !T {
382}382}
383383
384test "fmt.parseFloat" {384test "fmt.parseFloat" {
385 if (@import("builtin").arch == .arm) {
386 // TODO https://github.com/ziglang/zig/issues/3289
387 return error.SkipZigTest;
388 }
389 const testing = std.testing;385 const testing = std.testing;
390 const expect = testing.expect;386 const expect = testing.expect;
391 const expectEqual = testing.expectEqual;387 const expectEqual = testing.expectEqual;
lib/std/math/big/rational.zig-8
...@@ -742,10 +742,6 @@ test "big.rational setFloatString" {...@@ -742,10 +742,6 @@ test "big.rational setFloatString" {
742}742}
743743
744test "big.rational toFloat" {744test "big.rational toFloat" {
745 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
746 // TODO https://github.com/ziglang/zig/issues/3289
747 return error.SkipZigTest;
748 }
749 var a = try Rational.init(al);745 var a = try Rational.init(al);
750746
751 // = 3.14159297943115234375747 // = 3.14159297943115234375
...@@ -758,10 +754,6 @@ test "big.rational toFloat" {...@@ -758,10 +754,6 @@ test "big.rational toFloat" {
758}754}
759755
760test "big.rational set/to Float round-trip" {756test "big.rational set/to Float round-trip" {
761 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
762 // TODO https://github.com/ziglang/zig/issues/3289
763 return error.SkipZigTest;
764 }
765 var a = try Rational.init(al);757 var a = try Rational.init(al);
766 var prng = std.rand.DefaultPrng.init(0x5EED);758 var prng = std.rand.DefaultPrng.init(0x5EED);
767 var i: usize = 0;759 var i: usize = 0;
lib/std/math/complex/atan.zig-4
...@@ -130,10 +130,6 @@ test "complex.catan32" {...@@ -130,10 +130,6 @@ test "complex.catan32" {
130}130}
131131
132test "complex.catan64" {132test "complex.catan64" {
133 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
134 // TODO https://github.com/ziglang/zig/issues/3289
135 return error.SkipZigTest;
136 }
137 const a = Complex(f64).new(5, 3);133 const a = Complex(f64).new(5, 3);
138 const c = atan(a);134 const c = atan(a);
139135
lib/std/math/complex/cosh.zig-4
...@@ -165,10 +165,6 @@ test "complex.ccosh32" {...@@ -165,10 +165,6 @@ test "complex.ccosh32" {
165}165}
166166
167test "complex.ccosh64" {167test "complex.ccosh64" {
168 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
169 // TODO https://github.com/ziglang/zig/issues/3289
170 return error.SkipZigTest;
171 }
172 const a = Complex(f64).new(5, 3);168 const a = Complex(f64).new(5, 3);
173 const c = cosh(a);169 const c = cosh(a);
174170
lib/std/math/complex/exp.zig-4
...@@ -131,10 +131,6 @@ test "complex.cexp32" {...@@ -131,10 +131,6 @@ test "complex.cexp32" {
131}131}
132132
133test "complex.cexp64" {133test "complex.cexp64" {
134 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
135 // TODO https://github.com/ziglang/zig/issues/3289
136 return error.SkipZigTest;
137 }
138 const a = Complex(f64).new(5, 3);134 const a = Complex(f64).new(5, 3);
139 const c = exp(a);135 const c = exp(a);
140136
lib/std/math/complex/sinh.zig-4
...@@ -164,10 +164,6 @@ test "complex.csinh32" {...@@ -164,10 +164,6 @@ test "complex.csinh32" {
164}164}
165165
166test "complex.csinh64" {166test "complex.csinh64" {
167 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
168 // TODO https://github.com/ziglang/zig/issues/3289
169 return error.SkipZigTest;
170 }
171 const a = Complex(f64).new(5, 3);167 const a = Complex(f64).new(5, 3);
172 const c = sinh(a);168 const c = sinh(a);
173169
lib/std/math/complex/tanh.zig-4
...@@ -113,10 +113,6 @@ test "complex.ctanh32" {...@@ -113,10 +113,6 @@ test "complex.ctanh32" {
113}113}
114114
115test "complex.ctanh64" {115test "complex.ctanh64" {
116 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
117 // TODO https://github.com/ziglang/zig/issues/3289
118 return error.SkipZigTest;
119 }
120 const a = Complex(f64).new(5, 3);116 const a = Complex(f64).new(5, 3);
121 const c = tanh(a);117 const c = tanh(a);
122118
lib/std/math/cos.zig-4
...@@ -100,10 +100,6 @@ test "math.cos32" {...@@ -100,10 +100,6 @@ test "math.cos32" {
100}100}
101101
102test "math.cos64" {102test "math.cos64" {
103 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
104 // TODO https://github.com/ziglang/zig/issues/3289
105 return error.SkipZigTest;
106 }
107 const epsilon = 0.000001;103 const epsilon = 0.000001;
108104
109 expect(math.approxEq(f64, cos_(f64, 0.0), 1.0, epsilon));105 expect(math.approxEq(f64, cos_(f64, 0.0), 1.0, epsilon));
lib/std/math/pow.zig-12
...@@ -184,10 +184,6 @@ fn isOddInteger(x: f64) bool {...@@ -184,10 +184,6 @@ fn isOddInteger(x: f64) bool {
184}184}
185185
186test "math.pow" {186test "math.pow" {
187 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
188 // TODO https://github.com/ziglang/zig/issues/3289
189 return error.SkipZigTest;
190 }
191 const epsilon = 0.000001;187 const epsilon = 0.000001;
192188
193 expect(math.approxEq(f32, pow(f32, 0.0, 3.3), 0.0, epsilon));189 expect(math.approxEq(f32, pow(f32, 0.0, 3.3), 0.0, epsilon));
...@@ -206,10 +202,6 @@ test "math.pow" {...@@ -206,10 +202,6 @@ test "math.pow" {
206}202}
207203
208test "math.pow.special" {204test "math.pow.special" {
209 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
210 // TODO https://github.com/ziglang/zig/issues/3289
211 return error.SkipZigTest;
212 }
213 const epsilon = 0.000001;205 const epsilon = 0.000001;
214206
215 expect(pow(f32, 4, 0.0) == 1.0);207 expect(pow(f32, 4, 0.0) == 1.0);
...@@ -252,10 +244,6 @@ test "math.pow.special" {...@@ -252,10 +244,6 @@ test "math.pow.special" {
252}244}
253245
254test "math.pow.overflow" {246test "math.pow.overflow" {
255 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
256 // TODO https://github.com/ziglang/zig/issues/3289
257 return error.SkipZigTest;
258 }
259 expect(math.isPositiveInf(pow(f64, 2, 1 << 32)));247 expect(math.isPositiveInf(pow(f64, 2, 1 << 32)));
260 expect(pow(f64, 2, -(1 << 32)) == 0);248 expect(pow(f64, 2, -(1 << 32)) == 0);
261 expect(math.isNegativeInf(pow(f64, -2, (1 << 32) + 1)));249 expect(math.isNegativeInf(pow(f64, -2, (1 << 32) + 1)));
lib/std/math/sin.zig-20
...@@ -84,20 +84,12 @@ fn sin_(comptime T: type, x_: T) T {...@@ -84,20 +84,12 @@ fn sin_(comptime T: type, x_: T) T {
84}84}
8585
86test "math.sin" {86test "math.sin" {
87 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
88 // TODO https://github.com/ziglang/zig/issues/3289
89 return error.SkipZigTest;
90 }
91 expect(sin(@as(f32, 0.0)) == sin_(f32, 0.0));87 expect(sin(@as(f32, 0.0)) == sin_(f32, 0.0));
92 expect(sin(@as(f64, 0.0)) == sin_(f64, 0.0));88 expect(sin(@as(f64, 0.0)) == sin_(f64, 0.0));
93 expect(comptime (math.sin(@as(f64, 2))) == math.sin(@as(f64, 2)));89 expect(comptime (math.sin(@as(f64, 2))) == math.sin(@as(f64, 2)));
94}90}
9591
96test "math.sin32" {92test "math.sin32" {
97 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
98 // TODO https://github.com/ziglang/zig/issues/3289
99 return error.SkipZigTest;
100 }
101 const epsilon = 0.000001;93 const epsilon = 0.000001;
10294
103 expect(math.approxEq(f32, sin_(f32, 0.0), 0.0, epsilon));95 expect(math.approxEq(f32, sin_(f32, 0.0), 0.0, epsilon));
...@@ -110,10 +102,6 @@ test "math.sin32" {...@@ -110,10 +102,6 @@ test "math.sin32" {
110}102}
111103
112test "math.sin64" {104test "math.sin64" {
113 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
114 // TODO https://github.com/ziglang/zig/issues/3289
115 return error.SkipZigTest;
116 }
117 const epsilon = 0.000001;105 const epsilon = 0.000001;
118106
119 expect(math.approxEq(f64, sin_(f64, 0.0), 0.0, epsilon));107 expect(math.approxEq(f64, sin_(f64, 0.0), 0.0, epsilon));
...@@ -126,10 +114,6 @@ test "math.sin64" {...@@ -126,10 +114,6 @@ test "math.sin64" {
126}114}
127115
128test "math.sin32.special" {116test "math.sin32.special" {
129 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
130 // TODO https://github.com/ziglang/zig/issues/3289
131 return error.SkipZigTest;
132 }
133 expect(sin_(f32, 0.0) == 0.0);117 expect(sin_(f32, 0.0) == 0.0);
134 expect(sin_(f32, -0.0) == -0.0);118 expect(sin_(f32, -0.0) == -0.0);
135 expect(math.isNan(sin_(f32, math.inf(f32))));119 expect(math.isNan(sin_(f32, math.inf(f32))));
...@@ -138,10 +122,6 @@ test "math.sin32.special" {...@@ -138,10 +122,6 @@ test "math.sin32.special" {
138}122}
139123
140test "math.sin64.special" {124test "math.sin64.special" {
141 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
142 // TODO https://github.com/ziglang/zig/issues/3289
143 return error.SkipZigTest;
144 }
145 expect(sin_(f64, 0.0) == 0.0);125 expect(sin_(f64, 0.0) == 0.0);
146 expect(sin_(f64, -0.0) == -0.0);126 expect(sin_(f64, -0.0) == -0.0);
147 expect(math.isNan(sin_(f64, math.inf(f64))));127 expect(math.isNan(sin_(f64, math.inf(f64))));
lib/std/math/tan.zig-4
...@@ -91,10 +91,6 @@ test "math.tan32" {...@@ -91,10 +91,6 @@ test "math.tan32" {
91}91}
9292
93test "math.tan64" {93test "math.tan64" {
94 if (builtin.os == .linux and builtin.arch == .arm and builtin.abi == .musleabihf) {
95 // TODO https://github.com/ziglang/zig/issues/3289
96 return error.SkipZigTest;
97 }
98 const epsilon = 0.000001;94 const epsilon = 0.000001;
9995
100 expect(math.approxEq(f64, tan_(f64, 0.0), 0.0, epsilon));96 expect(math.approxEq(f64, tan_(f64, 0.0), 0.0, epsilon));
lib/std/special/compiler_rt.zig+32-32
...@@ -181,62 +181,62 @@ comptime {...@@ -181,62 +181,62 @@ comptime {
181 @export("__aeabi_memcmp4", __aeabi_memcmp, linkage);181 @export("__aeabi_memcmp4", __aeabi_memcmp, linkage);
182 @export("__aeabi_memcmp8", __aeabi_memcmp, linkage);182 @export("__aeabi_memcmp8", __aeabi_memcmp, linkage);
183183
184 @export("__aeabi_f2d", @import("compiler_rt/extendXfYf2.zig").__extendsfdf2, linkage);184 @export("__aeabi_f2d", @import("compiler_rt/extendXfYf2.zig").__aeabi_f2d, linkage);
185 @export("__aeabi_i2d", @import("compiler_rt/floatsiXf.zig").__floatsidf, linkage);185 @export("__aeabi_i2d", @import("compiler_rt/floatsiXf.zig").__aeabi_i2d, linkage);
186 @export("__aeabi_l2d", @import("compiler_rt/floatdidf.zig").__floatdidf, linkage);186 @export("__aeabi_l2d", @import("compiler_rt/floatdidf.zig").__aeabi_l2d, linkage);
187 @export("__aeabi_ui2d", @import("compiler_rt/floatunsidf.zig").__floatunsidf, linkage);187 @export("__aeabi_ui2d", @import("compiler_rt/floatunsidf.zig").__aeabi_ui2d, linkage);
188 @export("__aeabi_ul2d", @import("compiler_rt/floatundidf.zig").__floatundidf, linkage);188 @export("__aeabi_ul2d", @import("compiler_rt/floatundidf.zig").__aeabi_ul2d, linkage);
189 @export("__aeabi_ui2f", @import("compiler_rt/floatunsisf.zig").__floatunsisf, linkage);189 @export("__aeabi_ui2f", @import("compiler_rt/floatunsisf.zig").__aeabi_ui2f, linkage);
190 @export("__aeabi_ul2f", @import("compiler_rt/floatundisf.zig").__floatundisf, linkage);190 @export("__aeabi_ul2f", @import("compiler_rt/floatundisf.zig").__aeabi_ul2f, linkage);
191191
192 @export("__aeabi_fneg", @import("compiler_rt/negXf2.zig").__negsf2, linkage);192 @export("__aeabi_fneg", @import("compiler_rt/negXf2.zig").__aeabi_fneg, linkage);
193 @export("__aeabi_dneg", @import("compiler_rt/negXf2.zig").__negdf2, linkage);193 @export("__aeabi_dneg", @import("compiler_rt/negXf2.zig").__aeabi_dneg, linkage);
194194
195 @export("__aeabi_fmul", @import("compiler_rt/mulXf3.zig").__mulsf3, linkage);195 @export("__aeabi_fmul", @import("compiler_rt/mulXf3.zig").__aeabi_fmul, linkage);
196 @export("__aeabi_dmul", @import("compiler_rt/mulXf3.zig").__muldf3, linkage);196 @export("__aeabi_dmul", @import("compiler_rt/mulXf3.zig").__aeabi_dmul, linkage);
197197
198 @export("__aeabi_d2h", @import("compiler_rt/truncXfYf2.zig").__truncdfhf2, linkage);198 @export("__aeabi_d2h", @import("compiler_rt/truncXfYf2.zig").__aeabi_d2h, linkage);
199199
200 @export("__aeabi_f2ulz", @import("compiler_rt/fixunssfdi.zig").__fixunssfdi, linkage);200 @export("__aeabi_f2ulz", @import("compiler_rt/fixunssfdi.zig").__aeabi_f2ulz, linkage);
201 @export("__aeabi_d2ulz", @import("compiler_rt/fixunsdfdi.zig").__fixunsdfdi, linkage);201 @export("__aeabi_d2ulz", @import("compiler_rt/fixunsdfdi.zig").__aeabi_d2ulz, linkage);
202202
203 @export("__aeabi_f2lz", @import("compiler_rt/fixsfdi.zig").__fixsfdi, linkage);203 @export("__aeabi_f2lz", @import("compiler_rt/fixsfdi.zig").__aeabi_f2lz, linkage);
204 @export("__aeabi_d2lz", @import("compiler_rt/fixdfdi.zig").__fixdfdi, linkage);204 @export("__aeabi_d2lz", @import("compiler_rt/fixdfdi.zig").__aeabi_d2lz, linkage);
205205
206 @export("__aeabi_d2uiz", @import("compiler_rt/fixunsdfsi.zig").__fixunsdfsi, linkage);206 @export("__aeabi_d2uiz", @import("compiler_rt/fixunsdfsi.zig").__aeabi_d2uiz, linkage);
207207
208 @export("__aeabi_h2f", @import("compiler_rt/extendXfYf2.zig").__extendhfsf2, linkage);208 @export("__aeabi_h2f", @import("compiler_rt/extendXfYf2.zig").__aeabi_h2f, linkage);
209 @export("__aeabi_f2h", @import("compiler_rt/truncXfYf2.zig").__truncsfhf2, linkage);209 @export("__aeabi_f2h", @import("compiler_rt/truncXfYf2.zig").__aeabi_f2h, linkage);
210210
211 @export("__aeabi_i2f", @import("compiler_rt/floatsiXf.zig").__floatsisf, linkage);211 @export("__aeabi_i2f", @import("compiler_rt/floatsiXf.zig").__aeabi_i2f, linkage);
212 @export("__aeabi_d2f", @import("compiler_rt/truncXfYf2.zig").__truncdfsf2, linkage);212 @export("__aeabi_d2f", @import("compiler_rt/truncXfYf2.zig").__aeabi_d2f, linkage);
213213
214 @export("__aeabi_fadd", @import("compiler_rt/addXf3.zig").__addsf3, linkage);214 @export("__aeabi_fadd", @import("compiler_rt/addXf3.zig").__aeabi_fadd, linkage);
215 @export("__aeabi_dadd", @import("compiler_rt/addXf3.zig").__adddf3, linkage);215 @export("__aeabi_dadd", @import("compiler_rt/addXf3.zig").__aeabi_dadd, linkage);
216 @export("__aeabi_fsub", @import("compiler_rt/addXf3.zig").__subsf3, linkage);216 @export("__aeabi_fsub", @import("compiler_rt/addXf3.zig").__aeabi_fsub, linkage);
217 @export("__aeabi_dsub", @import("compiler_rt/addXf3.zig").__subdf3, linkage);217 @export("__aeabi_dsub", @import("compiler_rt/addXf3.zig").__aeabi_dsub, linkage);
218218
219 @export("__aeabi_f2uiz", @import("compiler_rt/fixunssfsi.zig").__fixunssfsi, linkage);219 @export("__aeabi_f2uiz", @import("compiler_rt/fixunssfsi.zig").__aeabi_f2uiz, linkage);
220220
221 @export("__aeabi_f2iz", @import("compiler_rt/fixsfsi.zig").__fixsfsi, linkage);221 @export("__aeabi_f2iz", @import("compiler_rt/fixsfsi.zig").__aeabi_f2iz, linkage);
222 @export("__aeabi_d2iz", @import("compiler_rt/fixdfsi.zig").__fixdfsi, linkage);222 @export("__aeabi_d2iz", @import("compiler_rt/fixdfsi.zig").__aeabi_d2iz, linkage);
223223
224 @export("__aeabi_fdiv", @import("compiler_rt/divsf3.zig").__divsf3, linkage);224 @export("__aeabi_fdiv", @import("compiler_rt/divsf3.zig").__aeabi_fdiv, linkage);
225 @export("__aeabi_ddiv", @import("compiler_rt/divdf3.zig").__divdf3, linkage);225 @export("__aeabi_ddiv", @import("compiler_rt/divdf3.zig").__aeabi_ddiv, linkage);
226226
227 @export("__aeabi_fcmpeq", @import("compiler_rt/arm/aeabi_fcmp.zig").__aeabi_fcmpeq, linkage);227 @export("__aeabi_fcmpeq", @import("compiler_rt/arm/aeabi_fcmp.zig").__aeabi_fcmpeq, linkage);
228 @export("__aeabi_fcmplt", @import("compiler_rt/arm/aeabi_fcmp.zig").__aeabi_fcmplt, linkage);228 @export("__aeabi_fcmplt", @import("compiler_rt/arm/aeabi_fcmp.zig").__aeabi_fcmplt, linkage);
229 @export("__aeabi_fcmple", @import("compiler_rt/arm/aeabi_fcmp.zig").__aeabi_fcmple, linkage);229 @export("__aeabi_fcmple", @import("compiler_rt/arm/aeabi_fcmp.zig").__aeabi_fcmple, linkage);
230 @export("__aeabi_fcmpge", @import("compiler_rt/arm/aeabi_fcmp.zig").__aeabi_fcmpge, linkage);230 @export("__aeabi_fcmpge", @import("compiler_rt/arm/aeabi_fcmp.zig").__aeabi_fcmpge, linkage);
231 @export("__aeabi_fcmpgt", @import("compiler_rt/arm/aeabi_fcmp.zig").__aeabi_fcmpgt, linkage);231 @export("__aeabi_fcmpgt", @import("compiler_rt/arm/aeabi_fcmp.zig").__aeabi_fcmpgt, linkage);
232 @export("__aeabi_fcmpun", @import("compiler_rt/comparesf2.zig").__unordsf2, linkage);232 @export("__aeabi_fcmpun", @import("compiler_rt/comparesf2.zig").__aeabi_fcmpun, linkage);
233233
234 @export("__aeabi_dcmpeq", @import("compiler_rt/arm/aeabi_dcmp.zig").__aeabi_dcmpeq, linkage);234 @export("__aeabi_dcmpeq", @import("compiler_rt/arm/aeabi_dcmp.zig").__aeabi_dcmpeq, linkage);
235 @export("__aeabi_dcmplt", @import("compiler_rt/arm/aeabi_dcmp.zig").__aeabi_dcmplt, linkage);235 @export("__aeabi_dcmplt", @import("compiler_rt/arm/aeabi_dcmp.zig").__aeabi_dcmplt, linkage);
236 @export("__aeabi_dcmple", @import("compiler_rt/arm/aeabi_dcmp.zig").__aeabi_dcmple, linkage);236 @export("__aeabi_dcmple", @import("compiler_rt/arm/aeabi_dcmp.zig").__aeabi_dcmple, linkage);
237 @export("__aeabi_dcmpge", @import("compiler_rt/arm/aeabi_dcmp.zig").__aeabi_dcmpge, linkage);237 @export("__aeabi_dcmpge", @import("compiler_rt/arm/aeabi_dcmp.zig").__aeabi_dcmpge, linkage);
238 @export("__aeabi_dcmpgt", @import("compiler_rt/arm/aeabi_dcmp.zig").__aeabi_dcmpgt, linkage);238 @export("__aeabi_dcmpgt", @import("compiler_rt/arm/aeabi_dcmp.zig").__aeabi_dcmpgt, linkage);
239 @export("__aeabi_dcmpun", @import("compiler_rt/comparedf2.zig").__unorddf2, linkage);239 @export("__aeabi_dcmpun", @import("compiler_rt/comparedf2.zig").__aeabi_dcmpun, linkage);
240 }240 }
241 if (builtin.os == .windows) {241 if (builtin.os == .windows) {
242 // Default stack-probe functions emitted by LLVM242 // Default stack-probe functions emitted by LLVM
lib/std/special/compiler_rt/addXf3.zig+20
...@@ -33,6 +33,26 @@ pub fn __subtf3(a: f128, b: f128) callconv(.C) f128 {...@@ -33,6 +33,26 @@ pub fn __subtf3(a: f128, b: f128) callconv(.C) f128 {
33 return addXf3(f128, a, neg_b);33 return addXf3(f128, a, neg_b);
34}34}
3535
36pub fn __aeabi_fadd(a: f32, b: f32) callconv(.AAPCS) f32 {
37 @setRuntimeSafety(false);
38 return @call(.{ .modifier = .always_inline }, __addsf3, .{ a, b });
39}
40
41pub fn __aeabi_dadd(a: f64, b: f64) callconv(.AAPCS) f64 {
42 @setRuntimeSafety(false);
43 return @call(.{ .modifier = .always_inline }, __adddf3, .{ a, b });
44}
45
46pub fn __aeabi_fsub(a: f32, b: f32) callconv(.AAPCS) f32 {
47 @setRuntimeSafety(false);
48 return @call(.{ .modifier = .always_inline }, __subsf3, .{ a, b });
49}
50
51pub fn __aeabi_dsub(a: f64, b: f64) callconv(.AAPCS) f64 {
52 @setRuntimeSafety(false);
53 return @call(.{ .modifier = .always_inline }, __subdf3, .{ a, b });
54}
55
36// TODO: restore inline keyword, see: https://github.com/ziglang/zig/issues/215456// TODO: restore inline keyword, see: https://github.com/ziglang/zig/issues/2154
37fn normalize(comptime T: type, significand: *@IntType(false, T.bit_count)) i32 {57fn normalize(comptime T: type, significand: *@IntType(false, T.bit_count)) i32 {
38 const Z = @IntType(false, T.bit_count);58 const Z = @IntType(false, T.bit_count);
lib/std/special/compiler_rt/arm/aeabi_dcmp.zig-13
...@@ -2,8 +2,6 @@...@@ -2,8 +2,6 @@
2//2//
3// https://github.com/llvm/llvm-project/commit/d674d96bc56c0f377879d01c9d8dfdaaa7859cdb/compiler-rt/lib/builtins/arm/aeabi_dcmp.S3// https://github.com/llvm/llvm-project/commit/d674d96bc56c0f377879d01c9d8dfdaaa7859cdb/compiler-rt/lib/builtins/arm/aeabi_dcmp.S
44
5const compiler_rt_armhf_target = false; // TODO
6
7const ConditionalOperator = enum {5const ConditionalOperator = enum {
8 Eq,6 Eq,
9 Lt,7 Lt,
...@@ -42,23 +40,12 @@ pub fn __aeabi_dcmpgt() callconv(.Naked) noreturn {...@@ -42,23 +40,12 @@ pub fn __aeabi_dcmpgt() callconv(.Naked) noreturn {
42 unreachable;40 unreachable;
43}41}
4442
45inline fn convert_dcmp_args_to_df2_args() void {
46 asm volatile (
47 \\ vmov d0, r0, r1
48 \\ vmov d1, r2, r3
49 );
50}
51
52fn aeabi_dcmp(comptime cond: ConditionalOperator) void {43fn aeabi_dcmp(comptime cond: ConditionalOperator) void {
53 @setRuntimeSafety(false);44 @setRuntimeSafety(false);
54 asm volatile (45 asm volatile (
55 \\ push { r4, lr }46 \\ push { r4, lr }
56 );47 );
5748
58 if (compiler_rt_armhf_target) {
59 convert_dcmp_args_to_df2_args();
60 }
61
62 switch (cond) {49 switch (cond) {
63 .Eq => asm volatile (50 .Eq => asm volatile (
64 \\ bl __eqdf251 \\ bl __eqdf2
lib/std/special/compiler_rt/arm/aeabi_fcmp.zig-13
...@@ -2,8 +2,6 @@...@@ -2,8 +2,6 @@
2//2//
3// https://github.com/llvm/llvm-project/commit/d674d96bc56c0f377879d01c9d8dfdaaa7859cdb/compiler-rt/lib/builtins/arm/aeabi_fcmp.S3// https://github.com/llvm/llvm-project/commit/d674d96bc56c0f377879d01c9d8dfdaaa7859cdb/compiler-rt/lib/builtins/arm/aeabi_fcmp.S
44
5const compiler_rt_armhf_target = false; // TODO
6
7const ConditionalOperator = enum {5const ConditionalOperator = enum {
8 Eq,6 Eq,
9 Lt,7 Lt,
...@@ -42,23 +40,12 @@ pub fn __aeabi_fcmpgt() callconv(.Naked) noreturn {...@@ -42,23 +40,12 @@ pub fn __aeabi_fcmpgt() callconv(.Naked) noreturn {
42 unreachable;40 unreachable;
43}41}
4442
45inline fn convert_fcmp_args_to_sf2_args() void {
46 asm volatile (
47 \\ vmov s0, r0
48 \\ vmov s1, r1
49 );
50}
51
52fn aeabi_fcmp(comptime cond: ConditionalOperator) void {43fn aeabi_fcmp(comptime cond: ConditionalOperator) void {
53 @setRuntimeSafety(false);44 @setRuntimeSafety(false);
54 asm volatile (45 asm volatile (
55 \\ push { r4, lr }46 \\ push { r4, lr }
56 );47 );
5748
58 if (compiler_rt_armhf_target) {
59 convert_fcmp_args_to_sf2_args();
60 }
61
62 switch (cond) {49 switch (cond) {
63 .Eq => asm volatile (50 .Eq => asm volatile (
64 \\ bl __eqsf251 \\ bl __eqsf2
lib/std/special/compiler_rt/comparedf2.zig+5
...@@ -117,6 +117,11 @@ pub fn __gtdf2(a: fp_t, b: fp_t) callconv(.C) c_int {...@@ -117,6 +117,11 @@ pub fn __gtdf2(a: fp_t, b: fp_t) callconv(.C) c_int {
117 return __gedf2(a, b);117 return __gedf2(a, b);
118}118}
119119
120pub fn __aeabi_dcmpun(a: fp_t, b: fp_t) callconv(.AAPCS) c_int {
121 @setRuntimeSafety(false);
122 return @call(.{ .modifier = .always_inline }, __unorddf2, .{ a, b });
123}
124
120test "import comparedf2" {125test "import comparedf2" {
121 _ = @import("comparedf2_test.zig");126 _ = @import("comparedf2_test.zig");
122}127}
lib/std/special/compiler_rt/comparesf2.zig+5
...@@ -117,6 +117,11 @@ pub fn __gtsf2(a: fp_t, b: fp_t) callconv(.C) c_int {...@@ -117,6 +117,11 @@ pub fn __gtsf2(a: fp_t, b: fp_t) callconv(.C) c_int {
117 return __gesf2(a, b);117 return __gesf2(a, b);
118}118}
119119
120pub fn __aeabi_fcmpun(a: fp_t, b: fp_t) callconv(.AAPCS) c_int {
121 @setRuntimeSafety(false);
122 return @call(.{ .modifier = .always_inline }, __unordsf2, .{ a, b });
123}
124
120test "import comparesf2" {125test "import comparesf2" {
121 _ = @import("comparesf2_test.zig");126 _ = @import("comparesf2_test.zig");
122}127}
lib/std/special/compiler_rt/divdf3.zig+5
...@@ -323,6 +323,11 @@ fn normalize(comptime T: type, significand: *@IntType(false, T.bit_count)) i32 {...@@ -323,6 +323,11 @@ fn normalize(comptime T: type, significand: *@IntType(false, T.bit_count)) i32 {
323 return 1 - shift;323 return 1 - shift;
324}324}
325325
326pub fn __aeabi_ddiv(a: f64, b: f64) callconv(.AAPCS) f64 {
327 @setRuntimeSafety(false);
328 return @call(.{ .modifier = .always_inline }, __divdf3, .{ a, b });
329}
330
326test "import divdf3" {331test "import divdf3" {
327 _ = @import("divdf3_test.zig");332 _ = @import("divdf3_test.zig");
328}333}
lib/std/special/compiler_rt/divsf3.zig+5
...@@ -196,6 +196,11 @@ fn normalize(comptime T: type, significand: *@IntType(false, T.bit_count)) i32 {...@@ -196,6 +196,11 @@ fn normalize(comptime T: type, significand: *@IntType(false, T.bit_count)) i32 {
196 return 1 - shift;196 return 1 - shift;
197}197}
198198
199pub fn __aeabi_fdiv(a: f32, b: f32) callconv(.AAPCS) f32 {
200 @setRuntimeSafety(false);
201 return @call(.{ .modifier = .always_inline }, __divsf3, .{ a, b });
202}
203
199test "import divsf3" {204test "import divsf3" {
200 _ = @import("divsf3_test.zig");205 _ = @import("divsf3_test.zig");
201}206}
lib/std/special/compiler_rt/extendXfYf2.zig+10
...@@ -18,6 +18,16 @@ pub fn __extendhfsf2(a: u16) callconv(.C) f32 {...@@ -18,6 +18,16 @@ pub fn __extendhfsf2(a: u16) callconv(.C) f32 {
18 return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f32, f16, a });18 return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f32, f16, a });
19}19}
2020
21pub fn __aeabi_h2f(arg: u16) callconv(.AAPCS) f32 {
22 @setRuntimeSafety(false);
23 return @call(.{ .modifier = .always_inline }, __extendhfsf2, .{arg});
24}
25
26pub fn __aeabi_f2d(arg: f32) callconv(.AAPCS) f64 {
27 @setRuntimeSafety(false);
28 return @call(.{ .modifier = .always_inline }, __extendsfdf2, .{arg});
29}
30
21const CHAR_BIT = 8;31const CHAR_BIT = 8;
2232
23fn extendXfYf2(comptime dst_t: type, comptime src_t: type, a: @IntType(false, @typeInfo(src_t).Float.bits)) dst_t {33fn extendXfYf2(comptime dst_t: type, comptime src_t: type, a: @IntType(false, @typeInfo(src_t).Float.bits)) dst_t {
lib/std/special/compiler_rt/fixdfdi.zig+5
...@@ -6,6 +6,11 @@ pub fn __fixdfdi(a: f64) callconv(.C) i64 {...@@ -6,6 +6,11 @@ pub fn __fixdfdi(a: f64) callconv(.C) i64 {
6 return fixint(f64, i64, a);6 return fixint(f64, i64, a);
7}7}
88
9pub fn __aeabi_d2lz(arg: f64) callconv(.AAPCS) i64 {
10 @setRuntimeSafety(false);
11 return @call(.{ .modifier = .always_inline }, __fixdfdi, .{arg});
12}
13
9test "import fixdfdi" {14test "import fixdfdi" {
10 _ = @import("fixdfdi_test.zig");15 _ = @import("fixdfdi_test.zig");
11}16}
lib/std/special/compiler_rt/fixdfsi.zig+5
...@@ -6,6 +6,11 @@ pub fn __fixdfsi(a: f64) callconv(.C) i32 {...@@ -6,6 +6,11 @@ pub fn __fixdfsi(a: f64) callconv(.C) i32 {
6 return fixint(f64, i32, a);6 return fixint(f64, i32, a);
7}7}
88
9pub fn __aeabi_d2iz(a: f64) callconv(.AAPCS) i32 {
10 @setRuntimeSafety(false);
11 return @call(.{ .modifier = .always_inline }, __fixdfsi, .{a});
12}
13
9test "import fixdfsi" {14test "import fixdfsi" {
10 _ = @import("fixdfsi_test.zig");15 _ = @import("fixdfsi_test.zig");
11}16}
lib/std/special/compiler_rt/fixsfdi.zig+5
...@@ -6,6 +6,11 @@ pub fn __fixsfdi(a: f32) callconv(.C) i64 {...@@ -6,6 +6,11 @@ pub fn __fixsfdi(a: f32) callconv(.C) i64 {
6 return fixint(f32, i64, a);6 return fixint(f32, i64, a);
7}7}
88
9pub fn __aeabi_f2lz(arg: f32) callconv(.AAPCS) i64 {
10 @setRuntimeSafety(false);
11 return @call(.{ .modifier = .always_inline }, __fixsfdi, .{arg});
12}
13
9test "import fixsfdi" {14test "import fixsfdi" {
10 _ = @import("fixsfdi_test.zig");15 _ = @import("fixsfdi_test.zig");
11}16}
lib/std/special/compiler_rt/fixsfsi.zig+5
...@@ -6,6 +6,11 @@ pub fn __fixsfsi(a: f32) callconv(.C) i32 {...@@ -6,6 +6,11 @@ pub fn __fixsfsi(a: f32) callconv(.C) i32 {
6 return fixint(f32, i32, a);6 return fixint(f32, i32, a);
7}7}
88
9pub fn __aeabi_f2iz(a: f32) callconv(.AAPCS) i32 {
10 @setRuntimeSafety(false);
11 return @call(.{ .modifier = .always_inline }, __fixsfsi, .{a});
12}
13
9test "import fixsfsi" {14test "import fixsfsi" {
10 _ = @import("fixsfsi_test.zig");15 _ = @import("fixsfsi_test.zig");
11}16}
lib/std/special/compiler_rt/fixunsdfdi.zig+5
...@@ -6,6 +6,11 @@ pub fn __fixunsdfdi(a: f64) callconv(.C) u64 {...@@ -6,6 +6,11 @@ pub fn __fixunsdfdi(a: f64) callconv(.C) u64 {
6 return fixuint(f64, u64, a);6 return fixuint(f64, u64, a);
7}7}
88
9pub fn __aeabi_d2ulz(a: f64) callconv(.AAPCS) u64 {
10 @setRuntimeSafety(false);
11 return @call(.{ .modifier = .always_inline }, __fixunsdfdi, .{a});
12}
13
9test "import fixunsdfdi" {14test "import fixunsdfdi" {
10 _ = @import("fixunsdfdi_test.zig");15 _ = @import("fixunsdfdi_test.zig");
11}16}
lib/std/special/compiler_rt/fixunsdfsi.zig+5
...@@ -6,6 +6,11 @@ pub fn __fixunsdfsi(a: f64) callconv(.C) u32 {...@@ -6,6 +6,11 @@ pub fn __fixunsdfsi(a: f64) callconv(.C) u32 {
6 return fixuint(f64, u32, a);6 return fixuint(f64, u32, a);
7}7}
88
9pub fn __aeabi_d2uiz(arg: f64) callconv(.AAPCS) u32 {
10 @setRuntimeSafety(false);
11 return @call(.{ .modifier = .always_inline }, __fixunsdfsi, .{arg});
12}
13
9test "import fixunsdfsi" {14test "import fixunsdfsi" {
10 _ = @import("fixunsdfsi_test.zig");15 _ = @import("fixunsdfsi_test.zig");
11}16}
lib/std/special/compiler_rt/fixunssfdi.zig+5
...@@ -6,6 +6,11 @@ pub fn __fixunssfdi(a: f32) callconv(.C) u64 {...@@ -6,6 +6,11 @@ pub fn __fixunssfdi(a: f32) callconv(.C) u64 {
6 return fixuint(f32, u64, a);6 return fixuint(f32, u64, a);
7}7}
88
9pub fn __aeabi_f2ulz(a: f32) callconv(.AAPCS) u64 {
10 @setRuntimeSafety(false);
11 return @call(.{ .modifier = .always_inline }, __fixunssfdi, .{a});
12}
13
9test "import fixunssfdi" {14test "import fixunssfdi" {
10 _ = @import("fixunssfdi_test.zig");15 _ = @import("fixunssfdi_test.zig");
11}16}
lib/std/special/compiler_rt/fixunssfsi.zig+5
...@@ -6,6 +6,11 @@ pub fn __fixunssfsi(a: f32) callconv(.C) u32 {...@@ -6,6 +6,11 @@ pub fn __fixunssfsi(a: f32) callconv(.C) u32 {
6 return fixuint(f32, u32, a);6 return fixuint(f32, u32, a);
7}7}
88
9pub fn __aeabi_f2uiz(a: f32) callconv(.AAPCS) u32 {
10 @setRuntimeSafety(false);
11 return @call(.{ .modifier = .always_inline }, __fixunssfsi, .{a});
12}
13
9test "import fixunssfsi" {14test "import fixunssfsi" {
10 _ = @import("fixunssfsi_test.zig");15 _ = @import("fixunssfsi_test.zig");
11}16}
lib/std/special/compiler_rt/floatdidf.zig+5
...@@ -17,6 +17,11 @@ pub fn __floatdidf(a: i64) callconv(.C) f64 {...@@ -17,6 +17,11 @@ pub fn __floatdidf(a: i64) callconv(.C) f64 {
17 return (high - twop52) + @bitCast(f64, low);17 return (high - twop52) + @bitCast(f64, low);
18}18}
1919
20pub fn __aeabi_l2d(arg: i64) callconv(.AAPCS) f64 {
21 @setRuntimeSafety(false);
22 return @call(.{ .modifier = .always_inline }, __floatdidf, .{arg});
23}
24
20test "import floatdidf" {25test "import floatdidf" {
21 _ = @import("floatdidf_test.zig");26 _ = @import("floatdidf_test.zig");
22}27}
lib/std/special/compiler_rt/floatsiXf.zig+10
...@@ -68,6 +68,16 @@ pub fn __floatsitf(arg: i32) callconv(.C) f128 {...@@ -68,6 +68,16 @@ pub fn __floatsitf(arg: i32) callconv(.C) f128 {
68 return @call(.{ .modifier = .always_inline }, floatsiXf, .{ f128, arg });68 return @call(.{ .modifier = .always_inline }, floatsiXf, .{ f128, arg });
69}69}
7070
71pub fn __aeabi_i2d(arg: i32) callconv(.AAPCS) f64 {
72 @setRuntimeSafety(false);
73 return @call(.{ .modifier = .always_inline }, __floatsidf, .{arg});
74}
75
76pub fn __aeabi_i2f(arg: i32) callconv(.AAPCS) f32 {
77 @setRuntimeSafety(false);
78 return @call(.{ .modifier = .always_inline }, __floatsisf, .{arg});
79}
80
71fn test_one_floatsitf(a: i32, expected: u128) void {81fn test_one_floatsitf(a: i32, expected: u128) void {
72 const r = __floatsitf(a);82 const r = __floatsitf(a);
73 std.testing.expect(@bitCast(u128, r) == expected);83 std.testing.expect(@bitCast(u128, r) == expected);
lib/std/special/compiler_rt/floatundidf.zig+5
...@@ -19,6 +19,11 @@ pub fn __floatundidf(a: u64) callconv(.C) f64 {...@@ -19,6 +19,11 @@ pub fn __floatundidf(a: u64) callconv(.C) f64 {
19 return (@bitCast(f64, high) - twop84_plus_twop52) + @bitCast(f64, low);19 return (@bitCast(f64, high) - twop84_plus_twop52) + @bitCast(f64, low);
20}20}
2121
22pub fn __aeabi_ul2d(arg: u64) callconv(.AAPCS) f64 {
23 @setRuntimeSafety(false);
24 return @call(.{ .modifier = .always_inline }, __floatundidf, .{arg});
25}
26
22test "import floatundidf" {27test "import floatundidf" {
23 _ = @import("floatundidf_test.zig");28 _ = @import("floatundidf_test.zig");
24}29}
lib/std/special/compiler_rt/floatundisf.zig+6-1
...@@ -4,7 +4,7 @@ const maxInt = std.math.maxInt;...@@ -4,7 +4,7 @@ const maxInt = std.math.maxInt;
44
5const FLT_MANT_DIG = 24;5const FLT_MANT_DIG = 24;
66
7pub extern fn __floatundisf(arg: u64) f32 {7pub fn __floatundisf(arg: u64) callconv(.C) f32 {
8 @setRuntimeSafety(builtin.is_test);8 @setRuntimeSafety(builtin.is_test);
99
10 if (arg == 0) return 0;10 if (arg == 0) return 0;
...@@ -56,6 +56,11 @@ pub extern fn __floatundisf(arg: u64) f32 {...@@ -56,6 +56,11 @@ pub extern fn __floatundisf(arg: u64) f32 {
56 return @bitCast(f32, result);56 return @bitCast(f32, result);
57}57}
5858
59pub fn __aeabi_ul2f(arg: u64) callconv(.AAPCS) f32 {
60 @setRuntimeSafety(false);
61 return @call(.{ .modifier = .always_inline }, __floatundisf, .{arg});
62}
63
59fn test__floatundisf(a: u64, expected: f32) void {64fn test__floatundisf(a: u64, expected: f32) void {
60 std.testing.expectEqual(expected, __floatundisf(a));65 std.testing.expectEqual(expected, __floatundisf(a));
61}66}
lib/std/special/compiler_rt/floatunsidf.zig+5
...@@ -18,6 +18,11 @@ pub fn __floatunsidf(arg: u32) callconv(.C) f64 {...@@ -18,6 +18,11 @@ pub fn __floatunsidf(arg: u32) callconv(.C) f64 {
18 return @bitCast(f64, mant | (exp + 1023) << 52);18 return @bitCast(f64, mant | (exp + 1023) << 52);
19}19}
2020
21pub fn __aeabi_ui2d(arg: u32) callconv(.AAPCS) f64 {
22 @setRuntimeSafety(false);
23 return @call(.{ .modifier = .always_inline }, __floatunsidf, .{arg});
24}
25
21fn test_one_floatunsidf(a: u32, expected: u64) void {26fn test_one_floatunsidf(a: u32, expected: u64) void {
22 const r = __floatunsidf(a);27 const r = __floatunsidf(a);
23 std.testing.expect(@bitCast(u64, r) == expected);28 std.testing.expect(@bitCast(u64, r) == expected);
lib/std/special/compiler_rt/floatunsisf.zig+6-1
...@@ -6,7 +6,7 @@ const significandBits = 23;...@@ -6,7 +6,7 @@ const significandBits = 23;
6const exponentBias = 127;6const exponentBias = 127;
7const implicitBit = @as(u32, 1) << significandBits;7const implicitBit = @as(u32, 1) << significandBits;
88
9pub extern fn __floatunsisf(arg: u32) f32 {9pub fn __floatunsisf(arg: u32) callconv(.C) f32 {
10 @setRuntimeSafety(builtin.is_test);10 @setRuntimeSafety(builtin.is_test);
1111
12 if (arg == 0) return 0.0;12 if (arg == 0) return 0.0;
...@@ -38,6 +38,11 @@ pub extern fn __floatunsisf(arg: u32) f32 {...@@ -38,6 +38,11 @@ pub extern fn __floatunsisf(arg: u32) f32 {
38 return @bitCast(f32, result);38 return @bitCast(f32, result);
39}39}
4040
41pub fn __aeabi_ui2f(arg: u32) callconv(.AAPCS) f32 {
42 @setRuntimeSafety(false);
43 return @call(.{ .modifier = .always_inline }, __floatunsisf, .{arg});
44}
45
41fn test_one_floatunsisf(a: u32, expected: u32) void {46fn test_one_floatunsisf(a: u32, expected: u32) void {
42 const r = __floatunsisf(a);47 const r = __floatunsisf(a);
43 std.testing.expect(@bitCast(u32, r) == expected);48 std.testing.expect(@bitCast(u32, r) == expected);
lib/std/special/compiler_rt/mulXf3.zig+10
...@@ -16,6 +16,16 @@ pub fn __mulsf3(a: f32, b: f32) callconv(.C) f32 {...@@ -16,6 +16,16 @@ pub fn __mulsf3(a: f32, b: f32) callconv(.C) f32 {
16 return mulXf3(f32, a, b);16 return mulXf3(f32, a, b);
17}17}
1818
19pub fn __aeabi_fmul(a: f32, b: f32) callconv(.C) f32 {
20 @setRuntimeSafety(false);
21 return @call(.{ .modifier = .always_inline }, __mulsf3, .{ a, b });
22}
23
24pub fn __aeabi_dmul(a: f64, b: f64) callconv(.C) f64 {
25 @setRuntimeSafety(false);
26 return @call(.{ .modifier = .always_inline }, __muldf3, .{ a, b });
27}
28
19fn mulXf3(comptime T: type, a: T, b: T) T {29fn mulXf3(comptime T: type, a: T, b: T) T {
20 @setRuntimeSafety(builtin.is_test);30 @setRuntimeSafety(builtin.is_test);
21 const Z = @IntType(false, T.bit_count);31 const Z = @IntType(false, T.bit_count);
lib/std/special/compiler_rt/negXf2.zig+10
...@@ -8,6 +8,16 @@ pub fn __negdf2(a: f64) callconv(.C) f64 {...@@ -8,6 +8,16 @@ pub fn __negdf2(a: f64) callconv(.C) f64 {
8 return negXf2(f64, a);8 return negXf2(f64, a);
9}9}
1010
11pub fn __aeabi_fneg(arg: f32) callconv(.AAPCS) f32 {
12 @setRuntimeSafety(false);
13 return @call(.{ .modifier = .always_inline }, __negsf2, .{arg});
14}
15
16pub fn __aeabi_dneg(arg: f64) callconv(.AAPCS) f64 {
17 @setRuntimeSafety(false);
18 return @call(.{ .modifier = .always_inline }, __negdf2, .{arg});
19}
20
11fn negXf2(comptime T: type, a: T) T {21fn negXf2(comptime T: type, a: T) T {
12 const Z = @IntType(false, T.bit_count);22 const Z = @IntType(false, T.bit_count);
1323
lib/std/special/compiler_rt/truncXfYf2.zig+15
...@@ -20,6 +20,21 @@ pub fn __truncdfsf2(a: f64) callconv(.C) f32 {...@@ -20,6 +20,21 @@ pub fn __truncdfsf2(a: f64) callconv(.C) f32 {
20 return truncXfYf2(f32, f64, a);20 return truncXfYf2(f32, f64, a);
21}21}
2222
23pub fn __aeabi_d2f(a: f64) callconv(.AAPCS) f32 {
24 @setRuntimeSafety(false);
25 return @call(.{ .modifier = .always_inline }, __truncdfsf2, .{a});
26}
27
28pub fn __aeabi_d2h(a: f64) callconv(.AAPCS) u16 {
29 @setRuntimeSafety(false);
30 return @call(.{ .modifier = .always_inline }, __truncdfhf2, .{a});
31}
32
33pub fn __aeabi_f2h(a: f32) callconv(.AAPCS) u16 {
34 @setRuntimeSafety(false);
35 return @call(.{ .modifier = .always_inline }, __truncsfhf2, .{a});
36}
37
23inline fn truncXfYf2(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t {38inline fn truncXfYf2(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t {
24 const src_rep_t = @IntType(false, @typeInfo(src_t).Float.bits);39 const src_rep_t = @IntType(false, @typeInfo(src_t).Float.bits);
25 const dst_rep_t = @IntType(false, @typeInfo(dst_t).Float.bits);40 const dst_rep_t = @IntType(false, @typeInfo(dst_t).Float.bits);