mirror of
https://github.com/frida/tinycc
synced 2024-11-24 00:29:38 +03:00
Fix riscv64 compare problem.
Fix 64->32 bits sign/zero extention for riscv64.
This commit is contained in:
parent
d1ce34448f
commit
d55a3f3362
10
tccgen.c
10
tccgen.c
@ -3605,10 +3605,12 @@ again:
|
||||
}
|
||||
ss = ds, ds = 4, dbt = sbt;
|
||||
} else if (ss == 8) {
|
||||
/* XXX some architectures (e.g. risc-v) would like it
|
||||
better for this merely being a 32-to-64 sign or zero-
|
||||
extension. */
|
||||
trunc = 32; /* zero upper 32 bits */
|
||||
/* RISC-V keeps 32bit vals in registers sign-extended.
|
||||
So here we need a sign-extension for signed types and
|
||||
zero-extension. for unsigned types. */
|
||||
#if !defined(TCC_TARGET_RISCV64)
|
||||
trunc = 32; /* zero upper 32 bits for non RISC-V targets */
|
||||
#endif
|
||||
} else {
|
||||
ss = 4;
|
||||
}
|
||||
|
@ -117,6 +117,18 @@ void tst_builtin(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
int tst(void)
|
||||
{
|
||||
long value = 3;
|
||||
return -value;
|
||||
}
|
||||
|
||||
void tst_compare(void)
|
||||
{
|
||||
/* This failed on risc64 */
|
||||
if (tst() > 0) printf ("error\n");
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
@ -131,4 +143,5 @@ main (void)
|
||||
tst_big(big);
|
||||
tst_adr(&sprintf);
|
||||
tst_builtin();
|
||||
tst_compare();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user