From: Jacob Lifshay Date: Tue, 25 Apr 2023 06:49:19 +0000 (-0700) Subject: replace min/max[su][.] with minmax[.] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6b4e7976c486d18df659c3ea2678317dabb5dbe7;p=openpower-isa.git replace min/max[su][.] with minmax[.] --- diff --git a/media/video/av1/src/ppc/cdef_tmpl_svp64_real.s b/media/video/av1/src/ppc/cdef_tmpl_svp64_real.s index 12b7fa3c..db1fd24b 100644 --- a/media/video/av1/src/ppc/cdef_tmpl_svp64_real.s +++ b/media/video/av1/src/ppc/cdef_tmpl_svp64_real.s @@ -445,7 +445,7 @@ cdef_find_dir_svp64_real: mr max, cost+5 setvl 0,0,8,0,1,1 # Set VL to 8 elements - #sv.maxs/mr max, max, *cost + #sv.minmax/mr max, max, *cost, 3 # MMM=maxs sv.cmp 0, 0, *cost, max svstep retval, 5, 1 # sv.addi/m=eq retval,*,0 diff --git a/openpower/isa/av.mdwn b/openpower/isa/av.mdwn index 9246b8f6..94c3e1c8 100644 --- a/openpower/isa/av.mdwn +++ b/openpower/isa/av.mdwn @@ -2,90 +2,92 @@ -# DRAFT Fixed Point Signed Max (Rc=1) +# DRAFT Minimum/Maximum (Rc=1) -X-Form +MM-Form -* maxs. RT,RA,RB (Rc=1) +* minmax. RT,RA,RB,MMM (Rc=1) Pseudo-code: - a <- (RA) + a <- (RA|0) 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] + if MMM[0] then # word mode + # shift left by XLEN/2 to make the dword comparison + # do word comparison of the original inputs + a <- a[XLEN/2:XLEN-1] || [0] * XLEN/2 + b <- b[XLEN/2:XLEN-1] || [0] * XLEN/2 + if MMM[1] then # signed mode + # invert sign bits to make the unsigned comparison + # do signed comparison of the original inputs + a[0] <- ¬a[0] + b[0] <- ¬b[0] + # if Rc = 1 then store the result of comparing a and b to CR0 + if Rc = 1 then + if a u b then + CR0 <- 0b010 || XER[SO] + if MMM[2] then # max mode + # swap a and b to make the less than comparison do + # greater than comparison of the original inputs + t <- a + a <- b + b <- t + # store the entire selected source (even in word mode) + # if Rc = 1 then store the result of comparing a and b to CR0 + if a (RB) then RT <- (RA) - else RT <- (RB) + a <- (RA|0) + b <- (RB) + if MMM[0] then # word mode + # shift left by XLEN/2 to make the dword comparison + # do word comparison of the original inputs + a <- a[XLEN/2:XLEN-1] || [0] * XLEN/2 + b <- b[XLEN/2:XLEN-1] || [0] * XLEN/2 + if MMM[1] then # signed mode + # invert sign bits to make the unsigned comparison + # do signed comparison of the original inputs + a[0] <- ¬a[0] + b[0] <- ¬b[0] + # if Rc = 1 then store the result of comparing a and b to CR0 + # if Rc = 1 then + # if a u b then + # CR0 <- 0b010 || XER[SO] + if MMM[2] then # max mode + # swap a and b to make the less than comparison do + # greater than comparison of the original inputs + t <- a + a <- b + b <- t + # store the entire selected source (even in word mode) + # if Rc = 1 then store the result of comparing a and b to CR0 + if a u (RB) then RT <- (RA) - else RT <- (RB) - -Special Registers Altered: - - CR0 (if Rc=1) - -# DRAFT Fixed Point Signed Min - -X-Form - -* mins RT,RA,RB (Rc=0) -* mins. RT,RA,RB (Rc=1) - -Pseudo-code: - - if (RA) < (RB) then RT <- (RA) - else RT <- (RB) - -Special Registers Altered: - - CR0 (if Rc=1) - -# DRAFT Fixed Point Unsigned Min - -X-Form - -* minu RT,RA,RB (Rc=0) -* minu. RT,RA,RB (Rc=1) - -Pseudo-code: - - if (RA) s r2 self.add_case(Program(lst, bigendian), initial_regs, expected=e) def case_0_maxu(self): - lst = ["maxu 3, 1, 2"] + lst = ["minmax 3, 1, 2, 1"] lst = list(SVP64Asm(lst, bigendian)) initial_regs = [0] * 32 @@ -170,7 +170,7 @@ class AVTestCase(TestAccumulatorBase): def case_5_minu_(self): """min +ve numbers """ - lst = [f"minu. 3, 1, 2"] + lst = [f"minmax. 3, 1, 2, 0"] lst = list(SVP64Asm(lst, bigendian)) initial_regs = [0] * 32 @@ -180,7 +180,7 @@ class AVTestCase(TestAccumulatorBase): e.intregs[1] = 1 e.intregs[2] = 0x8000_0000_0000_0000 e.intregs[3] = min(e.intregs[1], e.intregs[2]) - e.crregs[0] = 0x4 + e.crregs[0] = 0x8 # r1