split out instructions from openpower/isa/bitmanip.mdwn
authorJacob Lifshay <programmerjake@gmail.com>
Mon, 7 Aug 2023 23:04:00 +0000 (16:04 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Mon, 7 Aug 2023 23:06:58 +0000 (16:06 -0700)
17 files changed:
openpower/isa/bitmanip.mdwn
openpower/isa/bitmanip/grev.mdwn [new file with mode: 0644]
openpower/isa/bitmanip/grev_code.mdwn [new file with mode: 0644]
openpower/isa/bitmanip/grevi.mdwn [new file with mode: 0644]
openpower/isa/bitmanip/grevi_code.mdwn [new file with mode: 0644]
openpower/isa/bitmanip/grevw.mdwn [new file with mode: 0644]
openpower/isa/bitmanip/grevw_code.mdwn [new file with mode: 0644]
openpower/isa/bitmanip/grevwi.mdwn [new file with mode: 0644]
openpower/isa/bitmanip/grevwi_code.mdwn [new file with mode: 0644]
openpower/isa/bitmanip/sadd.mdwn [new file with mode: 0644]
openpower/isa/bitmanip/sadd_code.mdwn [new file with mode: 0644]
openpower/isa/bitmanip/sadduw.mdwn [new file with mode: 0644]
openpower/isa/bitmanip/sadduw_code.mdwn [new file with mode: 0644]
openpower/isa/bitmanip/saddw.mdwn [new file with mode: 0644]
openpower/isa/bitmanip/saddw_code.mdwn [new file with mode: 0644]
openpower/isa/bitmanip/ternlogi.mdwn [new file with mode: 0644]
openpower/isa/bitmanip/ternlogi_code.mdwn [new file with mode: 0644]

index 830962c9ed6cea423a837fc077cce23c904f6682..d06035706d574a94d388e838a877e4051ca4d050 100644 (file)
 <!-- https://libre-soc.org/openpower/sv/bitmanip/ -->
 <!-- These instructions are *not yet official* -->
 
-# Ternary Bitwise Logic Immediate
+[[!inline pagenames="openpower/isa/bitmanip/ternlogi" raw="yes"]]
 
-TLI-Form
+[[!inline pagenames="openpower/isa/bitmanip/grev" raw="yes"]]
 
-* ternlogi RT,RA,RB,TLI (Rc=0)
-* ternlogi. RT,RA,RB,TLI (Rc=1)
+[[!inline pagenames="openpower/isa/bitmanip/grevi" raw="yes"]]
 
-Pseudo-code:
+[[!inline pagenames="openpower/isa/bitmanip/grevw" raw="yes"]]
 
-    result <- [0] * XLEN
-    do i = 0 to XLEN - 1
-      idx <- (RT)[i] || (RA)[i] || (RB)[i]
-      result[i] <- TLI[7-idx]
-    RT <- result
+[[!inline pagenames="openpower/isa/bitmanip/grevwi" raw="yes"]]
 
-Special Registers Altered:
+[[!inline pagenames="openpower/isa/bitmanip/sadd" raw="yes"]]
 
-    CR0                    (if Rc=1)
+[[!inline pagenames="openpower/isa/bitmanip/saddw" raw="yes"]]
 
-# Generalized Bit-Reverse
-
-X-Form
-
-* grev RT,RA,RB (Rc=0)
-* grev. RT,RA,RB (Rc=1)
-
-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]
-    RT <- result
-
-Special Registers Altered:
-
-    CR0                    (if Rc=1)
-
-# Generalized Bit-Reverse Immediate
-
-XB-Form
-
-* grevi RT,RA,XBI (Rc=0)
-* grevi. RT,RA,XBI (Rc=1)
-
-Pseudo-code:
-
-    result <- [0] * XLEN
-    do i = 0 to XLEN - 1
-      idx <- XBI[6-log2(XLEN):5] ^ i
-      result[i] <- (RA)[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
-
-* sadd RT,RA,RB,SH (Rc=0)
-* sadd. RT,RA,RB,SH (Rc=1)
-
-Pseudo-code:
-
-    n <- (RB)
-    m <- ((0b0 || SH) + 1)
-    RT <- (n[m:XLEN-1] || [0]*m) + (RA)
-
-Special Registers Altered:
-
-    CR0                    (if Rc=1)
-
-# Add With Shift By Immediate Word
-
-Z23-Form
-
-* saddw RT,RA,RB,SH (Rc=0)
-* saddw. RT,RA,RB,SH (Rc=1)
-
-Pseudo-code:
-
-    n <- ([0]*(XLEN/2)) || (RB)[XLEN/2:XLEN-1]
-    if (RB)[XLEN/2] = 1 then
-        n[0:XLEN/2-1] <- [1]*(XLEN/2)
-    m <- ((0b0 || SH) + 1)
-    RT <- (n[m:XLEN-1] || [0]*m) + (RA)
-
-Special Registers Altered:
-
-    CR0                    (if Rc=1)
-
-# Add With Shift By Immediate Unsigned Word
-
-Z23-Form
-
-* sadduw RT,RA,RB,SH (Rc=0)
-* sadduw. RT,RA,RB,SH (Rc=1)
-
-Pseudo-code:
-
-    n <- ([0]*(XLEN/2)) || (RB)[XLEN/2:XLEN-1]
-    m <- ((0b0 || SH) + 1)
-    RT <- (n[m:XLEN-1] || [0]*m) + (RA)
-
-Special Registers Altered:
-
-    CR0                    (if Rc=1)
+[[!inline pagenames="openpower/isa/bitmanip/sadduw" raw="yes"]]
diff --git a/openpower/isa/bitmanip/grev.mdwn b/openpower/isa/bitmanip/grev.mdwn
new file mode 100644 (file)
index 0000000..2e7e9cf
--- /dev/null
@@ -0,0 +1,14 @@
+# Generalized Bit-Reverse
+
+X-Form
+
+* grev RT,RA,RB (Rc=0)
+* grev. RT,RA,RB (Rc=1)
+
+Pseudo-code:
+
+[[!inline pagenames="openpower/isa/bitmanip/grev_code" raw="yes"]]
+
+Special Registers Altered:
+
+    CR0                    (if Rc=1)
diff --git a/openpower/isa/bitmanip/grev_code.mdwn b/openpower/isa/bitmanip/grev_code.mdwn
new file mode 100644 (file)
index 0000000..442196f
--- /dev/null
@@ -0,0 +1,6 @@
+    result <- [0] * XLEN
+    b <- EXTZ64(RB)
+    do i = 0 to XLEN - 1
+      idx <- b[64-log2(XLEN):63] ^ i
+      result[i] <- (RA)[idx]
+    RT <- result
diff --git a/openpower/isa/bitmanip/grevi.mdwn b/openpower/isa/bitmanip/grevi.mdwn
new file mode 100644 (file)
index 0000000..d5ab2b7
--- /dev/null
@@ -0,0 +1,14 @@
+# Generalized Bit-Reverse Immediate
+
+XB-Form
+
+* grevi RT,RA,XBI (Rc=0)
+* grevi. RT,RA,XBI (Rc=1)
+
+Pseudo-code:
+
+[[!inline pagenames="openpower/isa/bitmanip/grevi_code" raw="yes"]]
+
+Special Registers Altered:
+
+    CR0                    (if Rc=1)
diff --git a/openpower/isa/bitmanip/grevi_code.mdwn b/openpower/isa/bitmanip/grevi_code.mdwn
new file mode 100644 (file)
index 0000000..9d5f41f
--- /dev/null
@@ -0,0 +1,5 @@
+    result <- [0] * XLEN
+    do i = 0 to XLEN - 1
+      idx <- XBI[6-log2(XLEN):5] ^ i
+      result[i] <- (RA)[idx]
+    RT <- result
diff --git a/openpower/isa/bitmanip/grevw.mdwn b/openpower/isa/bitmanip/grevw.mdwn
new file mode 100644 (file)
index 0000000..2b98949
--- /dev/null
@@ -0,0 +1,14 @@
+# Generalized Bit-Reverse Word
+
+X-Form
+
+* grevw RT,RA,RB (Rc=0)
+* grevw. RT,RA,RB (Rc=1)
+
+Pseudo-code:
+
+[[!inline pagenames="openpower/isa/bitmanip/grevw_code" raw="yes"]]
+
+Special Registers Altered:
+
+    CR0                    (if Rc=1)
diff --git a/openpower/isa/bitmanip/grevw_code.mdwn b/openpower/isa/bitmanip/grevw_code.mdwn
new file mode 100644 (file)
index 0000000..1f7355a
--- /dev/null
@@ -0,0 +1,7 @@
+    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
diff --git a/openpower/isa/bitmanip/grevwi.mdwn b/openpower/isa/bitmanip/grevwi.mdwn
new file mode 100644 (file)
index 0000000..2daf225
--- /dev/null
@@ -0,0 +1,14 @@
+# Generalized Bit-Reverse Word Immediate
+
+X-Form
+
+* grevwi RT,RA,SH (Rc=0)
+* grevwi. RT,RA,SH (Rc=1)
+
+Pseudo-code:
+
+[[!inline pagenames="openpower/isa/bitmanip/grevwi_code" raw="yes"]]
+
+Special Registers Altered:
+
+    CR0                    (if Rc=1)
diff --git a/openpower/isa/bitmanip/grevwi_code.mdwn b/openpower/isa/bitmanip/grevwi_code.mdwn
new file mode 100644 (file)
index 0000000..fc1fbbc
--- /dev/null
@@ -0,0 +1,6 @@
+    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
diff --git a/openpower/isa/bitmanip/sadd.mdwn b/openpower/isa/bitmanip/sadd.mdwn
new file mode 100644 (file)
index 0000000..d09346e
--- /dev/null
@@ -0,0 +1,14 @@
+# Add With Shift By Immediate
+
+Z23-Form
+
+* sadd RT,RA,RB,SH (Rc=0)
+* sadd. RT,RA,RB,SH (Rc=1)
+
+Pseudo-code:
+
+[[!inline pagenames="openpower/isa/bitmanip/sadd_code" raw="yes"]]
+
+Special Registers Altered:
+
+    CR0                    (if Rc=1)
diff --git a/openpower/isa/bitmanip/sadd_code.mdwn b/openpower/isa/bitmanip/sadd_code.mdwn
new file mode 100644 (file)
index 0000000..1688d90
--- /dev/null
@@ -0,0 +1,3 @@
+    n <- (RB)
+    m <- ((0b0 || SH) + 1)
+    RT <- (n[m:XLEN-1] || [0]*m) + (RA)
diff --git a/openpower/isa/bitmanip/sadduw.mdwn b/openpower/isa/bitmanip/sadduw.mdwn
new file mode 100644 (file)
index 0000000..3281ca9
--- /dev/null
@@ -0,0 +1,14 @@
+# Add With Shift By Immediate Unsigned Word
+
+Z23-Form
+
+* sadduw RT,RA,RB,SH (Rc=0)
+* sadduw. RT,RA,RB,SH (Rc=1)
+
+Pseudo-code:
+
+[[!inline pagenames="openpower/isa/bitmanip/sadduw_code" raw="yes"]]
+
+Special Registers Altered:
+
+    CR0                    (if Rc=1)
diff --git a/openpower/isa/bitmanip/sadduw_code.mdwn b/openpower/isa/bitmanip/sadduw_code.mdwn
new file mode 100644 (file)
index 0000000..f5e1b95
--- /dev/null
@@ -0,0 +1,3 @@
+    n <- ([0]*(XLEN/2)) || (RB)[XLEN/2:XLEN-1]
+    m <- ((0b0 || SH) + 1)
+    RT <- (n[m:XLEN-1] || [0]*m) + (RA)
diff --git a/openpower/isa/bitmanip/saddw.mdwn b/openpower/isa/bitmanip/saddw.mdwn
new file mode 100644 (file)
index 0000000..dbb5edf
--- /dev/null
@@ -0,0 +1,14 @@
+# Add With Shift By Immediate Word
+
+Z23-Form
+
+* saddw RT,RA,RB,SH (Rc=0)
+* saddw. RT,RA,RB,SH (Rc=1)
+
+Pseudo-code:
+
+[[!inline pagenames="openpower/isa/bitmanip/saddw_code" raw="yes"]]
+
+Special Registers Altered:
+
+    CR0                    (if Rc=1)
diff --git a/openpower/isa/bitmanip/saddw_code.mdwn b/openpower/isa/bitmanip/saddw_code.mdwn
new file mode 100644 (file)
index 0000000..dfae875
--- /dev/null
@@ -0,0 +1,5 @@
+    n <- ([0]*(XLEN/2)) || (RB)[XLEN/2:XLEN-1]
+    if (RB)[XLEN/2] = 1 then
+        n[0:XLEN/2-1] <- [1]*(XLEN/2)
+    m <- ((0b0 || SH) + 1)
+    RT <- (n[m:XLEN-1] || [0]*m) + (RA)
diff --git a/openpower/isa/bitmanip/ternlogi.mdwn b/openpower/isa/bitmanip/ternlogi.mdwn
new file mode 100644 (file)
index 0000000..ecbd222
--- /dev/null
@@ -0,0 +1,14 @@
+# Ternary Bitwise Logic Immediate
+
+TLI-Form
+
+* ternlogi RT,RA,RB,TLI (Rc=0)
+* ternlogi. RT,RA,RB,TLI (Rc=1)
+
+Pseudo-code:
+
+[[!inline pagenames="openpower/isa/bitmanip/ternlogi_code" raw="yes"]]
+
+Special Registers Altered:
+
+    CR0                    (if Rc=1)
diff --git a/openpower/isa/bitmanip/ternlogi_code.mdwn b/openpower/isa/bitmanip/ternlogi_code.mdwn
new file mode 100644 (file)
index 0000000..7f441fb
--- /dev/null
@@ -0,0 +1,5 @@
+    result <- [0] * XLEN
+    do i = 0 to XLEN - 1
+      idx <- (RT)[i] || (RA)[i] || (RB)[i]
+      result[i] <- TLI[7-idx]
+    RT <- result