Commits

Anonymous committed cc47763

Add mffgpr and mftgpr instructions. Use them.
Use subfic.

Comments (0)

Files changed (2)

pypy/jit/backend/ppc/codebuilder.py

 
     fsqrt = XDB(63, XO1=22, Rc=0)
 
+    mffgpr = XS(31, XO1=607, Rc=0)
+    mftgpr = XS(31, XO1=735, Rc=0)
+
     icbi = X0(31, XO1=982)
 
     lbzux = XD(31, XO1=119)

pypy/jit/backend/ppc/opassembler.py

     def emit_int_sub(self, op, arglocs, regalloc):
         l0, l1, res = arglocs
         if l0.is_imm():
-            self.mc.load_imm(r.r0, l0.value)
-            self.mc.sub(res.value, r.r0.value, l1.value)
+            self.mc.subfic(res.value, l1.value, l0.value)
         elif l1.is_imm():
             self.mc.subi(res.value, l0.value, l1.value)
         else:
     def emit_op_cast_float_to_int(self, op, arglocs, regalloc):
         l0, temp_loc, res = arglocs
         self.mc.fctidz(temp_loc.value, l0.value)
-        self.mc.mfprgpr(res.value, temp_loc.value)
+        self.mc.mftgpr(res.value, temp_loc.value)
 
     def emit_op_cast_int_to_float(self, op, arglocs, regalloc):
         l0, temp_loc, res = arglocs
-        self.mc.mgprfpr(temp_loc.value, l0.value)
+        self.mc.mffgpr(temp_loc.value, l0.value)
         self.mc.fcfid(res.value, temp_loc.value)
 
 class GuardOpAssembler(object):