qbe

Internal scc patchset buffer for QBE
Log | Files | Refs | README | LICENSE

commit e7c13e8d0191d9e8987af42a8561fceba0f6c2f1
parent 4e93eeaa3b63b6ae50954a29662cc3ea6be48b23
Author: Paul Ouellette <oue.paul18@gmail.com>
Date:   Wed, 23 Feb 2022 10:33:16 -0500

fix folding of shifts of word operand by >32

Diffstat:
Mfold.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fold.c b/fold.c @@ -377,9 +377,9 @@ foldint(Con *res, int op, int w, Con *cl, Con *cr) case Oand: x = l.u & r.u; break; case Oor: x = l.u | r.u; break; case Oxor: x = l.u ^ r.u; break; - case Osar: x = (w ? l.s : (int32_t)l.s) >> (r.u & 63); break; - case Oshr: x = (w ? l.u : (uint32_t)l.u) >> (r.u & 63); break; - case Oshl: x = l.u << (r.u & 63); break; + case Osar: x = (w ? l.s : (int32_t)l.s) >> (r.u & (31|w<<5)); break; + case Oshr: x = (w ? l.u : (uint32_t)l.u) >> (r.u & (31|w<<5)); break; + case Oshl: x = l.u << (r.u & (31|w<<5)); break; case Oextsb: x = (int8_t)l.u; break; case Oextub: x = (uint8_t)l.u; break; case Oextsh: x = (int16_t)l.u; break;