diff options
| author | Edmund Grimley Evans <Edmund.Grimley.Evans@gmail.com> | 2015-11-17 19:09:35 +0000 |
|---|---|---|
| committer | Edmund Grimley Evans <Edmund.Grimley.Evans@gmail.com> | 2015-11-17 19:09:35 +0000 |
| commit | 569fba6db9c12916bd2802a7ee46dc5609118e0b (patch) | |
| tree | 8dc680cf47393c8eadb8563e4a842ce1e6656c01 /arm64-gen.c | |
| parent | 3712c958f4ef31ce006edeab6c34875ea5ae08f8 (diff) | |
| download | tinycc-569fba6db9c12916bd2802a7ee46dc5609118e0b.tar.gz tinycc-569fba6db9c12916bd2802a7ee46dc5609118e0b.tar.bz2 | |
Merge the integer members of union CValue into "uint64_t i".
Diffstat (limited to 'arm64-gen.c')
| -rw-r--r-- | arm64-gen.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/arm64-gen.c b/arm64-gen.c index ffdf7e0..d43b50d 100644 --- a/arm64-gen.c +++ b/arm64-gen.c @@ -463,7 +463,7 @@ ST_FUNC void load(int r, SValue *sv) int svtt = sv->type.t; int svr = sv->r & ~VT_LVAL_TYPE; int svrv = svr & VT_VALMASK; - uint64_t svcul = (uint32_t)sv->c.ul; + uint64_t svcul = (uint32_t)sv->c.i; svcul = svcul >> 31 & 1 ? svcul - ((uint64_t)1 << 32) : svcul; if (svr == (VT_LOCAL | VT_LVAL)) { @@ -502,7 +502,7 @@ ST_FUNC void load(int r, SValue *sv) if (svr == VT_CONST) { if ((svtt & VT_BTYPE) != VT_VOID) arm64_movimm(intr(r), arm64_type_size(svtt) == 3 ? - sv->c.ull : (uint32_t)svcul); + sv->c.i : (uint32_t)svcul); return; } @@ -558,7 +558,7 @@ ST_FUNC void store(int r, SValue *sv) int svtt = sv->type.t; int svr = sv->r & ~VT_LVAL_TYPE; int svrv = svr & VT_VALMASK; - uint64_t svcul = (uint32_t)sv->c.ul; + uint64_t svcul = (uint32_t)sv->c.i; svcul = svcul >> 31 & 1 ? svcul - ((uint64_t)1 << 32) : svcul; if (svr == (VT_LOCAL | VT_LVAL)) { @@ -1344,16 +1344,10 @@ static int arm64_iconst(uint64_t *val, SValue *sv) if ((sv->r & (VT_VALMASK | VT_LVAL | VT_SYM)) != VT_CONST) return 0; if (val) { - int t = sv->type.t & (VT_BTYPE | VT_UNSIGNED); - // It's crazy how TCC has all these alternatives for storing a value: - if (t == (VT_LLONG | VT_UNSIGNED)) - *val = sv->c.ull; - else if (t == VT_LLONG) - *val = sv->c.ll; - else if (t & VT_UNSIGNED) - *val = sv->c.ui; - else - *val = sv->c.i; + int t = sv->type.t; + *val = ((t & VT_BTYPE) == VT_LLONG ? sv->c.i : + (uint32_t)sv->c.i | + (t & VT_UNSIGNED ? 0 : -(sv->c.i & 0x80000000))); } return 1; } |
