FADD32I

Floating point instructions

fixed bit field field the encoding fixes should be

FADD32I

6362616059585756555453525150494847464544434241403938373635343332
000010
313029282726252423222120191817161514131211109876543210
pred.notpredRaRd

bits 63:48: 0000 10-- ---- ----

Runs execute_FADD with Form() 3.

Fields

The operation reads some of these fields in some forms alone (it chooses by Form()), so the diagrams show only the decoder's.

FieldBitsFrom
[57]57execute_FADD
[56]56execute_FADD
mode55execute_FADD
[54]54execute_FADD
mode54:53execute_FADD
[53]53execute_FADD
sat50execute_FADD
right49execute_FADD
left48execute_FADD
left46execute_FADD
[45:44]45:44execute_FADD
right45execute_FADD
mode44execute_FADD
sc43:41execute_FADD
pred.not19the decoder
pred18:16the decoder
Ra15:8RegA()
Rd7:0Dst()

Operation Sail

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).