[pypy-commit] pypy default: add calling convention tests that fail on ARM hardfloat.
bivab
noreply at buildbot.pypy.org
Fri Mar 22 09:32:25 CET 2013
Author: David Schneider <david.schneider at picle.org>
Branch:
Changeset: r62643:c08ad20d4651
Date: 2013-03-22 10:00 +0200
http://bitbucket.org/pypy/pypy/changeset/c08ad20d4651/
Log: add calling convention tests that fail on ARM hardfloat.
The tests pinpoint the current issue with float arguments passed on
the stack using the hardfloat calling convention
diff --git a/rpython/jit/backend/arm/test/test_calling_convention.py b/rpython/jit/backend/arm/test/test_calling_convention.py
--- a/rpython/jit/backend/arm/test/test_calling_convention.py
+++ b/rpython/jit/backend/arm/test/test_calling_convention.py
@@ -7,6 +7,18 @@
from rpython.jit.backend.arm.codebuilder import ARMv7Builder
from rpython.jit.backend.arm import registers as r
from rpython.jit.backend.arm.test.support import skip_unless_run_slow_tests
+from rpython.jit.backend.arm.test.test_runner import boxfloat, constfloat
+from rpython.jit.metainterp.resoperation import ResOperation, rop
+from rpython.jit.metainterp.history import (AbstractFailDescr,
+ AbstractDescr,
+ BasicFailDescr,
+ BasicFinalDescr,
+ BoxInt, Box, BoxPtr,
+ JitCellToken, TargetToken,
+ ConstInt, ConstPtr,
+ BoxObj,
+ ConstObj, BoxFloat, ConstFloat)
+
skip_unless_run_slow_tests()
class TestARMCallingConvention(CallingConvTests):
@@ -39,17 +51,6 @@
ops = """
[%s]
i99 = call(ConstClass(func_ptr), 22, descr=calldescr)
- force_spill(i0)
- force_spill(i1)
- force_spill(i2)
- force_spill(i3)
- force_spill(i4)
- force_spill(i5)
- force_spill(i6)
- force_spill(i7)
- force_spill(i8)
- force_spill(i9)
- force_spill(i10)
guard_true(i0) [%s, i99]
finish()""" % (args, args)
loop = parse(ops, namespace=locals())
@@ -60,3 +61,82 @@
for x in range(11):
assert self.cpu.get_int_value(deadframe, x) == x
assert self.cpu.get_int_value(deadframe, 11) == 38
+
+
+ def test_float_hf_call_mixed(self):
+ if not self.cpu.supports_floats:
+ py.test.skip("requires floats")
+ cpu = self.cpu
+ callargs = []
+ def func(f0, f1, f2, f3, f4, f5, f6, i0, f7, i1, f8, f9):
+ callargs.append(zip(range(12),
+ [f0, f1, f2, f3, f4, f5, f6, i0, f7, i1, f8, f9]))
+ return f0 + f1 + f2 + f3 + f4 + f5 + f6 + float(i0 + i1) + f7 + f8 + f9
+ F = lltype.Float
+ I = lltype.Signed
+ FUNC = self.FuncType([F] * 7 + [I] + [F] + [I] + [F]* 2, F)
+ FPTR = self.Ptr(FUNC)
+ func_ptr = llhelper(FPTR, func)
+ calldescr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,
+ EffectInfo.MOST_GENERAL)
+ funcbox = self.get_funcbox(cpu, func_ptr)
+ args = ([boxfloat(.1) for i in range(7)] +
+ [BoxInt(1), boxfloat(.2), BoxInt(2), boxfloat(.3),
+ boxfloat(.4)])
+ res = self.execute_operation(rop.CALL,
+ [funcbox] + args,
+ 'float', descr=calldescr)
+ for i,j in enumerate(callargs[0]):
+ box = args[i]
+ if box.type == 'f':
+ assert (i, args[i].getfloat()) == j
+ else:
+ assert (i, args[i].getint()) == j
+ assert abs(res.getfloat() - 4.6) < 0.0001
+
+ def test_float_hf_call_float(self):
+ if not self.cpu.supports_floats:
+ py.test.skip("requires floats")
+ cpu = self.cpu
+ callargs = []
+ def func(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9):
+ callargs.append(zip(range(10),
+ [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9]))
+ return f0 + f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9
+ F = lltype.Float
+ FUNC = self.FuncType([F] * 10, F)
+ FPTR = self.Ptr(FUNC)
+ func_ptr = llhelper(FPTR, func)
+ calldescr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,
+ EffectInfo.MOST_GENERAL)
+ funcbox = self.get_funcbox(cpu, func_ptr)
+ args = ([boxfloat(.1) for i in range(10)])
+ res = self.execute_operation(rop.CALL,
+ [funcbox] + args,
+ 'float', descr=calldescr)
+ for i,j in enumerate(callargs[0]):
+ assert (i, 0.1) == j
+ assert abs(res.getfloat() - 1) < 0.0001
+
+ def test_float_hf_call_int(self):
+ cpu = self.cpu
+ callargs = []
+ def func(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9):
+ callargs.append(zip(range(10),
+ [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9]))
+ return f0 + f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9
+
+ I = lltype.Signed
+ FUNC = self.FuncType([I] * 10, I)
+ FPTR = self.Ptr(FUNC)
+ func_ptr = llhelper(FPTR, func)
+ calldescr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,
+ EffectInfo.MOST_GENERAL)
+ funcbox = self.get_funcbox(cpu, func_ptr)
+ args = ([BoxInt(1) for i in range(10)])
+ res = self.execute_operation(rop.CALL,
+ [funcbox] + args,
+ 'int', descr=calldescr)
+ for i,j in enumerate(callargs[0]):
+ assert (i, 1) == j
+ assert res.getint() == 10
More information about the pypy-commit
mailing list