[qfcc] Change ne to cmp for v6 string inequality check

Since it's really strcmp in disguise (makes the instruction consistent
across all targets).
This commit is contained in:
Bill Currie 2022-01-29 18:18:33 +09:00
parent baca7cbb4c
commit 7e9cf76cfe
2 changed files with 4 additions and 1 deletions

View file

@ -236,7 +236,7 @@ VISIBLE const v6p_opcode_t pr_v6p_opcodes[] = {
ev_quaternion, ev_quaternion, ev_int,
PROG_V6P_VERSION,
},
[OP_NE_S_v6p] = {"ne", "ne.s",
[OP_NE_S_v6p] = {"cmp", "ne.s",
ev_string, ev_string, ev_int,
PROG_ID_VERSION,
},

View file

@ -1548,6 +1548,9 @@ expr_expr (sblock_t *sblock, expr_t *e, operand_t **op)
opcode = convert_op (e->e.expr.op);
if (!opcode)
internal_error (e, "ice ice baby");
if (strcmp (opcode, "ne") == 0 && is_string (get_type (e->e.expr.e1))) {
opcode = "cmp";
}
s = new_statement (st_expr, opcode, e);
sblock = statement_subexpr (sblock, e->e.expr.e1, &s->opa);
sblock = statement_subexpr (sblock, e->e.expr.e2, &s->opb);