Shorten expected state code for case_rand in alu_cases unit test
authorR Veera Kumar <vklr@vkten.in>
Fri, 26 Nov 2021 02:53:12 +0000 (08:23 +0530)
committerR Veera Kumar <vklr@vkten.in>
Fri, 26 Nov 2021 02:53:12 +0000 (08:23 +0530)
src/openpower/test/alu/alu_cases.py

index b2d9925f1948ee498c2f3c4da0973515a08cc673..4ece2cd8fe305bc82b35871184324cbcfa55542e 100644 (file)
@@ -84,16 +84,10 @@ class ALUTestCase(TestAccumulatorBase):
             e.intregs[2] = initial_regs[2]
             if choice == "add":
                 result = initial_regs[1] + initial_regs[2]
-                if result < 0:
-                    e.intregs[3] = (result + 2**64) & ((2**64)-1)
-                else:
-                    e.intregs[3] = result & ((2**64)-1)
+                e.intregs[3] = result & ((2**64)-1)
             elif choice == "add.":
                 result = initial_regs[1] + initial_regs[2]
-                if result < 0:
-                    e.intregs[3] = (result + 2**64) & ((2**64)-1)
-                else:
-                    e.intregs[3] = result & ((2**64)-1)
+                e.intregs[3] = result & ((2**64)-1)
                 eq = 0
                 gt = 0
                 le = 0
@@ -106,10 +100,7 @@ class ALUTestCase(TestAccumulatorBase):
                 e.crregs[0] = (eq<<1) | (gt<<2) | (le<<3)
             elif choice == "subf":
                 result = ~initial_regs[1] + initial_regs[2] + 1
-                if result < 0:
-                    e.intregs[3] = (result + 2**64) & ((2**64)-1)
-                else:
-                    e.intregs[3] = result & ((2**64)-1)
+                e.intregs[3] = result & ((2**64)-1)
 
             self.add_case(Program(lst, bigendian), initial_regs, expected=e)