From 8e931edf7480effe91be820bab14eda970a82c78 Mon Sep 17 00:00:00 2001 From: Sandipan Das Date: Sat, 6 Feb 2021 17:21:34 +0530 Subject: [PATCH] arch-power: Add bit permute instructions This adds the following instructions. * Bit Permute Doubleword (bpermd) Change-Id: Iab3cc6729b9d59c95e29b4f1d3e2c0eb48fde917 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 4482f2a1f..908ba3c26 100644 --- a/src/arch/power/isa/decoder.isa +++ b/src/arch/power/isa/decoder.isa @@ -571,6 +571,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