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 |
| 0 | 0 | 1 | 1 | 1 | 0 | 1 | maximum | saturated | signed_format | mode | vb | bsel | asel | third | asel | ||||||||||||||||
| 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 |
| bsel | pred.not | pred | Ra | Rd | |||||||||||||||||||||||||||
bits 63:48: 0011 101- ---- ----
Runs execute_VMNMX with Form() 0.
| Field | Bits | From |
|---|---|---|
| maximum | 56 | execute_VMNMX |
| saturated | 55 | execute_VMNMX |
| signed_format | 54 | execute_VMNMX |
| mode | 53:51 | execute_VMNMX |
| vb | 50 | execute_VMNMX |
| bsel | 49 | execute_VMNMX |
| asel | 48 | execute_VMNMX |
| third | 46:39 | execute_VMNMX |
| asel | 38:36 | execute_VMNMX |
| [35:20] | 35:20 | execute_VMNMX |
| bsel | 30:28 | execute_VMNMX |
| pred.not | 19 | the decoder |
| pred | 18:16 | the decoder |
| Ra | 15:8 | RegA() |
| Rd | 7:0 | Dst() |
VMNMX: the minimum (or with 56 the maximum) of a's and b's selects, each signed or not, saturated to the destination's format (54 signed, 55 saturate), then the secondary operation with c (51-53)
let asel = UInt(Field(36, 3)) + 8 * UInt(Field(48, 1));
let bsel = UInt(Field(28, 3)) + 8 * UInt(Field(49, 1));
let sa = DIV(asel, 8) == 1;
let sb = DIV(bsel, 8) == 1;
let maximum = Field(56, 1) == 0b1;
let va = VmSelect(R_read(RegA()), asel);
let vb = if Field(50, 1) == 0b1 then VmSelect(R_read(RegB()), bsel)
else Bits32(if sb then SignExtend(Field(20, 16), 32) else ZeroExtend(Field(20, 16), 32));
let less = if sa == sb then (if sa then SGreater(vb, va) else UInt(va) < UInt(vb))
else if sa then RawOr(Negative(va), UInt(va) < UInt(vb))
else RawAnd(RawNot(Negative(vb)), UInt(va) < UInt(vb));
let picked = RawSelect(less, if maximum then vb else va, if maximum then va else vb);
let result_signed = if sa == sb then sa else not_bool(maximum);
let signed_format = Field(54, 1) == 0b1;
let saturated = if Field(55, 1) == 0b1 & signed_format & not_bool(result_signed) then {
let cap = Bits32(0x7fffffff);
let above = UInt(cap) < UInt(picked);
RawSelect(above, cap, picked)
} else if Field(55, 1) == 0b1 & not_bool(signed_format) & result_signed then {
let negative = Negative(picked);
RawSelect(negative, 0x00000000, picked)
} else picked;
let third = R_read(UInt(Field(39, 8)));
let mode = UInt(Field(51, 3));
let result = if mode < 4 then BitsInsert(third, saturated, to_bits(32, if mode == 0 | mode == 3 then 16 else 0),
to_bits(32, if mode == 2 | mode == 3 then 8 else 16))
else if mode == 4 then saturated + third
else if mode == 5 | mode == 6 then {
let cmp = if signed_format then SGreater(saturated, third) else UInt(third) < UInt(saturated);
RawSelect(cmp, if mode == 5 then third else saturated, if mode == 5 then saturated else third)
} else saturated;
R_write(Dst(), result)
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).