fixed bit field field the encoding fixes should be
| 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 |
| 0 | 0 | 1 | 0 | 1 | 0 | 0 | |||||||||||||||||||||||||
| 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 |
| pred.not | pred | Ra | Rd | ||||||||||||||||||||||||||||
bits 63:48: 0010 100- ---- ----
Runs execute_HARITH with Form() 12.
The operation reads some of these fields in some forms alone (it chooses by Form()), so the diagrams show only the decoder's.
| Field | Bits | From |
|---|---|---|
| [58:57] | 58:57 | execute_HARITH |
| [56:55] | 56:55 | execute_HARITH |
| neg_b | 56 | execute_HARITH |
| abs_b | 54 | execute_HARITH |
| swizzle_b | 54:53 | execute_HARITH |
| neg_c | 52 | execute_HARITH |
| [51:20] | 51:20 | execute_HARITH |
| neg_c | 51 | execute_HARITH |
| [50:49] | 50:49 | execute_HARITH |
| [46:39] | 46:39 | execute_HARITH |
| abs_a | 44 | execute_HARITH |
| neg_a | 43 | execute_HARITH |
| precision | 38:37 | execute_HARITH |
| swizzle_c | 36:35 | execute_HARITH |
| saturate | 32 | execute_HARITH |
| neg_b | 31 | execute_HARITH |
| abs_b | 30 | execute_HARITH |
| swizzle_b | 29:28 | execute_HARITH |
| pred.not | 19 | the decoder |
| pred | 18:16 | the decoder |
| Ra | 15:8 | RegA() |
| Rd | 7:0 | Dst() |
the half instructions: HADD2, HMUL2, HFMA2 and their forms. Each form's operands and fields, as Eden's half_floating_point_*.cpp decode them. A constant buffer operand is one F32 for both halves (swizzle 1). The 32I forms write both halves (no merge), take A's swizzle at 53, and HFMA2_32I adds Rd. FTZ isn't modelled: the halves are computed as F32
let f = Form(); /* 0-3 HADD2 R, C, I, 32I; 4-7 HMUL2 R, C, I, 32I; 8-12 HFMA2 R, RC, CR, I, 32I */
let fma = f >= 8;
let multiply = f >= 4 & f <= 7;
let imm32 = f == 3 | f == 7 | f == 12;
let g = if f <= 7 then MOD(f, 4) else f; /* the HADD2 and HMUL2 forms alike */
let raw_b = if g == 0 | f == 8 then R_read(RegB()) else if g == 1 then CbufWord() else if g == 2 | f == 11 then HalfImmediate()
else if g == 3 | f == 12 then Bits32(Field(20, 32)) else if f == 9 then R_read(UInt(Field(39, 8))) else CbufWord();
let swizzle_b = if g == 0 | f == 8 then UInt(Field(28, 2)) else if g == 1 then 1 else if f == 9 then UInt(Field(53, 2))
else if f == 10 then 1 else 0;
let abs_b = if g == 0 & not_bool(fma) then UInt(Field(30, 1)) else if g == 1 & not_bool(fma) then UInt(Field(54, 1)) else 0;
let neg_b = if g == 0 & not_bool(fma) then UInt(Field(31, 1)) else if f == 1 then UInt(Field(56, 1))
else if f == 8 then UInt(Field(31, 1)) else if f == 9 | f == 10 then UInt(Field(56, 1)) else 0;
let raw_c = if f == 8 then R_read(UInt(Field(39, 8))) else if f == 9 then CbufWord()
else if f == 10 | f == 11 then R_read(UInt(Field(39, 8))) else if f == 12 then R_read(Dst()) else 0x00000000;
let swizzle_c = if f == 8 then UInt(Field(35, 2)) else if f == 9 then 1 else if f == 10 | f == 11 then UInt(Field(53, 2)) else 0;
let neg_c = if f == 8 then UInt(Field(30, 1)) else if f >= 9 & f <= 11 then UInt(Field(51, 1)) else if f == 12 then UInt(Field(52, 1)) else 0;
let saturate = if g == 0 & not_bool(fma) then UInt(Field(32, 1)) else if f == 8 then UInt(Field(32, 1))
else if f == 12 then 0 else UInt(Field(52, 1));
let precision = if multiply then UInt(Field(if imm32 then 55 else 39, 2)) else if f == 8 then UInt(Field(37, 2))
else if f >= 9 & f <= 11 then UInt(Field(57, 2)) else if f == 12 then UInt(Field(55, 2)) else 0;
let neg_a = if f == 3 then UInt(Field(56, 1)) else if not_bool(fma) & not_bool(imm32) then (if f == 4 then 0 else UInt(Field(43, 1))) else 0;
let abs_a = if not_bool(fma) & not_bool(imm32) & f != 3 then UInt(Field(44, 1)) else 0;
let lhs = HalfPairMod(HalfPairOf(R_read(RegA()), UInt(Field(if imm32 then 53 else 47, 2))), abs_a, neg_a);
let rhs = HalfPairMod(HalfPairOf(raw_b, swizzle_b), abs_b, neg_b);
let pair : half2 = if fma then {
let addend = HalfPairMod(HalfPairOf(raw_c, swizzle_c), 0, neg_c);
let p = Half2FmaNC(lhs, rhs, addend);
if precision == 2 then HalfFmzFma(p, lhs, rhs, addend) else p
} else if multiply then {
let p = Half2MulNC(lhs, rhs);
if precision == 2 then HalfFmz(p, lhs, rhs) else p
} else Half2AddNC(lhs, rhs);
R_write(Dst(), HalfPairResult(pair, R_read(Dst()), if imm32 then 0 else UInt(Field(49, 2)), saturate))
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 Eden's maxwell.inc (GPL-2.0-or-later).