arch-power: Add doubleword divide instructions
authorSandipan Das <sandipan@linux.ibm.com>
Sat, 6 Feb 2021 11:48:00 +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.
  * Divide Doubleword (divd[o][.])
  * Divide Doubleword Unsigned (divdu[o][.])

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

index 79fe314df514da580e23fe27de3ed8df418ec72d..f760b7813e8c0b3e88c600f275f0bb8c84cdaeb0 100644 (file)
@@ -667,6 +667,30 @@ decode PO default Unknown::unknown() {
                     }
                 }},
                 true);
+
+                489: divd({{
+                    int64_t src1 = Ra_sd;
+                    int64_t src2 = Rb_sd;
+                    if ((src1 != INT64_MIN || src2 != -1) && src2 != 0) {
+                        Rt = src1 / src2;
+                    } else {
+                        Rt = 0;
+                        setOV = true;
+                    }
+                }},
+                true);
+
+                457: divdu({{
+                    uint64_t src1 = Ra;
+                    uint64_t src2 = Rb;
+                    if (src2 != 0) {
+                        Rt = src1 / src2;
+                    } else {
+                        Rt = 0;
+                        setOV = true;
+                    }
+                }},
+                true);
             }
 
             default: decode XFX_XO {