Skip to content

Commit

Permalink
Clean up outstanding compiler_rt todos
Browse files Browse the repository at this point in the history
  • Loading branch information
tiehuis committed Jul 3, 2018
1 parent 06e8c2e commit 1eda86e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 22 deletions.
4 changes: 2 additions & 2 deletions 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);
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 0 additions & 6 deletions std/special/compiler_rt/fixuint.zig
Expand Up @@ -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);
}
}
21 changes: 10 additions & 11 deletions std/special/compiler_rt/fixunstfdi_test.zig
Expand Up @@ -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);
}
4 changes: 2 additions & 2 deletions std/special/compiler_rt/fixunstfsi_test.zig
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion std/special/compiler_rt/floatunsitf.zig
Expand Up @@ -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;

Expand Down

0 comments on commit 1eda86e

Please sign in to comment.