summaryrefslogtreecommitdiff
path: root/assembler
diff options
context:
space:
mode:
authorXiang, Haihao <haihao.xiang@intel.com>2014-03-25 13:55:14 +0800
committerDamien Lespiau <damien.lespiau@intel.com>2014-05-19 22:49:25 +0100
commit737d248a127f51d20555de53b9dfe28ca4682b54 (patch)
treebca047ba8fcc328cc432425881926dd2ea5e50d1 /assembler
parent881afff297835faf67f55ed1e9db596e57fb4cd7 (diff)
assembler: distinguish the channel of .z from the condition of .z
The scratch patch only works for generic register Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75631 Tested-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Diffstat (limited to 'assembler')
-rw-r--r--assembler/lex.l45
1 files changed, 45 insertions, 0 deletions
diff --git a/assembler/lex.l b/assembler/lex.l
index 81a52baf..1ba576bf 100644
--- a/assembler/lex.l
+++ b/assembler/lex.l
@@ -24,6 +24,8 @@ int yycolumn = 1;
%x CHANNEL
%x LINENUMBER
%x FILENAME
+%x REG
+%x DOTSEL
%%
\/\/.*[\r\n] { yycolumn = 1; } /* eat up single-line comments */
@@ -247,8 +249,46 @@ yylval.integer = BRW_CHANNEL_W;
[gr][0-9]+ {
yylval.integer = atoi(yytext + 1);
+ BEGIN(REG);
return GENREG;
}
+<REG>"<" { return LANGLE; }
+<REG>[0-9][0-9]* {
+ yylval.integer = strtoul(yytext, NULL, 10);
+ return INTEGER;
+}
+<REG>">" { return RANGLE; }
+
+<REG>"," { return COMMA; }
+<REG>"." { BEGIN(DOTSEL); return DOT; }
+<REG>";" { return SEMICOLON; }
+
+<DOTSEL>"x" {
+ yylval.integer = BRW_CHANNEL_X;
+ return X;
+}
+<DOTSEL>"y" {
+ yylval.integer = BRW_CHANNEL_Y;
+ return Y;
+}
+<DOTSEL>"z" {
+ yylval.integer = BRW_CHANNEL_Z;
+ return Z;
+}
+<DOTSEL>"w" {
+ yylval.integer = BRW_CHANNEL_W;
+ return W;
+}
+<DOTSEL>[0-9][0-9]* {
+ yylval.integer = strtoul(yytext, NULL, 10);
+ BEGIN(REG);
+ return INTEGER;
+}
+<DOTSEL>. {
+ yyless(0);
+ BEGIN(INITIAL);
+}
+
[gr] {
return GENREGFILE;
}
@@ -296,6 +336,11 @@ yylval.integer = BRW_CHANNEL_W;
return LMS;
}
+<REG>. {
+ yyless(0);
+ BEGIN(INITIAL);
+}
+
/*
* Lexing of register types should probably require the ":" symbol specified
* in the BNF of the assembly, but our existing source didn't use that syntax.