Short the code of case_rand_imm
authorR Veera Kumar <vklr@vkten.in>
Thu, 25 Nov 2021 01:21:23 +0000 (06:51 +0530)
committerR Veera Kumar <vklr@vkten.in>
Thu, 25 Nov 2021 01:21:23 +0000 (06:51 +0530)
src/openpower/test/alu/alu_cases.py

index 4d93fe9f507472b350b2f26aaf696b76ea0af333..b78f411fde9bf76c89b8bc7bbf12fd1f2fc1ffa8 100644 (file)
@@ -257,10 +257,7 @@ class ALUTestCase(TestAccumulatorBase):
             e.intregs[1] = initial_regs[1]
             if choice == "addi":
                 result = initial_regs[1] + imm
-                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 == "addis":
                 result = initial_regs[1] + (imm<<16)
                 if result < 0:
@@ -269,10 +266,9 @@ class ALUTestCase(TestAccumulatorBase):
                     e.intregs[3] = result & ((2**64)-1)
             elif choice == "subfic":
                 result = ~initial_regs[1] + imm + 1
-                if imm >= 0:
-                    value = (~initial_regs[1]+2**64) + (imm) + 1
-                else:
-                    value = (~initial_regs[1]+2**64) + (imm+2**64) + 1
+                value = (~initial_regs[1]+2**64) + (imm) + 1
+                if imm < 0:
+                    value =+ 2**64
                 carry_out = value & (1<<64) != 0
                 if imm >= 0:
                     carry_out32 = (((~initial_regs[1]+2**64) & 0xffff_ffff) + \