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 | 0 | 0 | 0 | 1 | pred | skipinv | src1_swiz[11:10] | syncstart | dest_ext | src1_swiz[9] | src1_ext | src2_ext | src2_swiz | nosched | mask | src1_mod | src2_mod | src1_swiz[8:7] | dest_bank | ||||||||||||
| 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 |
| src1_bank | src2_bank | dest_n | src1_swiz[6:0] | alu | src1_n | src2_n | |||||||||||||||||||||||||
bits 63:0: 0000 1xxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx
Its format is @nmad.
Runs execute_NMAD with Form() 0.
Its operation is 2 opcodes' (Form() tells them apart), so it may read the fields of their layouts too.
| Field | Bits | The Sail reads it in |
|---|---|---|
| pred | 58:56 | |
| skipinv | 55 | |
| src1_swiz | 54:53, 50, 35:34, 21:15 | execute_NMAD |
| syncstart | 52 | |
| dest_ext | 51 | Bit(51) |
| src1_ext | 49 | Bit(49) |
| src2_ext | 48 | Bit(48) |
| src2_swiz | 47:44 | execute_NMAD |
| nosched | 43 | |
| mask | 42:39 | execute_NMAD |
| src1_mod | 38:37 | execute_NMAD |
| src2_mod | 36 | Bit(36) |
| dest_bank | 33:32 | execute_NMAD |
| src1_bank | 31:30 | execute_NMAD |
| src2_bank | 29:28 | execute_NMAD |
| dest_n | 27:22 | execute_NMAD |
| alu | 14:12 | execute_NMAD |
| src1_n | 11:6 | execute_NMAD |
| src2_n | 5:0 | execute_NMAD |
V32NMAD and V16NMAD: the ALU operation alu of src1 and src2 (0 multiply, 1 add, 2 FRC: src1 - floor(src2), 3 and 4 the derivatives of src1, 5 min, 6 max), in each component the mask enables; 7 the dot product of all four, in each of them
let type = if Form() == 0 then T_F32 else T_F16;
let alu = UInt(Field(12, 3));
let mask = UInt(Field(39, 4));
Dest(DEST, UInt(Field(22, 6)), UInt(Field(32, 2)), Bit(51), 1, 7);
Src12(SRC1, UInt(Field(6, 6)), UInt(Field(30, 2)), Bit(49), 1, 7);
Src12(SRC2, UInt(Field(0, 6)), UInt(Field(28, 2)), Bit(48), 1, 7);
SetFlags(SRC1, Modifier(UInt(Field(37, 2))));
if Bit(36) == 1 then SetFlags(SRC2, F_ABS);
SetType(DEST, type);
SetType(SRC1, type);
SetType(SRC2, type);
Swizzle4(SRC1, UInt(Field(53, 2) @ Field(50, 1) @ Field(34, 2) @ Field(15, 7)));
Vec34Swizzle(SRC2, UInt(Field(44, 4)), 0, 2);
let source_mask = if alu == 7 then 15 else mask;
Load(A, SRC1, source_mask, 0);
Load(B, SRC2, source_mask, 0);
if Failed() then throw(Stop());
Reset(R, Count(A), K_FLOAT);
if alu != 7 then {
foreach (i from 0 to Count(A) - 1) {
let a = At(A, i);
let b = At(B, i);
Put(R, i, match alu { 0 => FMul(a, b), 1 => FAdd(a, b), 2 => FSub(a, FRound(1, b)), 3 => FDdx(a),
4 => FDdy(a), 5 => FMin(a, b), _ => FMax(a, b) })
}
} else {
var sum : bits(32) = FMul(At(A, 0), At(B, 0));
foreach (i from 1 to Count(A) - 1) { sum = FFma(At(A, i), At(B, i), sum) };
Reset(R, Popcount4(mask), K_FLOAT);
foreach (i from 0 to Popcount4(mask) - 1) Put(R, i, sum)
};
Store(DEST, R, mask, 0)
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 Vita3K's usse_translator_entry.cpp (GPL-2.0-or-later).