mirror of
https://github.com/mirror/tinycc.git
synced 2025-02-26 08:00:09 +08:00
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.
This commit is contained in:
parent
d9b7f018ce
commit
68a7af632c
9
tccgen.c
9
tccgen.c
@ -1209,7 +1209,7 @@ static int reg_fret(int t)
|
|||||||
return REG_FRET;
|
return REG_FRET;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* expand long long on stack in two ints */
|
/* expand 64bit on stack in two ints */
|
||||||
static void lexpand(void)
|
static void lexpand(void)
|
||||||
{
|
{
|
||||||
int u, v;
|
int u, v;
|
||||||
@ -1258,6 +1258,7 @@ ST_FUNC void lexpand_nr(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(TCC_TARGET_X86_64) && !defined(TCC_TARGET_ARM64)
|
||||||
/* build a long long from two ints */
|
/* build a long long from two ints */
|
||||||
static void lbuild(int t)
|
static void lbuild(int t)
|
||||||
{
|
{
|
||||||
@ -1266,6 +1267,7 @@ static void lbuild(int t)
|
|||||||
vtop[-1].type.t = t;
|
vtop[-1].type.t = t;
|
||||||
vpop();
|
vpop();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* rotate n first stack elements to the bottom
|
/* rotate n first stack elements to the bottom
|
||||||
I1 ... In -> I2 ... In I1 [top is right]
|
I1 ... In -> I2 ... In I1 [top is right]
|
||||||
@ -1329,6 +1331,7 @@ static void gv_dup(void)
|
|||||||
SValue sv;
|
SValue sv;
|
||||||
|
|
||||||
t = vtop->type.t;
|
t = vtop->type.t;
|
||||||
|
#if !defined(TCC_TARGET_X86_64) && !defined(TCC_TARGET_ARM64)
|
||||||
if ((t & VT_BTYPE) == VT_LLONG) {
|
if ((t & VT_BTYPE) == VT_LLONG) {
|
||||||
lexpand();
|
lexpand();
|
||||||
gv_dup();
|
gv_dup();
|
||||||
@ -1343,7 +1346,9 @@ static void gv_dup(void)
|
|||||||
vswap();
|
vswap();
|
||||||
lbuild(t);
|
lbuild(t);
|
||||||
vswap();
|
vswap();
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
/* duplicate value */
|
/* duplicate value */
|
||||||
rc = RC_INT;
|
rc = RC_INT;
|
||||||
sv.type.t = VT_INT;
|
sv.type.t = VT_INT;
|
||||||
|
Loading…
Reference in New Issue
Block a user