arch-power: Add word modulo instructions
authorSandipan Das <sandipan@linux.ibm.com>
Sat, 6 Feb 2021 11:48:08 +0000 (17:18 +0530)
committerSandipan Das <sandipan@linux.ibm.com>
Mon, 15 Feb 2021 08:32:38 +0000 (14:02 +0530)
This adds the following instructions.
  * Modulo Signed Word (modsw)
  * Modulo Unsigned Word (moduw)

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

index 0e3bbbde247976211bea34dae5bce86d72afd575..6c8cba9cdf8db1dd122c760a403e6721d3e83290 100644 (file)
@@ -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;