Commit bd4421befe

LemonBoy <thatlemon@gmail.com>
2021-04-15 21:52:08
compiler-rt: Don't pass f16 around as arguments
Fixes some failures on AArch64. f16 was a mistake.
1 parent 5bc1dc5
Changed files (1)
lib
std
special
lib/std/special/compiler_rt/extendXfYf2_test.zig
@@ -163,8 +163,8 @@ fn makeInf32() f32 {
     return @bitCast(f32, @as(u32, 0x7f800000));
 }
 
-fn test__extendhftf2(a: f16, expectedHi: u64, expectedLo: u64) void {
-    const x = __extendhftf2(@bitCast(u16, a));
+fn test__extendhftf2(a: u16, expectedHi: u64, expectedLo: u64) void {
+    const x = __extendhftf2(a);
 
     const rep = @bitCast(u128, x);
     const hi = @intCast(u64, rep >> 64);
@@ -187,24 +187,24 @@ fn test__extendhftf2(a: f16, expectedHi: u64, expectedLo: u64) void {
 
 test "extendhftf2" {
     // qNaN
-    test__extendhftf2(@bitCast(f16, @as(u16, 0x7e00)), 0x7fff800000000000, 0x0);
+    test__extendhftf2(0x7e00, 0x7fff800000000000, 0x0);
     // NaN
-    test__extendhftf2(@bitCast(f16, @as(u16, 0x7d00)), 0x7fff400000000000, 0x0);
+    test__extendhftf2(0x7d00, 0x7fff400000000000, 0x0);
     // inf
-    test__extendhftf2(@bitCast(f16, @as(u16, 0x7c00)), 0x7fff000000000000, 0x0);
-    test__extendhftf2(-@bitCast(f16, @as(u16, 0x7c00)), 0xffff000000000000, 0x0);
+    test__extendhftf2(0x7c00, 0x7fff000000000000, 0x0);
+    test__extendhftf2(0xfc00, 0xffff000000000000, 0x0);
     // zero
-    test__extendhftf2(@bitCast(f16, @as(u16, 0x0)), 0x0, 0x0);
-    test__extendhftf2(@bitCast(f16, @as(u16, 0x8000)), 0x8000000000000000, 0x0);
+    test__extendhftf2(0x0000, 0x0000000000000000, 0x0);
+    test__extendhftf2(0x8000, 0x8000000000000000, 0x0);
     // denormal
-    test__extendhftf2(@bitCast(f16, @as(u16, 0x0010)), 0x3feb000000000000, 0x0000000000000000);
-    test__extendhftf2(@bitCast(f16, @as(u16, 0x0001)), 0x3fe7000000000000, 0x0000000000000000);
-    test__extendhftf2(@bitCast(f16, @as(u16, 0x8001)), 0xbfe7000000000000, 0x0000000000000000);
+    test__extendhftf2(0x0010, 0x3feb000000000000, 0x0);
+    test__extendhftf2(0x0001, 0x3fe7000000000000, 0x0);
+    test__extendhftf2(0x8001, 0xbfe7000000000000, 0x0);
 
     // pi
-    test__extendhftf2(@bitCast(f16, @as(u16, 0x4248)), 0x4000920000000000, 0x0000000000000000);
-    test__extendhftf2(@bitCast(f16, @as(u16, 0xc248)), 0xc000920000000000, 0x0000000000000000);
+    test__extendhftf2(0x4248, 0x4000920000000000, 0x0);
+    test__extendhftf2(0xc248, 0xc000920000000000, 0x0);
 
-    test__extendhftf2(@bitCast(f16, @as(u16, 0x508c)), 0x4004230000000000, 0x0);
-    test__extendhftf2(@bitCast(f16, @as(u16, 0x1bb7)), 0x3ff6edc000000000, 0x0);
+    test__extendhftf2(0x508c, 0x4004230000000000, 0x0);
+    test__extendhftf2(0x1bb7, 0x3ff6edc000000000, 0x0);
 }