aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qbe.c6
-rw-r--r--test/struct-copy.qbe6
2 files changed, 7 insertions, 5 deletions
diff --git a/qbe.c b/qbe.c
index ea8a52e..b255d93 100644
--- a/qbe.c
+++ b/qbe.c
@@ -299,21 +299,23 @@ static void
funccopy(struct func *f, struct value *dst, struct value *src, uint64_t size, int align)
{
enum instkind load, store;
+ int class;
struct value *tmp, *inc;
uint64_t off;
+ class = 'w';
switch (align) {
case 1: load = ILOADUB, store = ISTOREB; break;
case 2: load = ILOADUH, store = ISTOREH; break;
case 4: load = ILOADW, store = ISTOREW; break;
- case 8: load = ILOADL, store = ISTOREL; break;
+ case 8: load = ILOADL, store = ISTOREL, class = 'l'; break;
default:
fatal("internal error; invalid alignment %d", align);
}
inc = mkintconst(align);
off = 0;
for (;;) {
- tmp = funcinst(f, load, ptrclass, src, NULL);
+ tmp = funcinst(f, load, class, src, NULL);
funcinst(f, store, 0, tmp, dst);
off += align;
if (off >= size)
diff --git a/test/struct-copy.qbe b/test/struct-copy.qbe
index 0e0dce3..0fa624f 100644
--- a/test/struct-copy.qbe
+++ b/test/struct-copy.qbe
@@ -3,15 +3,15 @@ function $f() {
@start.1
%.1 =l alloc4 12
@body.2
- %.2 =l loadw $x
+ %.2 =w loadw $x
storew %.2, %.1
%.3 =l add $x, 4
%.4 =l add %.1, 4
- %.5 =l loadw %.3
+ %.5 =w loadw %.3
storew %.5, %.4
%.6 =l add %.3, 4
%.7 =l add %.4, 4
- %.8 =l loadw %.6
+ %.8 =w loadw %.6
storew %.8, %.7
ret
}