bug 1236: add extra argument to svstep: RA.
[openpower-isa.git] / openpower / isa / svfixedarith.mdwn
index b3728bf554828177bf46ec59f732c19b91c368ee..6ce79fb69925bef2faef666c0a251e860ec3e3b0 100644 (file)
@@ -1,4 +1,4 @@
-# [DRAFT] Multiply and Add Extended Doubleword
+# [DRAFT] Multiply and Add Extended Doubleword Unsigned
 
 VA-Form
 
@@ -7,12 +7,38 @@ VA-Form
 Pseudo-code:
 
     <!-- SVP64: RA,RB,RC,RT have EXTRA2, RS as below
-    <!-- bit 8 of EXTRA is clear: RS.[s|v]=RT.[s|v]+MAXVL
-    <!-- bit 8 of EXTRA is set  : RS.[s|v]=RC.[s|v]
-    prod[0:127] <- (RA) * (RB)
-    sum[0:127] <- ([0] * 64 || (RC)) + prod
-    RT <- sum[64:127]
-    RS <- sum[0:63]
+    <!-- bit 8 of EXTRA is set  : RS.[s|v]=RT.[s|v]+MAXVL
+    <!-- bit 8 of EXTRA is clear: RS.[s|v]=RC.[s|v]
+    prod[0:2*XLEN-1] <- (RA) * (RB)
+    sum[0:2*XLEN-1] <- ([0] * XLEN || (RC)) + prod
+    RT <- sum[XLEN:2*XLEN-1]
+    RS <- sum[0:XLEN-1]
+
+Special Registers Altered:
+
+    None
+
+# [DRAFT] Multiply and Add Extended Doubleword Unsigned Signed
+
+VA-Form
+
+* maddedus RT,RA,RB,RC
+
+Pseudo-code:
+
+    <!-- SVP64: RA,RB,RC,RT have EXTRA2, RS as below
+    <!-- bit 8 of EXTRA is set  : RS.[s|v]=RT.[s|v]+MAXVL
+    <!-- bit 8 of EXTRA is clear: RS.[s|v]=RC.[s|v]
+    <!-- no MULUS, so do it manually -->
+    prod[0:XLEN*2-1] <- [0] * (XLEN * 2)
+    if (RB)[0] != 0 then
+        prod[0:XLEN*2-1] <- -((RA) * -(RB))
+    else
+        prod[0:XLEN*2-1] <- (RA) * (RB)
+    <!-- no EXTS2XL, so do it manually -->
+    sum[0:XLEN*2-1] <- prod + (EXTSXL((RC)[0], 1) || (RC))
+    RT <- sum[XLEN:2*XLEN-1]
+    RS <- sum[0:XLEN-1]
 
 Special Registers Altered:
 
@@ -27,8 +53,8 @@ VA-Form
 Pseudo-code:
 
     <!-- SVP64: RA,RB,RC,RT have EXTRA2, RS as below
-    <!-- bit 8 of EXTRA is clear: RS.[s|v]=RT.[s|v]+MAXVL
-    <!-- bit 8 of EXTRA is set  : RS.[s|v]=RC.[s|v]
+    <!-- bit 8 of EXTRA is set  : RS.[s|v]=RT.[s|v]+MAXVL
+    <!-- bit 8 of EXTRA is clear: RS.[s|v]=RC.[s|v]
     if ((RC) <u (RB)) & ((RB) != [0]*XLEN) then
         dividend[0:(XLEN*2)-1] <- (RC) || (RA)
         divisor[0:(XLEN*2)-1] <- [0]*XLEN || (RB)
@@ -44,7 +70,7 @@ Pseudo-code:
 
 Special Registers Altered:
 
-    None
+    XER.OV
 
 # [DRAFT] Double-width Shift Left Doubleword
 
@@ -55,13 +81,14 @@ VA2-Form
 
 Pseudo-code:
 
-    hi <- (RC)
-    lo <- (RA)
-    sh <- (RB)
-    n <- sh[58:63]
-    mask[0:63] <- MASK(n, 63)
-    v[0:63] <- (hi & mask) | (lo & ¬mask)
-    RT <- ROTL64(v, n)
+    n <- (RB)[58:63]
+    v <- ROTL64((RA), n)
+    mask <- MASK(0, 63-n)
+    RT <- (v[0:63] & mask) | ((RC) & ¬mask)
+    RS <- v[0:63] & ¬mask
+    overflow <- 0             # relevant only when Rc=1
+    if RS != [0]*64 then
+        overflow <- 1         # relevant only when Rc=1
 
 Special Registers Altered:
 
@@ -76,13 +103,14 @@ VA2-Form
 
 Pseudo-code:
 
-    hi <- (RC)
-    lo <- (RA)
-    sh <- (RB)
-    n <- sh[58:63]
-    mask[0:63] <- MASK(0, 63 - n)
-    v[0:63] <- (hi & ¬mask) | (lo & mask)
-    RT <- ROTL64(v, 64 - n)
+    n <- (RB)[58:63]
+    v <- ROTL64((RA), 64-n)
+    mask <- MASK(n, 63)
+    RT <- (v[0:63] & mask) | ((RC) & ¬mask)
+    RS <- v[0:63] & ¬mask
+    overflow <- 0             # relevant only when Rc=1
+    if RS != [0]*64 then
+        overflow <- 1         # relevant only when Rc=1
 
 Special Registers Altered: