From 913a22324c3aa0c0f029e7236bdbaba1b4233ef8 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 116931858..928cfd856 100644 --- a/src/arch/power/isa/decoder.isa +++ b/src/arch/power/isa/decoder.isa @@ -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; -- 2.30.2