mirror of
https://github.com/mirror/tinycc.git
synced 2025-02-28 08:10:25 +08:00
arm64-gen.c: Improve generation of stack offsets.
This commit is contained in:
parent
1d41da9590
commit
1706d2254b
12
arm64-gen.c
12
arm64-gen.c
@ -274,8 +274,16 @@ static int arm64_type_size(int t)
|
|||||||
|
|
||||||
static void arm64_spoff(int reg, uint64_t off)
|
static void arm64_spoff(int reg, uint64_t off)
|
||||||
{
|
{
|
||||||
arm64_movimm(30, off); // use x30 for offset
|
uint32_t sub = off >> 63;
|
||||||
o(0x8b3e63e0 | reg); // add x(reg),sp,x30
|
if (sub)
|
||||||
|
off = -off;
|
||||||
|
if (off < 4096)
|
||||||
|
o(0x910003e0 | sub << 30 | reg | off << 10);
|
||||||
|
// (add|sub) x(reg),sp,#(off)
|
||||||
|
else {
|
||||||
|
arm64_movimm(30, off); // use x30 for offset
|
||||||
|
o(0x8b3e63e0 | sub << 30 | reg); // (add|sub) x(reg),sp,x30
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void arm64_ldrx(int sg, int sz, int dst, int bas, uint64_t off)
|
static void arm64_ldrx(int sg, int sz, int dst, int bas, uint64_t off)
|
||||||
|
Loading…
Reference in New Issue
Block a user