Commits

Sven Hager committed 62d9032

Implemented INT_MOD.

  • Participants
  • Parent commits 3f5bfca
  • Branches ppc-jit-backend

Comments (0)

Files changed (2)

pypy/jit/backend/ppc/ppcgen/opassembler.py

             self.mc.load_imm(r.r0, l1.value)
             div(res.value, l0.value, r.r0.value)
         else:
-            self.mc.divw(res.value, l0.value, l1.value)
+            div(res.value, l0.value, l1.value)
+
+    def emit_int_mod(self, op, arglocs, regalloc):
+        l0, l1, res = arglocs
+        if IS_PPC_32:
+            self.mc.divw(r.r0.value, l0.value, l1.value)
+            self.mc.mullw(r.r0.value, r.r0.value, l1.value)
+        else:
+            self.mc.divd(r.r0.value, l0.value, l1.value)
+            self.mc.mulld(r.r0.value, r.r0.value, l1.value)
+        self.mc.subf(r.r0.value, r.r0.value, l0.value)
+        self.mc.mr(res.value, r.r0.value)
 
     emit_int_le = gen_emit_cmp_op(c.LE)   
 

pypy/jit/backend/ppc/ppcgen/regalloc.py

         self.possibly_free_var(op.result)
         return [reg1, reg2, res]
 
+    def prepare_int_mod(self, op):
+        return self.prepare_int_mul(op)
+
     def prepare_finish(self, op):
         args = [locations.imm(self.frame_manager.frame_depth)]
         for i in range(op.numargs()):