<!-- https://libre-soc.org/openpower/sv/bitmanip/ -->
<!-- https://libre-soc.org/openpower/sv/av_opcodes/ -->
+# DRAFT Fixed Point Signed Max (Rc=1)
+
+X-Form
+
+* maxs. RT,RA,RB (Rc=1)
+
+Pseudo-code:
+
+ a <- (RA)
+ b <- (RB)
+ if a > b then RT <- a
+ else RT <- b
+ if a < b then c <- 0b100
+ else if a > b then c <- 0b010
+ else c <- 0b001
+ CR0 <- c || XER[SO]
+
+Special Registers Altered:
+
+ CR0 (if Rc=1)
+
# DRAFT Fixed Point Signed Max
X-Form
* maxs RT,RA,RB (Rc=0)
-* maxs. RT,RA,RB (Rc=1)
Pseudo-code:
Special Registers Altered:
- CR0 (if Rc=1)
+ None
# DRAFT Fixed Point Unsigned Max
# look up instruction in ISA.instrs, prepare namespace
if ins_name == 'pcdec': # grrrr yes there are others ("stbcx." etc.)
info = self.instrs[ins_name+"."]
+ elif asmop[-1] == '.' and asmop in self.instrs:
+ info = self.instrs[asmop]
else:
info = self.instrs[ins_name]
yield from self.prep_namespace(ins_name, info.form, info.op_fields,
e.intregs[1] = 0xc523e996a8ff6215
e.intregs[2] = 0
e.intregs[3] = 0
- e.crregs[0] = 0x2 # RT is zero
+ e.crregs[0] = 0x8 # RB greater (arithmeticslly)
self.add_case(Program(lst, bigendian), initial_regs, expected=e)
def case_4_maxs_(self):
e.crregs[0] = 0x4 # RT is +ve
self.add_case(Program(lst, bigendian), initial_regs, expected=e)
+ def case_6_maxs_(self):
+ lst = [f"maxs. 3, 1, 2"]
+ lst = list(SVP64Asm(lst, bigendian))
+
+ initial_regs = [0] * 32
+ initial_regs[1] = 0x8000_0000_0000_0000
+ initial_regs[2] = 0x8000_0000_0000_0000
+ e = ExpectedState(pc=4)
+ e.intregs[1] = 0x8000_0000_0000_0000
+ e.intregs[2] = 0x8000_0000_0000_0000
+ e.intregs[3] = 0x8000_0000_0000_0000
+ e.crregs[0] = 0x2 # values are equal
+ self.add_case(Program(lst, bigendian), initial_regs, expected=e)
+
def case_0_mins(self):
lst = ["mins 3, 1, 2"]
lst = list(SVP64Asm(lst, bigendian))