aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2016-10-17 00:57:16 +0200
committerMichael Matz <matz@suse.de>2016-10-17 00:57:16 +0200
commit68a7af632c334c1bb589d2b8f4257874377e30f6 (patch)
treeb55f48296442b50acec3e7938d039b5ca2c8af0f
parentd9b7f018ce08bdd6b0e35608dbe75ba933622d92 (diff)
downloadtinycc-68a7af632c334c1bb589d2b8f4257874377e30f6.tar.gz
tinycc-68a7af632c334c1bb589d2b8f4257874377e30f6.tar.bz2
x86-64: Fix long long bug
With the last improvements to lexpand it's now harmful to use on native 64bit platforms when not necessary. For gv_dup it's not necessary there. It can still be used with really transforming a 64bit value into two 32bit ones.
-rw-r--r--tccgen.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/tccgen.c b/tccgen.c
index 147f01e..2fadf76 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -1209,7 +1209,7 @@ static int reg_fret(int t)
return REG_FRET;
}
-/* expand long long on stack in two ints */
+/* expand 64bit on stack in two ints */
static void lexpand(void)
{
int u, v;
@@ -1258,6 +1258,7 @@ ST_FUNC void lexpand_nr(void)
}
#endif
+#if !defined(TCC_TARGET_X86_64) && !defined(TCC_TARGET_ARM64)
/* build a long long from two ints */
static void lbuild(int t)
{
@@ -1266,6 +1267,7 @@ static void lbuild(int t)
vtop[-1].type.t = t;
vpop();
}
+#endif
/* rotate n first stack elements to the bottom
I1 ... In -> I2 ... In I1 [top is right]
@@ -1329,6 +1331,7 @@ static void gv_dup(void)
SValue sv;
t = vtop->type.t;
+#if !defined(TCC_TARGET_X86_64) && !defined(TCC_TARGET_ARM64)
if ((t & VT_BTYPE) == VT_LLONG) {
lexpand();
gv_dup();
@@ -1343,7 +1346,9 @@ static void gv_dup(void)
vswap();
lbuild(t);
vswap();
- } else {
+ } else
+#endif
+ {
/* duplicate value */
rc = RC_INT;
sv.type.t = VT_INT;