From bc9a28beed0c7764f2c17dd96a8ac6833af34445 Mon Sep 17 00:00:00 2001 From: Jonathan Marek Date: Sat, 11 Apr 2020 18:28:09 -0400 Subject: [PATCH] freedreno/computerator: support nop prefix Signed-off-by: Jonathan Marek Part-of: --- src/freedreno/computerator/ir3_lexer.l | 1 + src/freedreno/computerator/ir3_parser.y | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/freedreno/computerator/ir3_lexer.l b/src/freedreno/computerator/ir3_lexer.l index 5823dd0e43c..44ccd47904c 100644 --- a/src/freedreno/computerator/ir3_lexer.l +++ b/src/freedreno/computerator/ir3_lexer.l @@ -91,6 +91,7 @@ static int parse_reg(const char *str) "(ei)" return TOKEN(T_EI); "(jp)" return TOKEN(T_JP); "(rpt"[0-7]")" ir3_yylval.num = strtol(yytext+4, NULL, 10); return T_RPT; +"(nop"[0-7]")" ir3_yylval.num = strtol(yytext+4, NULL, 10); return T_NOP; "("[x]?[y]?[z]?[w]?")" ir3_yylval.num = parse_wrmask(yytext); return T_WRMASK; [h]?"r"[0-9]+"."[xyzw] ir3_yylval.num = parse_reg(yytext); return T_REGISTER; diff --git a/src/freedreno/computerator/ir3_parser.y b/src/freedreno/computerator/ir3_parser.y index 349b5578eda..1dfa2c0f687 100644 --- a/src/freedreno/computerator/ir3_parser.y +++ b/src/freedreno/computerator/ir3_parser.y @@ -65,6 +65,7 @@ static struct ir3_instruction *instr; /* current instruction */ static struct { unsigned flags; unsigned repeat; + unsigned nop; } iflags; static struct { @@ -79,8 +80,9 @@ static struct ir3_instruction * new_instr(opc_t opc) instr = ir3_instr_create(block, opc); instr->flags = iflags.flags; instr->repeat = iflags.repeat; + instr->nop = iflags.nop; instr->line = ir3_yyget_lineno(); - iflags.flags = iflags.repeat = 0; + iflags.flags = iflags.repeat = iflags.nop = 0; return instr; } @@ -266,6 +268,7 @@ static void print_token(FILE *file, int type, YYSTYPE value) %token T_JP %token T_RPT %token T_UL +%token T_NOP /* category 0: */ %token T_OP_NOP @@ -540,6 +543,7 @@ iflag: T_SY { iflags.flags |= IR3_INSTR_SY; } | T_JP { iflags.flags |= IR3_INSTR_JP; } | T_RPT { iflags.repeat = $1; } | T_UL { iflags.flags |= IR3_INSTR_UL; } +| T_NOP { iflags.nop = $1; } iflags: | iflag iflags -- 2.30.2