SHR

Integer, logic, video and predicate instructions

fixed bit field field the encoding fixes should be

SHR (reg)

6362616059585756555453525150494847464544434241403938373635343332
0101110000101
313029282726252423222120191817161514131211109876543210
Rbpred.notpredRaRd

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

Runs execute_SHR with Form() 0.

SHR (cbuf)

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

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

Runs execute_SHR with Form() 1.

SHR (imm)

6362616059585756555453525150494847464544434241403938373635343332
0011100imm.sign00101imm
313029282726252423222120191817161514131211109876543210
immpred.notpredRaRd

bits 63:48: 0011 100- 0010 1---

Runs execute_SHR 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
value48execute_SHR
source40execute_SHR
wrap39execute_SHR
Rb27:20the right operand
pred.not19the decoder
pred18:16the decoder
Ra15:8RegA()
Rd7:0Dst()

Operation Sail

SHR: a >> b, arithmetic with 48 (the count clamped to 31 unless wrapped, 39), logical else (0 from 32 on unless wrapped); a bit-reversed first with 40

let shift = RightOf(Form());
let source0 = R_read(RegA());
let source = if Field(40, 1) == 0b1 then BitReverse32(source0) else source0;
let safe0 = shift & 0x0000001f;
let wrap = Field(39, 1) == 0b1;
let value = if Field(48, 1) == 0b1 then {
    let safe = if not_bool(wrap) then (if UInt(shift) < 31 then shift else 0x0000001f) else safe0;
    AshrS(source, safe)
} else source >> safe0;
if Field(48, 1) == 0b0 & not_bool(wrap) then {
    let valid = UInt(shift) < 32;
    R_write(Dst(), if valid then value else 0x00000000)
} else 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).