aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2014-02-01 12:29:51 +0800
committerThomas Preud'homme <robotux@celest.fr>2014-02-01 14:25:13 +0800
commit5cbe03b9c47e676e045b4978c384087433bd6042 (patch)
tree9296f37cd03f67bd1d2e5b4a36aae66b897d8c15
parentfad8e13ccd567512e36a4441688e62c0aa63407e (diff)
downloadtinycc-5cbe03b9c47e676e045b4978c384087433bd6042.tar.gz
tinycc-5cbe03b9c47e676e045b4978c384087433bd6042.tar.bz2
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.
-rw-r--r--Changelog1
-rw-r--r--arm-gen.c9
2 files changed, 10 insertions, 0 deletions
diff --git a/Changelog b/Changelog
index 9a497cf..20814c1 100644
--- a/Changelog
+++ b/Changelog
@@ -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:
diff --git a/arm-gen.c b/arm-gen.c
index 9611dca..c746e91 100644
--- a/arm-gen.c
+++ b/arm-gen.c
@@ -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;
}
}