freedreno/computerator: support nop prefix

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4526>
This commit is contained in:
Jonathan Marek 2020-04-11 18:28:09 -04:00 committed by Marge Bot
parent 95d4a956c0
commit bc9a28beed
2 changed files with 6 additions and 1 deletions

View 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;

View 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