Integer, logic, video and predicate instructions
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 |
| 1 | 0 | 0 | 0 | 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: 1000 00-- ---- ----
Runs execute_IMUL with Form() 8.
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 |
|---|---|---|
| mode | 56:55 | execute_IMUL |
| mode | 52:51 | execute_IMUL |
| rhs0 | 51:20 | execute_IMUL |
| [49] | 49 | execute_IMUL |
| rhs0 | 46:39 | execute_IMUL |
| pred.not | 19 | the decoder |
| pred | 18:16 | the decoder |
| Ra | 15:8 | RegA() |
| Rd | 7:0 | Dst() |
IMUL, IMUL32I, IMAD and IMAD32I: a * b, its high word with .HI (each operand signed or not), + c for IMAD; IMAD's mode negates b (2) or c (1), or adds one (3); .X adds the carry
let f = Form();
let imm32 = f == 3 | f == 8;
let mad = f >= 4;
let lhs = R_read(RegA());
let rhs0 = if imm32 then Bits32(Field(20, 32)) else if f == 5 then R_read(UInt(Field(39, 8)))
else if f == 6 then CbufWord() else Right(if f == 0 | f == 4 then 0 else if f == 1 then 1 else 2);
var rhs : bits(32) = rhs0;
var addend : bits(32) = 0x00000000;
if mad then {
addend = if f == 8 then R_read(Dst()) else if f == 5 then CbufWord() else R_read(UInt(Field(39, 8)));
let mode = if imm32 then UInt(Field(55, 2)) else UInt(Field(51, 2));
if mode == 2 then { rhs = 0x00000000 - rhs };
if mode == 1 then { addend = 0x00000000 - addend };
if mode == 3 then { addend = addend + 0x00000001 };
if not_bool(imm32) & Field(49, 1) == 0b1 then { addend = addend + (if FlagRead(2) then 0x00000001 else 0x00000000) }
};
let high = Field(if imm32 then 53 else if mad then 54 else 39, 1) == 0b1;
let signed_lhs = UInt(Field(if imm32 then 54 else if mad then 48 else 40, 1));
let signed_rhs = UInt(Field(if imm32 then (if mad then 57 else 55) else if mad then 53 else 41, 1));
let product = if high then MulHigh(lhs, rhs, signed_lhs, signed_rhs) else lhs * rhs;
R_write(Dst(), if mad then product + addend else product)
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).