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 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 1 | 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 |
| Rb | pred.not | pred | Rd | ||||||||||||||||||||||||||||
bits 63:48: 0101 1100 1110 0---
Runs execute_I2I with Form() 0.
| 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 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | cbuf.bank | cbuf.offset | |||||||||||||||||
| 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 |
| cbuf.offset | pred.not | pred | Rd | ||||||||||||||||||||||||||||
bits 63:48: 0100 1100 1110 0---
Runs execute_I2I with Form() 1.
| 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 | 0 | imm.sign | 1 | 1 | 1 | 0 | 0 | imm | ||||||||||||||||||
| 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 |
| imm | pred.not | pred | Rd | ||||||||||||||||||||||||||||
bits 63:48: 0011 100- 1110 0---
Runs execute_I2I with Form() 2.
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 |
|---|---|---|
| [50] | 50 | execute_I2I |
| [49] | 49 | execute_I2I |
| [47] | 47 | execute_I2I |
| [45] | 45 | execute_I2I |
| offset | 43:41 | execute_I2I |
| Rb | 27:20 | the right operand |
| pred.not | 19 | the decoder |
| pred | 18:16 | the decoder |
| s13 | 13 | execute_I2I |
| s12 | 12 | execute_I2I |
| src_size | 11:10 | execute_I2I |
| dst_size | 9:8 | execute_I2I |
| Rd | 7:0 | Dst() |
I2I: an integer's byte (41-43) or half of src_size (10-11), signed with 13, its absolute value (49) or negation (45), saturated (50) to the destination's size (8-9) and signedness (12), and cut to it
var value : bits(32) = RightOf(Form());
let src_size = UInt(Field(10, 2));
let dst_size = UInt(Field(8, 2));
let s13 = Field(13, 1) == 0b1;
let s12 = Field(12, 1) == 0b1;
if src_size < 2 then {
let offset = Bits32(to_bits(32, UInt(Field(41, 3)) * 8));
let width = Bits32(to_bits(32, 8 * 2 ^ src_size));
value = if s13 then Bits32(BitsS(value, offset, width)) else BitsU(value, offset, width)
};
if Field(49, 1) == 0b1 then {
let negative = Negative(value);
let absolute = 0x00000000 - value;
value = RawSelect(negative, absolute, value)
};
if Field(45, 1) == 0b1 then { value = 0x00000000 - value };
if Field(50, 1) == 0b1 & dst_size < 2 then {
let high = DIV(if s12 then 2147483647 else 4294967295, 2 ^ (32 - 8 * 2 ^ dst_size));
let hi = Bits32(to_bits(32, high));
if s13 then {
let negative = Negative(value);
if s12 then {
let lo = Bits32(not_vec(to_bits(32, high)));
let below = SGreater(lo, value);
value = RawSelect(below, lo, value)
} else { value = RawSelect(negative, 0x00000000, value) }
};
let above = if s13 & s12 then SGreater(value, hi) else UInt(hi) < UInt(value);
value = RawSelect(above, hi, value)
} else if Field(50, 1) == 0b1 & s12 != s13 then {
/* 32 bits saturate only across a change of signedness */
if s13 then { value = RawSelect(Negative(value), 0x00000000, value) } else {
let top = Bits32(0x7fffffff);
value = RawSelect(UInt(top) < UInt(value), top, value)
}
};
if dst_size < 2 then {
let width = Bits32(to_bits(32, 8 * 2 ^ dst_size));
value = BitsU(value, 0x00000000, width)
};
if Field(47, 1) == 0b1 then FlagsLogic(value);
R_write(Dst(), value)
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).