nope, no good, does not produce movmaskb constants
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 13 Mar 2022 18:55:49 +0000 (18:55 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 13 Mar 2022 18:55:49 +0000 (18:55 +0000)
openpower/sv/grevlut.py

index 890cbb27534e3c5cb065230487b957663442b89d..cc5b13f8d4153df1a9c3ceb5c9733fc0f0a2fe39 100644 (file)
@@ -18,16 +18,9 @@ def dorow(imm8, step_i, chunk_size):
     return step_o
 
 def grevlut64(RA, RB, imm, iv):
+    x = 0
     if RA is None: # RA=0
-        for i in range(6):
-            if 1<<i: break
-        x = {0: 0x5555555555555555,
-              1: 0x3333333333333333,
-              2: 0x0f0f0f0f0f0f0f0f,
-              3: 0x00ff00ff00ff00ff,
-              4: 0x0000ffff0000ffff,
-              5: 0x00000000ffffffff,
-        }[i]
+        x = 0x5555555555555555
     else:
         x = RA
     if (iv): x = ~x;
@@ -47,8 +40,6 @@ if __name__ == '__main__':
     x = grevlut64(None, RB, imm, 1)
     print ("grevlut", bin(RB), bin(imm), hex(x), "\n", bin(x))
 
-    exit(0)
-
     # answer: 8888888...
     RB = 0b0010
     imm = 0b11000110
@@ -100,8 +91,8 @@ if __name__ == '__main__':
     print()
 
     for RB in range(64):
-        imm = 0b01011001
-        x = grevlut64(None, RB, imm, 0)
+        imm = 0b01011010
+        x = grevlut64(None, RB, imm, 1)
         print ("grevlut", bin(RB), bin(imm), hex(x), "\n", bin(x))
     print()