diff options
| author | 2025-09-14 17:59:39 +0200 | |
|---|---|---|
| committer | 2025-09-14 18:24:05 +0200 | |
| commit | 7a318363ec4fdcd80d9d0154cef393c9bf205d5e (patch) | |
| tree | c254e3a3b985bc22e84480346c856052ef9963ca /c.c | |
| parent | 5753e393954aca532abd6a5c10d6e8ab9a96c96c (diff) | |
preliminary pie and pic
Diffstat (limited to 'c.c')
| -rw-r--r-- | c.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -2447,10 +2447,11 @@ genptroff(struct function *fn, enum op op, uint siz, union ref ptr, assert(siz); idx = cvt(fn, targ_sizetype, tt, idx); - if (siz == 1) off = idx; - else if (idx.t == RICON) - off = mkintcon(cls, idx.i * siz); - else if (ispo2(siz)) + if (siz == 1) off = idx; + else if (idx.t == RICON) { + if (op == Osub) op = Oadd, idx.i = -idx.i; + off = mkintcon(cls, idx.i * (int)siz); + } else if (ispo2(siz)) off = addinstr(fn, mkinstr(Oshl, cls, .l = idx, .r = mkintcon(cls, ilog2(siz)))); else |