1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 13:00:26 +02:00

Correct regressions with --with-float={soft,softfp} in the arm backend

* lib/jit_arm.c: Correct use of wrong argument offset
	variable in armv7l or float/double argument for varargs
	function in armv7hl.
	  Correct jit_getarg* logic in software float mode to
	match expected behavior in other backends, that is, if
	a function is not called, it is safe to use a few lightning
	calls before a next jit_getarg* call, as done in the test
	case check/stack.tst. The proper solution should be to
	extend the parser in lib/lightning.c to check if there is
	some float operation that will call some (libgcc?) function,
	but software float arm should be a very uncommon backend for
	lightning, so, just load the already in place arguments
	saved to stack, assuming the register argument was clobbered
	(what should not be the case most times...).
This commit is contained in:
pcpa 2012-12-22 16:28:02 -02:00
parent 59255a493c
commit adc854f1a7
2 changed files with 59 additions and 7 deletions

View file

@ -1,3 +1,20 @@
2012-12-22 Paulo Andrade <pcpa@gnu.org>
* lib/jit_arm.c: Correct use of wrong argument offset
variable in armv7l or float/double argument for varargs
function in armv7hl.
Correct jit_getarg* logic in software float mode to
match expected behavior in other backends, that is, if
a function is not called, it is safe to use a few lightning
calls before a next jit_getarg* call, as done in the test
case check/stack.tst. The proper solution should be to
extend the parser in lib/lightning.c to check if there is
some float operation that will call some (libgcc?) function,
but software float arm should be a very uncommon backend for
lightning, so, just load the already in place arguments
saved to stack, assuming the register argument was clobbered
(what should not be the case most times...).
2012-12-22 Paulo Andrade <pcpa@gnu.org>
* check/clobber.ok, check/clobber.tst: New test case doing

View file

@ -388,8 +388,8 @@ _jit_arg_d(jit_state_t *_jit)
if (_jit->function->self.argi < 3) {
if (_jit->function->self.argi & 1)
++_jit->function->self.argi;
offset = _jit->function->self.argf;
_jit->function->self.argf += 2;
offset = _jit->function->self.argi;
_jit->function->self.argi += 2;
return (offset);
}
}
@ -409,7 +409,12 @@ _jit_arg_d_reg_p(jit_state_t *_jit, jit_int32_t offset)
void
_jit_getarg_c(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
{
if (v < 4)
if (jit_swf_p()) {
if (v < 4)
v <<= 2;
jit_ldxi_c(u, JIT_FP, v);
}
else if (v < 4)
jit_extr_c(u, JIT_RA0 - v);
else
jit_ldxi_c(u, JIT_FP, v);
@ -418,7 +423,12 @@ _jit_getarg_c(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
void
_jit_getarg_uc(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
{
if (v < 4)
if (jit_swf_p()) {
if (v < 4)
v <<= 2;
jit_ldxi_uc(u, JIT_FP, v);
}
else if (v < 4)
jit_extr_uc(u, JIT_RA0 - v);
else
jit_ldxi_uc(u, JIT_FP, v);
@ -427,7 +437,12 @@ _jit_getarg_uc(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
void
_jit_getarg_s(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
{
if (v < 4)
if (jit_swf_p()) {
if (v < 4)
v <<= 2;
jit_ldxi_s(u, JIT_FP, v);
}
else if (v < 4)
jit_extr_s(u, JIT_RA0 - v);
else
jit_ldxi_s(u, JIT_FP, v);
@ -436,7 +451,12 @@ _jit_getarg_s(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
void
_jit_getarg_us(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
{
if (v < 4)
if (jit_swf_p()) {
if (v < 4)
v <<= 2;
jit_ldxi_us(u, JIT_FP, v);
}
else if (v < 4)
jit_extr_us(u, JIT_RA0 - v);
else
jit_ldxi_us(u, JIT_FP, v);
@ -445,7 +465,12 @@ _jit_getarg_us(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
void
_jit_getarg_i(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
{
if (v < 4)
if (jit_swf_p()) {
if (v < 4)
v <<= 2;
jit_ldxi_i(u, JIT_FP, v);
}
else if (v < 4)
jit_movr(u, JIT_RA0 - v);
else
jit_ldxi_i(u, JIT_FP, v);
@ -460,6 +485,11 @@ _jit_getarg_f(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
else
jit_ldxi_f(u, JIT_FP, v);
}
else if (jit_swf_p()) {
if (v < 4)
v <<= 2;
jit_ldxi_f(u, JIT_FP, v);
}
else {
if (v < 4)
jit_movr_f(u, JIT_RA0 - v);
@ -477,6 +507,11 @@ _jit_getarg_d(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
else
jit_ldxi_d(u, JIT_FP, v);
}
else if (jit_swf_p()) {
if (v < 4)
v <<= 2;
jit_ldxi_d(u, JIT_FP, v);
}
else {
if (v < 4)
jit_movr_d(u, JIT_RA0 - v);