mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
[qfcc] Support dot product for all (float) vector types
While the code would handle int vector types, there aren't any such instructions, and the expression code shouldn't generate them, but all float (32 and 64 bit) vector types do have a dot product instruction, so check width rather than just vector/quaternion.
This commit is contained in:
parent
547cae03ae
commit
719fe5a935
1 changed files with 8 additions and 5 deletions
|
@ -149,7 +149,7 @@ _print_operand (operand_t *op)
|
|||
{
|
||||
switch (op->op_type) {
|
||||
case op_def:
|
||||
printf ("(%s) ", pr_type_name[op->type->type]);
|
||||
printf ("(%s) ", get_type_string (op->type));
|
||||
printf ("%s", op->def->name);
|
||||
break;
|
||||
case op_value:
|
||||
|
@ -160,12 +160,12 @@ _print_operand (operand_t *op)
|
|||
printf ("block %p", op->label->dest);
|
||||
break;
|
||||
case op_temp:
|
||||
printf ("tmp (%s) %p", pr_type_name[op->type->type], op);
|
||||
printf ("tmp (%s) %p", get_type_string (op->type), op);
|
||||
if (op->tempop.def)
|
||||
printf (" %s", op->tempop.def->name);
|
||||
break;
|
||||
case op_alias:
|
||||
printf ("alias(%s,", pr_type_name[op->type->type]);
|
||||
printf ("alias(%s,", get_type_string (op->type));
|
||||
_print_operand (op->alias);
|
||||
printf (")");
|
||||
break;
|
||||
|
@ -1633,10 +1633,13 @@ expr_expr (sblock_t *sblock, expr_t *e, operand_t **op)
|
|||
opcode = "cmp";
|
||||
}
|
||||
if (strcmp (opcode, "dot") == 0) {
|
||||
if (is_vector (get_type (e->e.expr.e1))) {
|
||||
if (type_width (get_type (e->e.expr.e1)) == 2) {
|
||||
opcode = "cdot";
|
||||
}
|
||||
if (type_width (get_type (e->e.expr.e1)) == 3) {
|
||||
opcode = "vdot";
|
||||
}
|
||||
if (is_quaternion (get_type (e->e.expr.e1))) {
|
||||
if (type_width (get_type (e->e.expr.e1)) == 4) {
|
||||
opcode = "qdot";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue