fixed bit field field the encoding fixes should be
| 127 | 126 | 125 | 124 | 123 | 122 | 121 | 120 | 119 | 118 | 117 | 116 | 115 | 114 | 113 | 112 | 111 | 110 | 109 | 108 | 107 | 106 | 105 | 104 | 103 | 102 | 101 | 100 | 99 | 98 | 97 | 96 |
| reuse | wait | rd_bar | wr_bar | yield | stall | ||||||||||||||||||||||||||
| 95 | 94 | 93 | 92 | 91 | 90 | 89 | 88 | 87 | 86 | 85 | 84 | 83 | 82 | 81 | 80 | 79 | 78 | 77 | 76 | 75 | 74 | 73 | 72 | 71 | 70 | 69 | 68 | 67 | 66 | 65 | 64 |
| ssize | x | dsize | is_signed | ||||||||||||||||||||||||||||
| 63 | 62 | 61 | 60 | 59 | 58 | 57 | 56 | 55 | 54 | 53 | 52 | 51 | 50 | 49 | 48 | 47 | 46 | 45 | 44 | 43 | 42 | 41 | 40 | 39 | 38 | 37 | 36 | 35 | 34 | 33 | 32 |
| x | |||||||||||||||||||||||||||||||
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| Ra | Rd | pred.not | pred | form | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | ||||||||||||||||||
bits 15:0: ---- 0011 0000 0101
bits 15:0: ---- 1001 0000 0101
bits 15:0: ---- 1011 0000 0101
bits 15:0: ---- 1101 0000 0101
| Form (bits 11:9) | b | c |
|---|---|---|
| 1 (001) | Rb at 32 | Rc at 64 |
| 4 (100) | immediate at 32 | Rc at 64 |
| 5 (101) | constant buffer: offset at 38, bank at 54 | Rc at 64 |
| 6 (110) | URb at 32 | Rc at 64 |
Runs execute_F2I.
| Field | Bits | From |
|---|---|---|
| reuse | 125:122 | the decoder |
| wait | 121:116 | the decoder |
| rd_bar | 115:113 | the decoder |
| wr_bar | 112:110 | the decoder |
| yield | 109 | the decoder |
| stall | 108:105 | the decoder |
| ssize | 85:84 | execute_F2I |
| x | 79:78 | execute_F2I |
| dsize | 76:75 | execute_F2I |
| is_signed | 72 | execute_F2I |
| x | 60 | HalfOf |
| Ra | 31:24 | the decoder |
| Rd | 23:16 | the decoder |
| pred.not | 15 | the decoder |
| pred | 14:12 | the decoder |
| form | 11:9 | the decoder |
F2I: NAK's log2 of the destination's bytes at 75 and of the source's at 84, signed with 72, the rounding at 78. A half's source is the one bit 60 names, with b's modifiers, as MUFU.F16's. The hardware saturates, and a NaN gives 0; an 8- or 16-bit result saturates to its range, then fills the register sign or zero extended
let dsize = UInt(Field(75, 2));
let ssize = UInt(Field(84, 2));
if dsize == 3 | (ssize != 1 & ssize != 2) then throw(Unsupported("F2I of sizes %u, %u", ssize, dsize));
let from = if ssize == 1 then HalfOf(B) else SrcF(B);
let x = FRound(UInt(Field(78, 2)), from);
let is_signed = Field(72, 1) == 0b1;
let nan = FIsNaN(x);
let v : bits(32) = if dsize < 2 then {
let lo = if dsize == 0 then (if is_signed then 0xc3000000 else 0x00000000)
else (if is_signed then 0xc7000000 else 0x00000000);
let hi = if dsize == 0 then (if is_signed then 0x42fe0000 else 0x437f0000)
else (if is_signed then 0x46fffe00 else 0x477fff00);
let clamped = FMinN(FMaxN(x, FConst(lo)), FConst(hi));
if is_signed then Bits32(FToS32(clamped)) else FToU32(clamped)
} else if is_signed then {
let high = FCompare(6, x, FConst(0x4f000000));
let clamped = FMaxN(x, FConst(0xcf000000));
let s = Bits32(FToS32(clamped));
if high then 0x7fffffff else s
} else {
let high = FCompare(6, x, FConst(0x4f800000));
let clamped = FMaxN(x, FConst(0x00000000));
let u = FToU32(clamped);
if high then 0xffffffff else u
};
D_write(if nan then 0x00000000 else v)
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.