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 | 0 | 1 | 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 | Ra | Rd | |||||||||||||||||||||||||||
bits 63:48: 0101 1011 1100 ----
Runs execute_PRMT 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 | 1 | 0 | 0 | 1 | 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 | Ra | Rd | |||||||||||||||||||||||||||
bits 63:48: 0101 0011 1100 ----
Runs execute_PRMT 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 | 1 | 0 | 0 | 1 | 0 | 1 | 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 | Ra | Rd | |||||||||||||||||||||||||||
bits 63:48: 0100 1011 1100 ----
Runs execute_PRMT with Form() 2.
| 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 | 0 | 1 | 1 | imm.sign | 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 | Ra | Rd | |||||||||||||||||||||||||||
bits 63:48: 0011 011- 1100 ----
Runs execute_PRMT 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 |
|---|---|---|
| [56] | 56 | execute_PRMT |
| mode | 50:48 | execute_PRMT |
| selector | 46:39 | execute_PRMT |
| [38:20] | 38:20 | execute_PRMT |
| Rb | 27:20 | RegB() |
| pred.not | 19 | the decoder |
| pred | 18:16 | the decoder |
| Ra | 15:8 | RegA() |
| Rd | 7:0 | Dst() |
PRMT: Bytes 0-3 are Ra's and 4-7 C's (Rc at bit 39, or the constant buffer word in the RC form). The selector (Rb, Rc in the RC form, the constant buffer word, or the immediate) picks each result byte: in the index mode (0) its nibble i, whose bit 3 replicates the byte's sign; in the others by c, its low two bits, as PTX's prmt defines F4E (1), B4E (2), RC8 (3), ECL (4), ECR (5) and RC16 (6)
let f = Form();
let low = R_read(RegA());
let selector = if f == 0 then R_read(RegB()) else if f == 1 then R_read(UInt(Field(39, 8)))
else if f == 2 then CbufWord()
else Bits32(ZeroExtend(Field(20, 19), 32) | (if Field(56, 1) == 0b1 then 0xfff80000 else 0x00000000));
let high = if f == 1 then CbufWord() else R_read(UInt(Field(39, 8)));
let mode = UInt(Field(48, 3));
var result : bits(32) = 0x00000000;
let three = Bits32(0x00000003);
let sel = selector & three;
foreach (k from 0 to 3) {
let position = Bits32(to_bits(32, k));
let nibble = if mode == 0 then (selector >> to_bits(32, 4 * k)) & 0x0000000f else 0x00000000;
let idx = match mode {
0 => nibble,
1 => sel + position,
2 => sel - position,
3 => sel,
4 => if UInt(sel) < UInt(position) then position else sel,
5 => if UInt(sel) < UInt(position) then sel else position,
_ => ((sel & 0x00000001) << 1) + to_bits(32, MOD(k, 2))
};
let byte0 = PrmtByte(low, high, idx);
let byte = if mode == 0 then {
/* a nibble's bit 3 replicates the byte's sign across it */
let replicate = (nibble & 0x00000008) != 0x00000000;
let negative = (byte0 & 0x00000080) != 0x00000000;
if replicate then (if negative then 0x000000ff else 0x00000000) else byte0
} else byte0;
result = result | (byte << to_bits(32, 8 * k))
};
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).