arch-power: Add fixed-point logical bit permute instructions
authorSandipan Das <sandipan@linux.vnet.ibm.com>
Thu, 7 Jun 2018 10:57:21 +0000 (16:27 +0530)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 24 Jan 2021 03:26:11 +0000 (03:26 +0000)
This adds the following logical instructions:
  * Bit Permute Doubleword (bpermd[.])

Change-Id: I1af329cd28871c00ebb0574e38a53bcd6a3b794c
Signed-off-by: Sandipan Das <sandipan@linux.vnet.ibm.com>
src/arch/power/isa/decoder.isa

index 1169318585acef432133eafbdbcda475a7f3877f..928cfd856d5f75f9f36951a4dbaa246de86598ff 100644 (file)
@@ -574,6 +574,19 @@ decode PO default Unknown::unknown() {
                 Ra = res;
             }});
 
+            252: bpermd({{
+                uint64_t res = 0;
+                for (int i = 0; i < 8; ++i) {
+                    int index = (Rs >> (i * 8)) & 0xff;
+                    if (index < 64) {
+                        if (Rb & (1ULL << (63 - index))) {
+                            res |= 1 << i;
+                        }
+                    }
+                }
+                Ra = res;
+            }});
+
             24: slw({{
                 if (Rb & 0x20) {
                     Ra = 0;