VTSTMSK

Tests

fixed bit field field the encoding fixes should be

Encoding

6362616059585756555453525150494847464544434241403938373635343332
01111predskipinvonceonlysyncstartdest_extsrc1_negsrc1_extsrc2_extprecvscomprepeat_countsign_testzero_testcrcomb_andmask_typedest_bank
313029282726252423222120191817161514131211109876543210
src1_banksrc2_bankdest_nwbenalu_selalu_opsrc1_nsrc2_n

bits 63:0: 0111 1xxx x-xx xxxx xxxx xxxx x-xx --xx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx

It is in a group of patterns that may match the same word: the decoder tries them in this order, and the first that matches decodes it: VPCK, VTST, VTSTMSK, VBW.

Runs execute_VTSTMSK with Form() 0.

Fields

FieldBitsThe Sail reads it in
pred58:56
skipinv55
onceonly53
syncstart52
dest_ext51Bit(51)
src1_neg50Bit(50)
src1_ext49Bit(49)
src2_ext48Bit(48)
prec47Bit(47)
vscomp46Bit(46)
repeat_count45:44
sign_test43:42Test
zero_test41:40Test
crcomb_and39
mask_type37:36execute_VTSTMSK
dest_bank33:32execute_VTSTMSK
src1_bank31:30TestSources
src2_bank29:28TestSources
dest_n27:21execute_VTSTMSK
wben20Bit(20)
alu_sel19:18execute_VTSTMSK
alu_op17:14execute_VTSTMSK
src1_n13:7TestSources
src2_n6:0TestSources

Operation Sail

VTSTMSK: the test's result as a mask into the destination: all ones (a float's 1.0, a signed type's largest) where it holds, else zero, in each component (of a vector test's four with mask type 2)

let sel = UInt(Field(18, 2));
let alu_op = UInt(Field(14, 4));
let op = TestOp(sel, alu_op);
let type = TestType(sel, alu_op, Bit(47));
if op == TO_INVALID | type == T_UNK then throw(Refuse("VTSTMSK of ALU %u operation %u", sel, alu_op));
let mask_type = UInt(Field(36, 2));
if mask_type == 3 then throw(Refuse("VTSTMSK of mask type 3"));
if Bit(20) == 0 then throw(Refuse("VTSTMSK without its write"));
TestSources(sel, type);
let doubled = sel == 0;
let four = doubled & mask_type == 2;
Dest(DEST, UInt(Field(21, 7)), UInt(Field(32, 2)), Bit(51), doubled, if doubled then 8 else 7);
SetType(DEST, type);
let n = Test(op, if op == TO_DP | four then 15 else 1);
if n == 0 then throw(Stop());
let kind = if IsFloatType(type) then K_FLOAT else if IsSignedType(type) then K_INT else K_UINT;
let zero = ZeroOf(kind);
let ones = if type == T_F16 | type == T_F32 then One() else if type == T_I8 then SConst(127)
           else if type == T_I16 then SConst(32767) else if type == T_I32 then SConst(2147483647)
           else if type == T_U8 then UConst(255) else if type == T_U16 then UConst(65535) else UConst(4294967295);
Reset(R, n, kind);
foreach (i from 0 to n - 1) Put(R, i, if TestAt(i) then ones else zero);
Store(DEST, R, 15, 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).