Move result of itof double conv back to VFP reg

EABI functions to convert an int to a double register take the integer
value in core registers and also give the result in core registers.
It is thus necessary to move the result back to VFP register after the
function call. This only affected integer to double conversion because
integer to float conversion used a VFP instruction to do the conversion
and this obviously left the result in VFP register. Note that the
behavior is left untouched for !EABI as the correct behavior in this
case is unknown to the author of this patch.
This commit is contained in:
Thomas Preud'homme 2014-02-01 12:29:51 +08:00
parent fad8e13ccd
commit 5cbe03b9c4
2 changed files with 10 additions and 0 deletions

View File

@ -65,6 +65,7 @@ Bug fixes:
- fix NaN comparison (Thomas Preud'homme)
- use libtcc for static linking with runtime library (Thomas Preud'homme)
- fix negation of 0.0 and -0.0 values (Thomas Preud'homme)
- fix integer to double conversion on ARM (Thomas Preud'homme)
version 0.9.26:

View File

@ -1979,8 +1979,17 @@ ST_FUNC void gen_cvt_itof1(int t)
vpush_global_sym(func_type, func);
vswap();
gfunc_call(1);
#if defined(TCC_ARM_VFP) && defined(TCC_ARM_EABI)
r=get_reg(RC_FLOAT);
r2=vfpr(r);
o(0xEE000B10|(r2<<16)); /* vmov.32 dr2[0], r0 */
o(0xEE201B10|(r2<<16)); /* vmov.32 dr2[1], r1 */
vpushi(0);
vtop->r=r;
#else
vpushi(0);
vtop->r=TREG_F0;
#endif
return;
}
}