aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ops.h1
-rw-r--r--qbe.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/ops.h b/ops.h
index b8b461a..9b2d48b 100644
--- a/ops.h
+++ b/ops.h
@@ -1,6 +1,7 @@
/* arithmetic and bits */
OP(IADD, "add")
OP(ISUB, "sub")
+OP(INEG, "neg")
OP(IDIV, "div")
OP(IMUL, "mul")
OP(IUDIV, "udiv")
diff --git a/qbe.c b/qbe.c
index 81ed566..41a38da 100644
--- a/qbe.c
+++ b/qbe.c
@@ -803,7 +803,7 @@ funcexpr(struct func *f, struct expr *e)
return funcload(f, e->type, (struct lvalue){r});
case TSUB:
r = funcexpr(f, e->base);
- return funcinst(f, ISUB, qbetype(e->type).base, mkintconst(0), r);
+ return funcinst(f, INEG, qbetype(e->type).base, r, NULL);
}
fatal("internal error; unknown unary expression");
break;