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 | 0 | 0 | 1 | 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: 0000 10-- ---- ----
Runs execute_FADD with Form() 3.
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 |
|---|---|---|
| [57] | 57 | execute_FADD |
| [56] | 56 | execute_FADD |
| mode | 55 | execute_FADD |
| [54] | 54 | execute_FADD |
| mode | 54:53 | execute_FADD |
| [53] | 53 | execute_FADD |
| sat | 50 | execute_FADD |
| right | 49 | execute_FADD |
| left | 48 | execute_FADD |
| left | 46 | execute_FADD |
| [45:44] | 45:44 | execute_FADD |
| right | 45 | execute_FADD |
| mode | 44 | execute_FADD |
| sc | 43:41 | execute_FADD |
| pred.not | 19 | the decoder |
| pred | 18:16 | the decoder |
| Ra | 15:8 | RegA() |
| Rd | 7:0 | Dst() |
FADD, FMUL and their 32I forms: a + b or a * b, each operand's modifiers where its form keeps them, FTZ (44, FMUL's 44-45, FADD32I's 55, FMUL32I's 53-54 bit 0) flushed where the device does not, FMZ (FMUL's 44-45, FMUL32I's 53-54 = 2: a zero factor makes the product 0, even with an infinity), FMUL's scale (41-43), .SAT
let f = Form(); /* 0-2 FADD, 3 FADD32I, 4-6 FMUL, 7 FMUL32I */
let add = f <= 3;
let left0 = RegF(RegA());
let right0 = if f == 1 | f == 5 then CbufF() else if f == 2 | f == 6 then Imm20F() else if f == 3 | f == 7 then Imm32F()
else RegF(RegB());
let left = if f <= 2 then FloatMod(left0, UInt(Field(46, 1)), UInt(Field(48, 1)))
else if f == 3 then FloatMod(left0, UInt(Field(54, 1)), UInt(Field(56, 1))) else left0;
let right = if f <= 2 then FloatMod(right0, UInt(Field(49, 1)), UInt(Field(45, 1)))
else if f == 3 then FloatMod(right0, UInt(Field(57, 1)), UInt(Field(53, 1)))
else if f <= 6 then FloatMod(right0, 0, UInt(Field(48, 1))) else right0;
let mode = if f == 3 then UInt(Field(55, 1)) else if f == 7 then UInt(Field(53, 2)) else if add then UInt(Field(44, 1))
else UInt(Field(44, 2));
let soft_ftz = MOD(mode, 2) == 1 & SoftFtz();
let l = if soft_ftz then FloatFtz(left) else left;
let r = if soft_ftz then FloatFtz(right) else right;
let sum = if add then FAddNC(l, r) else FMulNC(l, r);
let flushed = if soft_ftz then FloatFtz(sum) else sum;
let fmz = (if f == 7 then UInt(Field(53, 2)) else if f >= 4 then UInt(Field(44, 2)) else 0) == 2;
let zeroed = if fmz then {
let zero = FConst(0x00000000);
let left_zero = FCompare(2, l, zero);
let right_zero = FCompare(2, r, zero);
let either = RawOr(left_zero, right_zero);
if either then zero else flushed
} else flushed;
/* FMUL's scale: 1, 0.5, 0.25, 0.125, 8, 4, 2 */
let sc = if f >= 4 & f <= 6 then UInt(Field(41, 3)) else 0;
let scaled = if sc != 0 then FMulNC(zeroed, FConst(match sc { 1 => 0x3f000000, 2 => 0x3e800000, 3 => 0x3e000000,
4 => 0x41000000, 5 => 0x40800000, _ => 0x40000000 }))
else zeroed;
let sat = if f == 3 then 0 else if f == 7 then UInt(Field(55, 1)) else UInt(Field(50, 1));
R_writeF(Dst(), FloatSaturate(scaled, sat))
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).