From 3d82a0a2e3add452d9e6dcb34ac52b180ee730c5 Mon Sep 17 00:00:00 2001 From: Sandipan Das Date: Sat, 6 Feb 2021 17:18:08 +0530 Subject: [PATCH] arch-power: Add word modulo instructions This adds the following instructions. * Modulo Signed Word (modsw) * Modulo Unsigned Word (moduw) Change-Id: Id84ff46d0114ab859bd8616d3dcf22111cf3bda2 Signed-off-by: Sandipan Das --- src/arch/power/isa/decoder.isa | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/arch/power/isa/decoder.isa b/src/arch/power/isa/decoder.isa index 0e3bbbde2..6c8cba9cd 100644 --- a/src/arch/power/isa/decoder.isa +++ b/src/arch/power/isa/decoder.isa @@ -393,6 +393,28 @@ decode PO default Unknown::unknown() { 181: stdux({{ Mem = Rs; }}); } + format IntArithOp { + 779: modsw({{ + int64_t src1 = Ra_sw; + int64_t src2 = Rb_sw; + if ((src1 != INT32_MIN || src2 != -1) && src2 != 0) { + Rt = src1 % src2; + } else { + Rt = 0; + } + }}); + + 267: moduw({{ + uint64_t src1 = Ra_uw; + uint64_t src2 = Rb_uw; + if (src2 != 0) { + Rt = src1 % src2; + } else { + Rt = 0; + } + }}); + } + format IntOp { 0: cmp({{ Xer xer = XER; -- 2.30.2