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 | 1 | 1 | 1 | |||||||||||||||||||
| 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 |
| pred.not | pred | Ra | Rd | ||||||||||||||||||||||||||||
bits 63:48: 0101 1011 1111 1---
Runs execute_SHF 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 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | ||||||||||||||||||||
| 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 |
| pred.not | pred | Ra | Rd | ||||||||||||||||||||||||||||
bits 63:48: 0011 011- 1111 1---
Runs execute_SHF 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 | 1 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | |||||||||||||||||||
| 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 |
| pred.not | pred | Ra | Rd | ||||||||||||||||||||||||||||
bits 63:48: 0101 1100 1111 1---
Runs execute_SHF 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 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | ||||||||||||||||||||
| 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 |
| pred.not | pred | Ra | Rd | ||||||||||||||||||||||||||||
bits 63:48: 0011 100- 1111 1---
Runs execute_SHF 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 |
|---|---|---|
| safe | 50 | execute_SHF |
| high | 46:39 | execute_SHF |
| longest | 38:37 | execute_SHF |
| shift | 38:20 | execute_SHF |
| pred.not | 19 | the decoder |
| pred | 18:16 | the decoder |
| Ra | 15:8 | RegA() |
| Rd | 7:0 | Dst() |
SHF: the funnel shift of (c:a) by b, left or right, the count wrapped (50) or clamped to the type's (37-38: 2 and 3 the 64-bit ones, 3 signed)
let f = Form(); /* 0 LR, 1 LI, 2 RR, 3 RI */
let left_shift = f <= 1;
let shift = if f == 0 | f == 2 then R_read(RegB()) else Bits32(ZeroExtend(Field(20, 19), 32));
let longest = UInt(Field(37, 2)) >= 2;
let limit = Bits32(if longest then 0x0000003f else 0x00000020);
let wrapped = shift & (if longest then 0x0000003f else 0x0000001f);
let safe = if Field(50, 1) == 0b1 then wrapped else (if UInt(limit) < UInt(shift) then limit else shift);
let low = R_read(RegA());
let high = R_read(UInt(Field(39, 8)));
let small = safe & 0x0000001f;
let left = high << small;
let reverse = (0x00000020 - safe) & 0x0000001f;
let right = low >> reverse;
let combined0 = left | right;
let combined = if left_shift then (if safe == 0x00000000 then high else combined0) else {
let low_part = low >> small;
let high_part = high << reverse;
let c = low_part | high_part;
if safe == 0x00000000 then low else c
};
let long_shift = (safe - 0x00000020) & 0x0000001f;
let long_value = if left_shift then low << long_shift else if Field(37, 2) == 0b11 then AshrS(high, long_shift)
else high >> long_shift;
R_write(Dst(), if UInt(safe) < 32 then combined else long_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).