| ... | ... | @@ -63,6 +63,16 @@ pub extern fn __floatsidf(arg: i32) f64 { |
| 63 | 63 | return @inlineCall(floatsiXf, f64, arg); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | pub extern fn __floatsitf(arg: i32) f128 { |
| 67 | @setRuntimeSafety(builtin.is_test); |
| 68 | return @inlineCall(floatsiXf, f128, arg); |
| 69 | } |
| 70 | |
| 71 | fn test_one_floatsitf(a: i32, expected: u128) void { |
| 72 | const r = __floatsitf(a); |
| 73 | std.testing.expect(@bitCast(u128, r) == expected); |
| 74 | } |
| 75 | |
| 66 | 76 | fn test_one_floatsidf(a: i32, expected: u64) void { |
| 67 | 77 | const r = __floatsidf(a); |
| 68 | 78 | std.testing.expect(@bitCast(u64, r) == expected); |
| ... | ... | @@ -88,3 +98,12 @@ test "floatsisf" { |
| 88 | 98 | test_one_floatsisf(0x7FFFFFFF, 0x4f000000); |
| 89 | 99 | test_one_floatsisf(@bitCast(i32, @intCast(u32, 0x80000000)), 0xcf000000); |
| 90 | 100 | } |
| 101 | |
| 102 | test "floatsitf" { |
| 103 | test_one_floatsitf(0, 0); |
| 104 | test_one_floatsitf(0x7FFFFFFF, 0x401dfffffffc00000000000000000000); |
| 105 | test_one_floatsitf(0x12345678, 0x401b2345678000000000000000000000); |
| 106 | test_one_floatsitf(-0x12345678, 0xc01b2345678000000000000000000000); |
| 107 | test_one_floatsitf(@bitCast(i32, @intCast(u32, 0xffffffff)), 0xbfff0000000000000000000000000000); |
| 108 | test_one_floatsitf(@bitCast(i32, @intCast(u32, 0x80000000)), 0xc01e0000000000000000000000000000); |
| 109 | } |