Commits

David Schneider  committed db27ab5

add more checks for floating point support

  • Participants
  • Parent commits fc0c182
  • Branches arm-backend-2

Comments (0)

Files changed (3)

File pypy/jit/backend/arm/assembler.py

 
     def _gen_leave_jitted_hook_code(self, save_exc):
         mc = ARMv7Builder()
-        # XXX add a check if cpu supports floats
-        with saved_registers(mc, r.caller_resp + [r.lr], r.caller_vfp_resp):
+        if self.cpu.supports_floats:
+            floats = r.caller_vfp_resp
+        else:
+            floats = []
+        with saved_registers(mc, r.caller_resp + [r.lr], floats):
             addr = self.cpu.get_on_leave_jitted_int(save_exception=save_exc)
             mc.BL(addr)
         assert self._exit_code_addr != 0
         #
         mc = ARMv7Builder()
         # call on_leave_jitted_save_exc()
-        # XXX add a check if cpu supports floats
-        with saved_registers(mc, r.caller_resp + [r.ip], r.caller_vfp_resp):
+        if self.cpu.supports_floats:
+            floats = r.caller_vfp_resp
+        else:
+            floats = []
+        with saved_registers(mc, r.caller_resp + [r.lr], floats):
             addr = self.cpu.get_on_leave_jitted_int(save_exception=True,
                                                 default_to_memoryerror=True)
             mc.BL(addr)

File pypy/jit/backend/arm/helper/assembler.py

 class saved_registers(object):
     def __init__(self, assembler, regs_to_save, vfp_regs_to_save=None):
         self.assembler = assembler
+        self.supports_floats = assembler.cpu.supports_floats
         if vfp_regs_to_save is None:
             vfp_regs_to_save = []
         self.regs = regs_to_save
     def __enter__(self):
         if len(self.regs) > 0:
             self.assembler.PUSH([r.value for r in self.regs])
-        if len(self.vfp_regs) > 0:
+        if self.supports_floats and len(self.vfp_regs) > 0:
             self.assembler.VPUSH([r.value for r in self.vfp_regs])
 
     def __exit__(self, *args):
-        if len(self.vfp_regs) > 0:
+        if self.supports_floats and len(self.vfp_regs) > 0:
             self.assembler.VPOP([r.value for r in self.vfp_regs])
         if len(self.regs) > 0:
             self.assembler.POP([r.value for r in self.regs])

File pypy/jit/backend/arm/opassembler.py

 
         # Path B: use assembler helper
         asm_helper_adr = self.cpu.cast_adr_to_int(jd.assembler_helper_adr)
-        with saved_registers(self.mc, r.caller_resp[1:] + [r.ip],
-                                    r.caller_vfp_resp):
+        if self.cpu.supports_floats:
+            floats = r.caller_vfp_resp
+        else:
+            floats = []
+        with saved_registers(self.mc, r.caller_resp[1:] + [r.ip], floats):
             # result of previous call is in r0
             self.mov_loc_loc(arglocs[0], r.r1)
             self.mc.BL(asm_helper_adr)