From 9e4bf8e0cf12b536ef3f26c17c3271bd9c91e6ca Mon Sep 17 00:00:00 2001 From: Sandipan Das Date: Thu, 7 Jun 2018 16:27:21 +0530 Subject: [PATCH] arch-power: Add fixed-point logical bit permute instructions This adds the following logical instructions: * Bit Permute Doubleword (bpermd[.]) Change-Id: I1af329cd28871c00ebb0574e38a53bcd6a3b794c Signed-off-by: Sandipan Das --- src/arch/power/isa/decoder.isa | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/arch/power/isa/decoder.isa b/src/arch/power/isa/decoder.isa index f66bb7187..f98fe82fd 100644 --- a/src/arch/power/isa/decoder.isa +++ b/src/arch/power/isa/decoder.isa @@ -576,6 +576,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; -- 2.30.2