[pypy-commit] pypy arm-backend-2: refactor cast_float_to_int and cast_int_to_float using the VMOV operation
bivab
noreply at buildbot.pypy.org
Thu Apr 5 14:19:05 CEST 2012
Author: David Schneider <david.schneider at picle.org>
Branch: arm-backend-2
Changeset: r54199:cf3f78de7344
Date: 2012-03-27 17:02 +0000
http://bitbucket.org/pypy/pypy/changeset/cf3f78de7344/
Log: refactor cast_float_to_int and cast_int_to_float using the VMOV
operation
diff --git a/pypy/jit/backend/arm/opassembler.py b/pypy/jit/backend/arm/opassembler.py
--- a/pypy/jit/backend/arm/opassembler.py
+++ b/pypy/jit/backend/arm/opassembler.py
@@ -1268,18 +1268,20 @@
emit_guard_float_ge = gen_emit_float_cmp_op_guard('float_ge', c.GE)
def emit_op_cast_float_to_int(self, op, arglocs, regalloc, fcond):
- arg, temp, res = arglocs
- self.mc.VCVT_float_to_int(temp.value, arg.value)
- self.mc.VPUSH([temp.value])
- # res is lower register than r.ip
- self.mc.POP([res.value, r.ip.value])
+ arg, res = arglocs
+ assert arg.is_vfp_reg()
+ assert res.is_reg()
+ self.mc.VCVT_float_to_int(r.vfp_ip.value, arg.value)
+ self.mc.VMOV_rc(res.value, r.ip.value, r.vfp_ip.value)
return fcond
def emit_op_cast_int_to_float(self, op, arglocs, regalloc, fcond):
- arg, temp, res = arglocs
- self.mc.PUSH([arg.value, r.ip.value])
- self.mc.VPOP([temp.value])
- self.mc.VCVT_int_to_float(res.value, temp.value)
+ arg, res = arglocs
+ assert res.is_vfp_reg()
+ assert arg.is_reg()
+ self.mc.MOV_ri(r.ip.value, 0)
+ self.mc.VMOV_cr(res.value, arg.value, r.ip.value)
+ self.mc.VCVT_int_to_float(res.value, res.value)
return fcond
emit_op_llong_add = gen_emit_float_op('llong_add', 'VADD_i64')
diff --git a/pypy/jit/backend/arm/regalloc.py b/pypy/jit/backend/arm/regalloc.py
--- a/pypy/jit/backend/arm/regalloc.py
+++ b/pypy/jit/backend/arm/regalloc.py
@@ -1186,19 +1186,13 @@
def prepare_op_cast_float_to_int(self, op, fcond):
loc1 = self._ensure_value_is_boxed(op.getarg(0))
- temp_loc = self.get_scratch_reg(FLOAT)
- self.possibly_free_vars_for_op(op)
- self.free_temp_vars()
res = self.rm.force_allocate_reg(op.result)
- return [loc1, temp_loc, res]
+ return [loc1, res]
def prepare_op_cast_int_to_float(self, op, fcond):
loc1 = self._ensure_value_is_boxed(op.getarg(0))
- temp_loc = self.get_scratch_reg(FLOAT)
- self.possibly_free_vars_for_op(op)
- self.free_temp_vars()
res = self.vfprm.force_allocate_reg(op.result)
- return [loc1, temp_loc, res]
+ return [loc1, res]
def prepare_force_spill(self, op, fcond):
self.force_spill_var(op.getarg(0))
More information about the pypy-commit
mailing list