| ... | ... | @@ -163,8 +163,8 @@ fn makeInf32() f32 { |
| 163 | 163 | return @bitCast(f32, @as(u32, 0x7f800000)); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | | fn test__extendhftf2(a: f16, expectedHi: u64, expectedLo: u64) void { |
| 167 | | const x = __extendhftf2(@bitCast(u16, a)); |
| 166 | fn test__extendhftf2(a: u16, expectedHi: u64, expectedLo: u64) void { |
| 167 | const x = __extendhftf2(a); |
| 168 | 168 | |
| 169 | 169 | const rep = @bitCast(u128, x); |
| 170 | 170 | const hi = @intCast(u64, rep >> 64); |
| ... | ... | @@ -187,24 +187,24 @@ fn test__extendhftf2(a: f16, expectedHi: u64, expectedLo: u64) void { |
| 187 | 187 | |
| 188 | 188 | test "extendhftf2" { |
| 189 | 189 | // qNaN |
| 190 | | test__extendhftf2(@bitCast(f16, @as(u16, 0x7e00)), 0x7fff800000000000, 0x0); |
| 190 | test__extendhftf2(0x7e00, 0x7fff800000000000, 0x0); |
| 191 | 191 | // NaN |
| 192 | | test__extendhftf2(@bitCast(f16, @as(u16, 0x7d00)), 0x7fff400000000000, 0x0); |
| 192 | test__extendhftf2(0x7d00, 0x7fff400000000000, 0x0); |
| 193 | 193 | // inf |
| 194 | | test__extendhftf2(@bitCast(f16, @as(u16, 0x7c00)), 0x7fff000000000000, 0x0); |
| 195 | | test__extendhftf2(-@bitCast(f16, @as(u16, 0x7c00)), 0xffff000000000000, 0x0); |
| 194 | test__extendhftf2(0x7c00, 0x7fff000000000000, 0x0); |
| 195 | test__extendhftf2(0xfc00, 0xffff000000000000, 0x0); |
| 196 | 196 | // zero |
| 197 | | test__extendhftf2(@bitCast(f16, @as(u16, 0x0)), 0x0, 0x0); |
| 198 | | test__extendhftf2(@bitCast(f16, @as(u16, 0x8000)), 0x8000000000000000, 0x0); |
| 197 | test__extendhftf2(0x0000, 0x0000000000000000, 0x0); |
| 198 | test__extendhftf2(0x8000, 0x8000000000000000, 0x0); |
| 199 | 199 | // denormal |
| 200 | | test__extendhftf2(@bitCast(f16, @as(u16, 0x0010)), 0x3feb000000000000, 0x0000000000000000); |
| 201 | | test__extendhftf2(@bitCast(f16, @as(u16, 0x0001)), 0x3fe7000000000000, 0x0000000000000000); |
| 202 | | test__extendhftf2(@bitCast(f16, @as(u16, 0x8001)), 0xbfe7000000000000, 0x0000000000000000); |
| 200 | test__extendhftf2(0x0010, 0x3feb000000000000, 0x0); |
| 201 | test__extendhftf2(0x0001, 0x3fe7000000000000, 0x0); |
| 202 | test__extendhftf2(0x8001, 0xbfe7000000000000, 0x0); |
| 203 | 203 | |
| 204 | 204 | // pi |
| 205 | | test__extendhftf2(@bitCast(f16, @as(u16, 0x4248)), 0x4000920000000000, 0x0000000000000000); |
| 206 | | test__extendhftf2(@bitCast(f16, @as(u16, 0xc248)), 0xc000920000000000, 0x0000000000000000); |
| 205 | test__extendhftf2(0x4248, 0x4000920000000000, 0x0); |
| 206 | test__extendhftf2(0xc248, 0xc000920000000000, 0x0); |
| 207 | 207 | |
| 208 | | test__extendhftf2(@bitCast(f16, @as(u16, 0x508c)), 0x4004230000000000, 0x0); |
| 209 | | test__extendhftf2(@bitCast(f16, @as(u16, 0x1bb7)), 0x3ff6edc000000000, 0x0); |
| 208 | test__extendhftf2(0x508c, 0x4004230000000000, 0x0); |
| 209 | test__extendhftf2(0x1bb7, 0x3ff6edc000000000, 0x0); |
| 210 | 210 | } |