freedreno/ir3: Fix cat1 parser ambiguity vs FLUTs

The lexer can't really tell the difference.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31446>
This commit is contained in:
Rob Clark
2024-09-30 09:23:10 -07:00
committed by Marge Bot
parent 0633a23dc9
commit 8ddfe9cfc8
+8
View File
@@ -1562,6 +1562,9 @@ relative: relative_gpr_src
/* cat1 immediates differ slighly in the floating point case from the cat2
* case which can only encode certain predefined values (ie. and index into
* the FLUT table)
*
* We have to special cases a few FLUT values which are ambiguous from the
* lexer PoV.
*/
immediate_cat1: integer { new_src(0, IR3_REG_IMMED)->iim_val = type_size(instr->cat1.src_type) < 32 ? $1 & 0xffff : $1; }
| '(' integer ')' { new_src(0, IR3_REG_IMMED)->fim_val = $2; }
@@ -1570,6 +1573,11 @@ immediate_cat1: integer { new_src(0, IR3_REG_IMMED)->iim_val = ty
| 'h' '(' float ')' { new_src(0, IR3_REG_IMMED | IR3_REG_HALF)->uim_val = _mesa_float_to_half($3); }
| '(' T_NAN ')' { new_src(0, IR3_REG_IMMED)->fim_val = NAN; }
| '(' T_INF ')' { new_src(0, IR3_REG_IMMED)->fim_val = INFINITY; }
| T_FLUT_0_0 { new_src(0, IR3_REG_IMMED)->fim_val = 0.0; }
| T_FLUT_0_5 { new_src(0, IR3_REG_IMMED)->fim_val = 0.5; }
| T_FLUT_1_0 { new_src(0, IR3_REG_IMMED)->fim_val = 1.0; }
| T_FLUT_2_0 { new_src(0, IR3_REG_IMMED)->fim_val = 2.0; }
| T_FLUT_4_0 { new_src(0, IR3_REG_IMMED)->fim_val = 4.0; }
immediate: integer { new_src(0, IR3_REG_IMMED)->iim_val = $1; }
| '(' integer ')' { new_src(0, IR3_REG_IMMED)->fim_val = $2; }