Commit 1eda86e1ad

Marc Tiehuis <marctiehuis@gmail.com>
2018-07-03 03:22:12
Clean up outstanding compiler_rt todos
1 parent 06e8c2e
std/special/compiler_rt/comparetf2.zig
@@ -1,4 +1,4 @@
-// TODO https://github.com/ziglang/zig/issues/305
+// TODO https://github.com/ziglang/zig/issues/641
 // and then make the return types of some of these functions the enum instead of c_int
 const LE_LESS = c_int(-1);
 const LE_EQUAL = c_int(0);
@@ -56,7 +56,7 @@ pub extern fn __letf2(a: f128, b: f128) c_int {
         LE_GREATER;
 }
 
-// TODO https://github.com/ziglang/zig/issues/305
+// TODO https://github.com/ziglang/zig/issues/641
 // and then make the return types of some of these functions the enum instead of c_int
 const GE_LESS = c_int(-1);
 const GE_EQUAL = c_int(0);
std/special/compiler_rt/fixuint.zig
@@ -44,14 +44,8 @@ pub fn fixuint(comptime fp_t: type, comptime fixuint_t: type, a: fp_t) fixuint_t
     // If 0 <= exponent < significandBits, right shift to get the result.
     // Otherwise, shift left.
     if (exponent < significandBits) {
-        // TODO this is a workaround for the mysterious "integer cast truncated bits"
-        // happening on the next line
-        @setRuntimeSafety(false);
         return @intCast(fixuint_t, significand >> @intCast(Log2Int(rep_t), significandBits - exponent));
     } else {
-        // TODO this is a workaround for the mysterious "integer cast truncated bits"
-        // happening on the next line
-        @setRuntimeSafety(false);
         return @intCast(fixuint_t, significand) << @intCast(Log2Int(fixuint_t), exponent - significandBits);
     }
 }
std/special/compiler_rt/fixunstfdi_test.zig
@@ -36,15 +36,14 @@ test "fixunstfdi" {
     test__fixunstfdi(-0x1.FFFFFFFFFFFFFp+62, 0);
     test__fixunstfdi(-0x1.FFFFFFFFFFFFEp+62, 0);
 
-    // TODO enable these tests when we can parse f128 float literals
-    //test__fixunstfdi(0x1.FFFFFFFFFFFFFFFEp+63, 0xFFFFFFFFFFFFFFFF);
-    //test__fixunstfdi(0x1.0000000000000002p+63, 0x8000000000000001);
-    //test__fixunstfdi(0x1.0000000000000000p+63, 0x8000000000000000);
-    //test__fixunstfdi(0x1.FFFFFFFFFFFFFFFCp+62, 0x7FFFFFFFFFFFFFFF);
-    //test__fixunstfdi(0x1.FFFFFFFFFFFFFFF8p+62, 0x7FFFFFFFFFFFFFFE);
-    //test__fixunstfdi(0x1.p+64, 0xFFFFFFFFFFFFFFFF);
-
-    //test__fixunstfdi(-0x1.0000000000000000p+63, 0);
-    //test__fixunstfdi(-0x1.FFFFFFFFFFFFFFFCp+62, 0);
-    //test__fixunstfdi(-0x1.FFFFFFFFFFFFFFF8p+62, 0);
+    test__fixunstfdi(0x1.FFFFFFFFFFFFFFFEp+63, 0xFFFFFFFFFFFFFFFF);
+    test__fixunstfdi(0x1.0000000000000002p+63, 0x8000000000000001);
+    test__fixunstfdi(0x1.0000000000000000p+63, 0x8000000000000000);
+    test__fixunstfdi(0x1.FFFFFFFFFFFFFFFCp+62, 0x7FFFFFFFFFFFFFFF);
+    test__fixunstfdi(0x1.FFFFFFFFFFFFFFF8p+62, 0x7FFFFFFFFFFFFFFE);
+    test__fixunstfdi(0x1.p+64, 0xFFFFFFFFFFFFFFFF);
+
+    test__fixunstfdi(-0x1.0000000000000000p+63, 0);
+    test__fixunstfdi(-0x1.FFFFFFFFFFFFFFFCp+62, 0);
+    test__fixunstfdi(-0x1.FFFFFFFFFFFFFFF8p+62, 0);
 }
std/special/compiler_rt/fixunstfsi_test.zig
@@ -11,9 +11,9 @@ const inf128 = @bitCast(f128, u128(0x7fff0000000000000000000000000000));
 test "fixunstfsi" {
     test__fixunstfsi(inf128, 0xffffffff);
     test__fixunstfsi(0, 0x0);
-    //TODO test__fixunstfsi(0x1.23456789abcdefp+5, 0x24);
+    test__fixunstfsi(0x1.23456789abcdefp+5, 0x24);
     test__fixunstfsi(0x1.23456789abcdefp-3, 0x0);
-    //TODO test__fixunstfsi(0x1.23456789abcdefp+20, 0x123456);
+    test__fixunstfsi(0x1.23456789abcdefp+20, 0x123456);
     test__fixunstfsi(0x1.23456789abcdefp+40, 0xffffffff);
     test__fixunstfsi(0x1.23456789abcdefp+256, 0xffffffff);
     test__fixunstfsi(-0x1.23456789abcdefp+3, 0x0);
std/special/compiler_rt/floatunsitf.zig
@@ -17,7 +17,7 @@ pub extern fn __floatunsitf(a: u64) f128 {
     const exp = (u64.bit_count - 1) - @clz(a);
     const shift = mantissa_bits - @intCast(u7, exp);
 
-    // TODO: @bitCast alignment error
+    // TODO(#1148): @bitCast alignment error
     var result align(16) = (@intCast(u128, a) << shift) ^ implicit_bit;
     result += (@intCast(u128, exp) + exponent_bias) << mantissa_bits;