I2FP

Conversions

fixed bit field field the encoding fixes should be

Encoding

12712612512412312212112011911811711611511411311211111010910810710610510410310210110099989796
reusewaitrd_barwr_baryieldstall
9594939291908988878685848382818079787776757473727170696867666564
src_sizemode[76:75]is_signed
6362616059585756555453525150494847464544434241403938373635343332
[61:60]
313029282726252423222120191817161514131211109876543210
RaRdpred.notpredform001000101

bits 15:0: ---- 0010 0100 0101
bits 15:0: ---- 1000 0100 0101
bits 15:0: ---- 1010 0100 0101
bits 15:0: ---- 1100 0100 0101

Forms

Form (bits 11:9)bc
1 (001)Rb at 32Rc at 64
4 (100)immediate at 32Rc at 64
5 (101)constant buffer: offset at 38, bank at 54Rc at 64
6 (110)URb at 32Rc at 64

Runs execute_I2F.

Fields

FieldBitsFrom
reuse125:122the decoder
wait121:116the decoder
rd_bar115:113the decoder
wr_bar112:110the decoder
yield109the decoder
stall108:105the decoder
src_size85:84execute_I2F
mode79:78execute_I2F
[76:75]76:75execute_I2F
is_signed74execute_I2F
[61:60]61:60execute_I2F
Ra31:24the decoder
Rd23:16the decoder
pred.not15the decoder
pred14:12the decoder
form11:9the decoder

Operation Sail

I2F and I2FP: the rounding mode in 78-79, a 32-bit integer being exact in a double. An 8- or 16-bit source (84-85) is the byte (.B1 to .B3) or halfword (.H1) that 60-61 select (CuAssembler sm_86). A device without doubles converts to a float, which a 32-bit integer keeps no more exactly: it rounds to nearest, as the mode 0 conversion does

let src_size = UInt(Field(84, 2));
if Field(75, 2) != 0b10 | src_size == 3 then
    throw(Unsupported("%s of sizes %u, %u", OpName(), src_size, Field(75, 2)));
let b = SrcBits(B);
let is_signed = Field(74, 1) == 0b1;
let x = if src_size < 2 then {
    let width = if src_size == 1 then 16 else 8;
    if is_signed then Bits32(BitsS(b, to_bits(32, width * UInt(Field(60, 2))), to_bits(32, width)))
    else BitsU(b, to_bits(32, width * UInt(Field(60, 2))), to_bits(32, width))
} else b;
let mode = if Float64() then UInt(Field(78, 2)) else 0;
let nearest = if is_signed then MOD(I2fNearest(), 2) == 1 else MOD(DIV(I2fNearest(), 2), 2) == 1;
if mode == 0 then {
    if src_size == 2 & nearest then D_write(Bits32(IntToF32Nearest(x, if is_signed then 1 else 0)))
    else D_write(Bits32(if is_signed then S32ToF(x) else U32ToF(x)))
} else D_write(Bits32(RoundF64(mode, ToF64(x, if is_signed then 1 else 0))))

Made from ScarletNX's Sail at 166ad3910f80. The Sail and the encodings' file are ScarletNX's (GPL-3.0-or-later); its encodings are from Mesa's NAK (sm70_encode.rs, MIT) and CuAssembler's sm_86 records.