bug 1236: add extra argument to svstep: RA.
[openpower-isa.git] / openpower / isa / bitmanip.mdwn
index 830962c9ed6cea423a837fc077cce23c904f6682..1f8081d7a2df09c165c982f668f52dc08f4fdec4 100644 (file)
 <!-- https://libre-soc.org/openpower/sv/bitmanip/ -->
 <!-- These instructions are *not yet official* -->
 
-# Ternary Bitwise Logic Immediate
-
-TLI-Form
-
-* ternlogi RT,RA,RB,TLI (Rc=0)
-* ternlogi. RT,RA,RB,TLI (Rc=1)
-
-Pseudo-code:
-
-    result <- [0] * XLEN
-    do i = 0 to XLEN - 1
-      idx <- (RT)[i] || (RA)[i] || (RB)[i]
-      result[i] <- TLI[7-idx]
-    RT <- result
-
-Special Registers Altered:
-
-    CR0                    (if Rc=1)
-
-# Generalized Bit-Reverse
+# Gather instruction
 
 X-Form
 
-* grev RT,RA,RB (Rc=0)
-* grev. RT,RA,RB (Rc=1)
+* gbbd RT,RA
 
 Pseudo-code:
 
-    result <- [0] * XLEN
-    b <- EXTZ64(RB)
-    do i = 0 to XLEN - 1
-      idx <- b[64-log2(XLEN):63] ^ i
-      result[i] <- (RA)[idx]
+    result <- [0] * 64
+    do j = 0 to 7
+        do k = 0 to 7
+            b <- (RA)[k*8+j]
+            result[j*8+k] <- b
     RT <- result
 
 Special Registers Altered:
 
     CR0                    (if Rc=1)
 
-# Generalized Bit-Reverse Immediate
+# Ternary Bitwise Logic Immediate
 
-XB-Form
+TLI-Form
 
-* grevi RT,RA,XBI (Rc=0)
-* grevi. RT,RA,XBI (Rc=1)
+* ternlogi RT,RA,RB,TLI (Rc=0)
+* ternlogi. RT,RA,RB,TLI (Rc=1)
 
 Pseudo-code:
 
     result <- [0] * XLEN
     do i = 0 to XLEN - 1
-      idx <- XBI[6-log2(XLEN):5] ^ i
-      result[i] <- (RA)[idx]
+      idx <- (RT)[i] || (RA)[i] || (RB)[i]
+      result[i] <- TLI[7-idx]
     RT <- result
 
 Special Registers Altered:
 
     CR0                    (if Rc=1)
 
-# Generalized Bit-Reverse Word
-
-X-Form
-
-* grevw RT,RA,RB (Rc=0)
-* grevw. RT,RA,RB (Rc=1)
-
-Pseudo-code:
-
-    result <- [0] * (XLEN / 2)
-    a <- (RA)[XLEN/2:XLEN-1]
-    b <- EXTZ64(RB)
-    do i = 0 to XLEN / 2 - 1
-      idx <- b[64-log2(XLEN/2):63] ^ i
-      result[i] <- a[idx]
-    RT <- ([0] * (XLEN / 2)) || result
-
-Special Registers Altered:
-
-    CR0                    (if Rc=1)
-
-# Generalized Bit-Reverse Word Immediate
-
-X-Form
-
-* grevwi RT,RA,SH (Rc=0)
-* grevwi. RT,RA,SH (Rc=1)
-
-Pseudo-code:
-
-    result <- [0] * (XLEN / 2)
-    a <- (RA)[XLEN/2:XLEN-1]
-    do i = 0 to XLEN / 2 - 1
-      idx <- SH[5-log2(XLEN/2):4] ^ i
-      result[i] <- a[idx]
-    RT <- ([0] * (XLEN / 2)) || result
-
-Special Registers Altered:
-
-    CR0                    (if Rc=1)
-
 # Add With Shift By Immediate
 
 Z23-Form