P2R

Integer, logic, video and predicate instructions

fixed bit field field the encoding fixes should be

P2R (reg)

6362616059585756555453525150494847464544434241403938373635343332
0101110011101
313029282726252423222120191817161514131211109876543210
Rbpred.notpredRaRd

bits 63:48: 0101 1100 1110 1---

Runs execute_P2R with Form() 0.

P2R (cbuf)

6362616059585756555453525150494847464544434241403938373635343332
0100110011101cbuf.bankcbuf.offset
313029282726252423222120191817161514131211109876543210
cbuf.offsetpred.notpredRaRd

bits 63:48: 0100 1100 1110 1---

Runs execute_P2R with Form() 1.

P2R (imm)

6362616059585756555453525150494847464544434241403938373635343332
0011100011101imm
313029282726252423222120191817161514131211109876543210
immpred.notpredRaRd

bits 63:48: 0011 1000 1110 1---

Runs execute_P2R with Form() 2.

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
shift42:41execute_P2R
flags40execute_P2R
Rb27:20the right operand
pred.not19the decoder
pred18:16the decoder
Ra15:8RegA()
Rd7:0Dst()

Operation Sail

P2R: a's bits of the mask (its low byte but of the immediate), at the byte 41-42 selects, from P0-P6 or with bit 40 the flags z, s, c, o

let mask0 = RightOf(Form());
let mask = if Form() != 2 then mask0 & 0x000000ff else mask0;
let flags = Field(40, 1) == 0b1;
var bits : bits(32) = 0x00000000;
foreach (p from 0 to (if flags then 3 else 6)) {
    let value = if flags then FlagRead(p) else PredRead(p, 0);
    let bit = RawSelect(value, to_bits(32, 2 ^ p), 0x00000000);
    bits = bits | bit
};
let shift = Bits32(to_bits(32, UInt(Field(41, 2)) * 8));
let shifted_mask = mask << shift;
let base = R_read(RegA()) & not_vec(shifted_mask);
let picked = bits & mask;
R_write(Dst(), base | (picked << shift))

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