commit 9a7474c83432eee7c05a8436c44d2d1f2b1efd93
parent fd0e69ba135f7fc6fc9dc95917128fbc99b806ed
Author: Nihal Jere <nihal@nihaljere.xyz>
Date: Fri, 4 Feb 2022 18:46:04 -0600
x64: use 1 byte register for comparisons
Diffstat:
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/ir.c b/ir.c
@@ -248,7 +248,7 @@ genexpr(struct iproc *const out, const size_t expri, uint64_t *const val)
uint64_t arg;
int type = genexpr(out, expr->d.uop.expr, &arg);
assert(type == VT_TEMP);
- *val = assign(out, 4); // FIXME: how big should bools be?
+ *val = assign(out, 1); // FIXME: how big should bools be?
putins(out, IR_NOT, arg, VT_TEMP);
break;
}
diff --git a/x64.c b/x64.c
@@ -912,8 +912,8 @@ emitblock(struct data *const text, const struct iproc *const proc, const struct
switch (ins->op) {
case IR_NOT:
assert(ins->valtype == VT_TEMP);
- assert(size == 4);
- total += cmp_r32_r32(text, src, proc->temps.data[ins->val].reg);
+ assert(size == 1);
+ total += cmp_r8_imm(text, proc->temps.data[ins->val].reg, 1);
total += setne_reg(text, dest);
NEXT;
break;