aboutsummaryrefslogtreecommitdiff
path: root/qbe.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2022-02-10 15:35:56 -0800
committerMichael Forney <mforney@mforney.org>2022-02-10 15:35:56 -0800
commit28fdb0f046184e567e85b9bb40dc942ca1739d9f (patch)
treef292aa8a8f6934be35ca9982effb5bd5e811d368 /qbe.c
parent704382569df976ab94d2b4d6ef7b5926c2de5de0 (diff)
qbe: Switch to unary negation
This fixes bugs involving floating point negative zero.
Diffstat (limited to 'qbe.c')
-rw-r--r--qbe.c2
1 files changed, 1 insertions, 1 deletions
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;