Add expected state to case_addis_nonzero_r0 in alu_cases unit test
authorR Veera Kumar <vklr@vkten.in>
Tue, 23 Nov 2021 12:13:58 +0000 (17:43 +0530)
committerR Veera Kumar <vklr@vkten.in>
Tue, 23 Nov 2021 12:13:58 +0000 (17:43 +0530)
src/openpower/test/alu/alu_cases.py

index 3bde8e27131d3e3dcde2a07d8e5d3b59ec086124..091ebef9c922557268a5153b0d90ccac5f5e858f 100644 (file)
@@ -202,7 +202,13 @@ class ALUTestCase(TestAccumulatorBase):
             print(lst)
             initial_regs = [0] * 32
             initial_regs[0] = random.randint(0, (1 << 64)-1)
-            self.add_case(Program(lst, bigendian), initial_regs)
+            e = ExpectedState(pc=4)
+            e.intregs[0] = initial_regs[0]
+            if imm < 0:
+                e.intregs[3] = (imm + 2**48)<<16
+            else:
+                e.intregs[3] = imm << 16
+            self.add_case(Program(lst, bigendian), initial_regs, expected=e)
 
     def case_rand_imm(self):
         insns = ["addi", "addis", "subfic"]