VMAD2

Vector float instructions

fixed bit field field the encoding fixes should be

Encoding

6362616059585756555453525150494847464544434241403938373635343332
00000dat_fmtpredskipinvsrc0_swiz2syncstartsrc0_abssrc1_extsrc2_extsrc2_swizsrc1_swiz2noschedmasksrc1_modsrc2_modsrc0_bankdest_bank
313029282726252423222120191817161514131211109876543210
src1_banksrc2_bankdest_nsrc1_swiz01src0_swiz01src0_nsrc1_nsrc2_n

bits 63:0: 0000 0xxx x-xx -xxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx

Runs execute_VMAD2 with Form() 0.

Fields

FieldBitsThe Sail reads it in
dat_fmt58Bit(58)
pred57:56
skipinv55
src0_swiz253Bit(53)
syncstart52
src0_abs50Bit(50)
src1_ext49Bit(49)
src2_ext48Bit(48)
src2_swiz47:45execute_VMAD2
src1_swiz244Bit(44)
nosched43
mask42:39execute_VMAD2
src1_mod38:37execute_VMAD2
src2_mod36:35execute_VMAD2
src0_bank34Bit(34)
dest_bank33:32execute_VMAD2
src1_bank31:30execute_VMAD2
src2_bank29:28execute_VMAD2
dest_n27:22execute_VMAD2
src1_swiz0121:20execute_VMAD2
src0_swiz0119:18execute_VMAD2
src0_n17:12execute_VMAD2
src1_n11:6execute_VMAD2
src2_n5:0execute_VMAD2

Operation Sail

VMAD2: src0 * src1 + src2 rounded once, of the components the mask enables

let f16 = Bit(58);
let type = if f16 == 1 then T_F16 else T_F32;
Dest(DEST, UInt(Field(22, 6)), UInt(Field(32, 2)), 0, 1, 7);
Src0(SRC0, UInt(Field(12, 6)), Bit(34), 0, 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);
let mask = WriteMask(DEST, UInt(Field(39, 4)), f16);
SetType(DEST, type);
SetType(SRC0, type);
SetType(SRC1, type);
SetType(SRC2, type);
SetSwizzleCode(SRC0, Vmad2Swizzle(0, UInt(Field(18, 2)) + 4 * Bit(53)));
SetSwizzleCode(SRC1, Vmad2Swizzle(1, UInt(Field(20, 2)) + 4 * Bit(44)));
SetSwizzleCode(SRC2, Vmad2Swizzle(2, UInt(Field(45, 3))));
if Bit(50) == 1 then AddFlags(SRC0, F_ABS);
SetFlags(SRC1, Modifier(UInt(Field(37, 2))));
SetFlags(SRC2, Modifier(UInt(Field(35, 2))));
Load(A, SRC0, mask, 0);
Load(B, SRC1, mask, 0);
Load(C, SRC2, mask, 0);
if Failed() then throw(Stop());
Reset(R, Count(A), K_FLOAT);
foreach (i from 0 to Count(A) - 1) Put(R, i, FFma(At(A, i), At(B, i), At(C, i)));
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).