I2I

Integer, logic, video and predicate instructions

fixed bit field field the encoding fixes should be

I2I (reg)

6362616059585756555453525150494847464544434241403938373635343332
0101110011100
313029282726252423222120191817161514131211109876543210
Rbpred.notpredRd

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

Runs execute_I2I with Form() 0.

I2I (cbuf)

6362616059585756555453525150494847464544434241403938373635343332
0100110011100cbuf.bankcbuf.offset
313029282726252423222120191817161514131211109876543210
cbuf.offsetpred.notpredRd

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

Runs execute_I2I with Form() 1.

I2I (imm)

6362616059585756555453525150494847464544434241403938373635343332
0011100imm.sign11100imm
313029282726252423222120191817161514131211109876543210
immpred.notpredRd

bits 63:48: 0011 100- 1110 0---

Runs execute_I2I 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
[50]50execute_I2I
[49]49execute_I2I
[47]47execute_I2I
[45]45execute_I2I
offset43:41execute_I2I
Rb27:20the right operand
pred.not19the decoder
pred18:16the decoder
s1313execute_I2I
s1212execute_I2I
src_size11:10execute_I2I
dst_size9:8execute_I2I
Rd7:0Dst()

Operation Sail

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