commit 5c3500d282d81b52b2170bd9129d3207fc38cba1
parent 05eaf97669316cbcee41a9a81e06797d36349d9d
Author: Drew DeVault <sir@cmpwn.com>
Date: Sat, 14 Aug 2021 14:30:59 +0200
gen: fix negation
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/gen.c b/src/gen.c
@@ -2486,8 +2486,8 @@ gen_expr_unarithm(struct gen_context *ctx,
val = gen_expr(ctx, operand);
temp = mktemp(ctx, operand->result, ".%d");
qval = mkqval(ctx, &val), qtmp = mkqval(ctx, &temp);
- struct qbe_value minusone = constl(-1);
- pushi(ctx->current, &qtmp, Q_MUL, &qval, &minusone, NULL);
+ struct qbe_value zero = constl(0);
+ pushi(ctx->current, &qtmp, Q_SUB, &zero, &qval, NULL);
return temp;
case UN_PLUS:
return gen_expr(ctx, operand);