mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-07 16:31:32 +00:00
[qfcc] Implement ruamoko conversion instructions
Thanks to me having done something right 20 years ago, that was pretty easy :). The two boolean types aren't supported yet because I haven't decided on just how to represent their types in qfcc.
This commit is contained in:
parent
16a203c643
commit
479ec07fd4
1 changed files with 18 additions and 0 deletions
|
@ -1318,6 +1318,17 @@ expr_expr (sblock_t *sblock, expr_t *e, operand_t **op)
|
||||||
return sblock;
|
return sblock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int type_map[ev_type_count] = {
|
||||||
|
[ev_int] = 0,
|
||||||
|
[ev_float] = 1,
|
||||||
|
[ev_long] = 2,
|
||||||
|
[ev_double] = 3,
|
||||||
|
[ev_uint] = 4,
|
||||||
|
//[ev_bool32] = 5,
|
||||||
|
[ev_ulong] = 6,
|
||||||
|
//[ev_bool64] = 7,
|
||||||
|
};
|
||||||
|
|
||||||
static sblock_t *
|
static sblock_t *
|
||||||
expr_cast (sblock_t *sblock, expr_t *e, operand_t **op)
|
expr_cast (sblock_t *sblock, expr_t *e, operand_t **op)
|
||||||
{
|
{
|
||||||
|
@ -1332,6 +1343,13 @@ expr_cast (sblock_t *sblock, expr_t *e, operand_t **op)
|
||||||
*op = temp_operand (e->e.expr.type, e);
|
*op = temp_operand (e->e.expr.type, e);
|
||||||
s = new_statement (st_expr, "conv", e);
|
s = new_statement (st_expr, "conv", e);
|
||||||
s->opa = src;
|
s->opa = src;
|
||||||
|
if (options.code.progsversion == PROG_VERSION) {
|
||||||
|
int from = type_map[src_type->type];
|
||||||
|
int to = type_map[type->type];
|
||||||
|
int width = type_width (src_type) - 1;
|
||||||
|
int conv = (width << 6) | (from << 3) | to;
|
||||||
|
s->opb = short_operand (conv, e);
|
||||||
|
}
|
||||||
s->opc = *op;
|
s->opc = *op;
|
||||||
sblock_add_statement (sblock, s);
|
sblock_add_statement (sblock, s);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue