arch-power: Add doubleword modulo instructions
authorSandipan Das <sandipan@linux.ibm.com>
Sat, 6 Feb 2021 11:48:12 +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 Doubleword (modsd)
  * Modulo Unsigned Doubleword (modud)

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

index 6c8cba9cdf8db1dd122c760a403e6721d3e83290..06636a2f88b0239b273c2ab0598592ac14d376fe 100644 (file)
@@ -413,6 +413,26 @@ decode PO default Unknown::unknown() {
                     Rt = 0;
                 }
             }});
+
+            777: modsd({{
+                int64_t src1 = Ra_sd;
+                int64_t src2 = Rb_sd;
+                if ((src1 != INT64_MIN || src2 != -1) && src2 != 0) {
+                    Rt = src1 % src2;
+                } else {
+                    Rt = 0;
+                }
+            }});
+
+            265: modud({{
+                uint64_t src1 = Ra;
+                uint64_t src2 = Rb;
+                if (src2 != 0) {
+                    Rt = src1 % src2;
+                } else {
+                    Rt = 0;
+                }
+            }});
         }
 
         format IntOp {