aboutsummaryrefslogtreecommitdiff
path: root/qbe.c
diff options
context:
space:
mode:
Diffstat (limited to 'qbe.c')
-rw-r--r--qbe.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/qbe.c b/qbe.c
index 68bc1b3..6dc7ff1 100644
--- a/qbe.c
+++ b/qbe.c
@@ -290,15 +290,13 @@ funcstore(struct func *f, struct type *t, enum typequal tq, struct lvalue lval,
}
if (lval.bits.before || lval.bits.after) {
mask = 0xffffffffffffffffu >> lval.bits.after + 64 - t->size * 8 ^ (1 << lval.bits.before) - 1;
- v = funcinst(f, IOR, t->repr,
+ v = funcinst(f, ISHL, t->repr, v, mkintconst(&i32, lval.bits.before));
+ v = funcinst(f, IAND, t->repr, v, mkintconst(t->repr, mask));
+ v = funcinst(f, IOR, t->repr, v,
funcinst(f, IAND, t->repr,
funcinst(f, loadop, t->repr, lval.addr),
mkintconst(t->repr, ~mask),
),
- funcinst(f, IAND, t->repr,
- funcinst(f, ISHL, t->repr, v, mkintconst(&i32, lval.bits.before)),
- mkintconst(t->repr, mask),
- ),
);
}
funcinst(f, storeop, NULL, v, lval.addr);