bmask,NORMAL,,1P,EXTRA3,NO,d:RT,s:RA,s:RB,0,RA,RB,0,RT,0,0,0
cntlzdm,NORMAL,,1P,EXTRA3,NO,d:RT,s:RA,s:RB,0,RS,RB,0,RA,0,0,0
addex,NORMAL,,1P,EXTRA3,NO,d:RT,s:RA,s:RB,0,RA,RB,0,RT,0,0,0
+cfuged,NORMAL,,1P,EXTRA3,NO,d:RT,s:RA,s:RB,0,RS,RB,0,RA,0,0,0
bpermd,NORMAL,,1P,EXTRA3,NO,d:RA,s:RS,s:RB,0,RS,RB,0,RA,0,0,0
modud,NORMAL,,1P,EXTRA3,NO,d:RT,s:RA,s:RB,0,RA,RB,0,RT,0,0,0
moduw,NORMAL,,1P,EXTRA3,NO,d:RT,s:RA,s:RB,0,RA,RB,0,RT,0,0,0
0b0010111011,LOGICAL,OP_BYTEREV,RS,NONE,NONE,RA,NONE,NONE,0,0,ZERO,0,NONE,0,0,0,0,0,0,NONE,0,0,brd,X,,0,
0b0100111010,ALU,OP_CBCDTD,RS,NONE,NONE,RA,NONE,NONE,0,0,ZERO,0,NONE,0,0,0,0,0,0,NONE,0,0,cbcdtd,X,,,
0b0100011010,ALU,OP_CDTBCD,RS,NONE,NONE,RA,NONE,NONE,1,0,ZERO,0,NONE,0,0,0,0,0,0,NONE,0,0,cdtbcd,X,,,
+0b0011011100,LOGICAL,OP_CFUGE,RS,RB,NONE,RA,NONE,NONE,0,0,ZERO,0,NONE,0,0,0,0,0,0,NONE,0,0,cfuged,X,,0,
0b0011111100,LOGICAL,OP_BPERM,RS,RB,NONE,RA,NONE,NONE,0,0,ZERO,0,NONE,0,0,0,0,0,0,NONE,0,0,bpermd,X,,,
0b0000000000,ALU,OP_CMP,RA,RB,NONE,NONE,NONE,BF,1,0,ONE,0,NONE,0,0,0,0,0,1,NONE,0,0,cmp,X,,,
0b0111111100,LOGICAL,OP_CMPB,RS,RB,NONE,RA,NONE,NONE,0,0,ZERO,0,NONE,0,0,0,0,0,0,NONE,0,0,cmpb,X,,,
initial_regs[2] = random.randint(0, (1 << 64)-1)
self.add_case(Program(lst, bigendian), initial_regs)
+ def case_cfuged(self):
+ prog = Program(list(SVP64Asm(["cfuged 3,4,5"])), bigendian)
+ for case_idx in range(200):
+ gprs = [0] * 32
+ gprs[4] = hash_256(f"cfuged {case_idx} r4") % 2**64
+ gprs[5] = hash_256(f"cfuged {case_idx} r5") % 2**64
+ e = ExpectedState(pc=4, int_regs=gprs)
+ zeros = []
+ ones = []
+ for i in range(64):
+ bit = 1 << i
+ if gprs[5] & bit:
+ ones.append(bool(gprs[4] & bit))
+ else:
+ zeros.append(bool(gprs[4] & bit))
+ bits = ones + zeros
+ e.intregs[3] = 0
+ for i, v in enumerate(bits):
+ e.intregs[3] |= v << i
+ with self.subTest(
+ case_idx=case_idx, RS_in=hex(gprs[4]),
+ RB_in=hex(gprs[5]), expected_RA=hex(e.intregs[3])):
+ self.add_case(prog, gprs, expected=e)
+
def case_cntlzdm(self):
prog = Program(list(SVP64Asm(["cntlzdm 3,4,5"])), bigendian)
for case_idx in range(200):