freedreno/computerator: support nop prefix
authorJonathan Marek <jonathan@marek.ca>
Sat, 11 Apr 2020 22:28:09 +0000 (18:28 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 13 Apr 2020 20:15:48 +0000 (20:15 +0000)
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4526>

src/freedreno/computerator/ir3_lexer.l
src/freedreno/computerator/ir3_parser.y

index 5823dd0e43cc12dfb1fac074bdde89fbb120f7d5..44ccd47904c8e85b584b831935ebaee44efecca1 100644 (file)
@@ -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;
index 349b5578eda54f17aad147157434c80331c0e9c5..1dfa2c0f6875b7a222296089c3f4e5c0429b5bc8 100644 (file)
@@ -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 <tok> T_JP
 %token <num> T_RPT
 %token <tok> T_UL
+%token <tok> T_NOP
 
 /* category 0: */
 %token <tok> 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