[qfcc] Correct swizzle expressions

It turned out they were always using floats for the source type (meaning
doubles were broken), and not shifting the component in the final sizzle
code meaning all swizzles were ?xxx (neglecting minus or 0). I'd make
tests, but I plan on modifying the instruction set a little bit.
This commit is contained in:
Bill Currie 2023-08-24 21:39:35 +09:00
parent fb6d3f2f86
commit e66ae0aad6
2 changed files with 2 additions and 2 deletions

View file

@ -699,7 +699,7 @@ new_swizzle_expr (expr_t *src, const char *swizzle)
} }
} }
swiz.zero |= (0xf << comp_count) & 0xf; swiz.zero |= (0xf << comp_count) & 0xf;
swiz.src = new_alias_expr (vector_type (&type_float, src_width), src); swiz.src = new_alias_expr (vector_type (base_type (src_type), src_width), src);
swiz.type = vector_type (base_type (src_type), 4); swiz.type = vector_type (base_type (src_type), 4);
expr_t *expr = new_expr (); expr_t *expr = new_expr ();

View file

@ -1810,7 +1810,7 @@ expr_swizzle (sblock_t *sblock, expr_t *e, operand_t **op)
type_t *res_type = e->e.swizzle.type; type_t *res_type = e->e.swizzle.type;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
swiz |= e->e.swizzle.source[i] & 3; swiz |= (e->e.swizzle.source[i] & 3) << (2 * i);
} }
swiz |= (e->e.swizzle.neg & 0xf) << 8; swiz |= (e->e.swizzle.neg & 0xf) << 8;
swiz |= (e->e.swizzle.zero & 0xf) << 12; swiz |= (e->e.swizzle.zero & 0xf) << 12;