1 /*
2 * Copyright (c) 2013 Rob Clark <[email protected]>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 */
23
24 %{
25 #include <stdlib.h>
26 #include "util/ralloc.h"
27 #include "ir3/ir3.h"
28 #include "ir3_parser.h"
29
30 #define YY_NO_INPUT
31 #define YY_NO_UNPUT
32 #define TOKEN(t) (ir3_yylval.tok = t)
33 extern YYSTYPE ir3_yylval;
34 extern void *ir3_parser_dead_ctx;
35
36 void ir3_yyset_input(FILE *f);
37
ir3_yyset_input(FILE * f)38 void ir3_yyset_input(FILE *f)
39 {
40 YY_FLUSH_BUFFER;
41 ir3_yyin = f;
42 }
43
parse_wrmask(const char * src)44 static int parse_wrmask(const char *src)
45 {
46 int i, num = 0;
47 for (i = 0; i < 4; i++) {
48 if ("xyzw"[i] == src[1]) {
49 num |= (1 << i);
50 src++;
51 }
52 }
53 return num;
54 }
55
parse_reg(const char * str)56 static int parse_reg(const char *str)
57 {
58 int num = 0;
59 if (str[0] == 'h') {
60 str++;
61 num++;
62 }
63 str++;
64 num += strtol(str, (char **)&str, 10) << 3;
65 switch (str[1]) {
66 case 'x': num += 0; break;
67 case 'y': num += 2; break;
68 case 'z': num += 4; break;
69 case 'w': num += 6; break;
70 default: assert(0); break;
71 }
72 return num;
73 }
74
75 %}
76
77 %option noyywrap
78 %option prefix="ir3_yy"
79
80 %%
81 "\n" yylineno++;
82 [ \t] ; /* ignore whitespace */
83 ";"[^\n]*"\n" yylineno++; /* ignore comments */
84 "(0.0)" ir3_yylval.num = 0; return T_FLUT_0_0;
85 "(0.5)" ir3_yylval.num = 1; return T_FLUT_0_5;
86 "(1.0)" ir3_yylval.num = 2; return T_FLUT_1_0;
87 "(2.0)" ir3_yylval.num = 3; return T_FLUT_2_0;
88 "(e)" ir3_yylval.num = 4; return T_FLUT_E;
89 "(pi)" ir3_yylval.num = 5; return T_FLUT_PI;
90 "(1/pi)" ir3_yylval.num = 6; return T_FLUT_INV_PI;
91 "(1/log2(e))" ir3_yylval.num = 7; return T_FLUT_INV_LOG2_E;
92 "(log2(e))" ir3_yylval.num = 8; return T_FLUT_LOG2_E;
93 "(1/log2(10))" ir3_yylval.num = 9; return T_FLUT_INV_LOG2_10;
94 "(log2(10))" ir3_yylval.num = 10; return T_FLUT_LOG2_10;
95 "(4.0)" ir3_yylval.num = 11; return T_FLUT_4_0;
96 [0-9]+"."[0-9]+ ir3_yylval.flt = strtod(yytext, NULL); return T_FLOAT;
97 [0-9]* ir3_yylval.num = strtoul(yytext, NULL, 0); return T_INT;
98 "0x"[0-9a-fA-F]* ir3_yylval.num = strtoul(yytext, NULL, 0); return T_HEX;
99 "raw 0x"[0-9a-fA-F]* ir3_yylval.u64 = strtoull(yytext + 4, NULL, 0); return T_RAW;
100 "@localsize" return TOKEN(T_A_LOCALSIZE);
101 "@const" return TOKEN(T_A_CONST);
102 "@buf" return TOKEN(T_A_BUF);
103 "@invocationid" return TOKEN(T_A_INVOCATIONID);
104 "@wgid" return TOKEN(T_A_WGID);
105 "@numwg" return TOKEN(T_A_NUMWG);
106 "@branchstack" return TOKEN(T_A_BRANCHSTACK);
107 "@in" return TOKEN(T_A_IN);
108 "@out" return TOKEN(T_A_OUT);
109 "@tex" return TOKEN(T_A_TEX);
110 "@pvtmem" return TOKEN(T_A_PVTMEM);
111 "@earlypreamble" return TOKEN(T_A_EARLYPREAMBLE);
112 "(sy)" return TOKEN(T_SY);
113 "(ss)" return TOKEN(T_SS);
114 "(absneg)" return TOKEN(T_ABSNEG);
115 "(neg)" return TOKEN(T_NEG);
116 "(abs)" return TOKEN(T_ABS);
117 "(r)" return TOKEN(T_R);
118 "(last)" return TOKEN(T_LAST);
119 "(ul)" return TOKEN(T_UL);
120 "(even)" return TOKEN(T_EVEN);
121 "(pos_infinity)" return TOKEN(T_POS_INFINITY);
122 "(neg_infinity)" return TOKEN(T_NEG_INFINITY);
123 "(ei)" return TOKEN(T_EI);
124 "(jp)" return TOKEN(T_JP);
125 "(eq)" return TOKEN(T_EQ_FLAG);
126 "(sat)" return TOKEN(T_SAT);
127 "(rpt"[0-7]")" ir3_yylval.num = strtol(yytext+4, NULL, 10); return T_RPT;
128 "(nop"[0-7]")" ir3_yylval.num = strtol(yytext+4, NULL, 10); return T_NOP;
129 "("[x]?[y]?[z]?[w]?")" ir3_yylval.num = parse_wrmask(yytext); return T_WRMASK;
130
131 [h]?"r"[0-9]+"."[xyzw] ir3_yylval.num = parse_reg(yytext); return T_REGISTER;
132 [h]?"c"[0-9]+"."[xyzw] ir3_yylval.num = parse_reg(yytext); return T_CONSTANT;
133 "a0.x" return T_A0;
134 "a1.x" return T_A1;
135 "p0."[xyzw] ir3_yylval.num = parse_reg(yytext); return T_P0;
136 "w"[0-9]+ ir3_yylval.num = strtol(yytext+1, NULL, 10); return T_W;
137 "s#"[0-9]+ ir3_yylval.num = strtol(yytext+2, NULL, 10); return T_SAMP;
138 "t#"[0-9]+ ir3_yylval.num = strtol(yytext+2, NULL, 10); return T_TEX;
139
140 /* category 0: */
141 "nop" return TOKEN(T_OP_NOP);
142 "br" return TOKEN(T_OP_BR);
143 "brao" return TOKEN(T_OP_BRAO);
144 "braa" return TOKEN(T_OP_BRAA);
145 "brac" return TOKEN(T_OP_BRAC);
146 "bany" return TOKEN(T_OP_BANY);
147 "ball" return TOKEN(T_OP_BALL);
148 "brax" return TOKEN(T_OP_BRAX);
149 "jump" return TOKEN(T_OP_JUMP);
150 "call" return TOKEN(T_OP_CALL);
151 "ret" return TOKEN(T_OP_RET);
152 "kill" return TOKEN(T_OP_KILL);
153 "end" return TOKEN(T_OP_END);
154 "emit" return TOKEN(T_OP_EMIT);
155 "cut" return TOKEN(T_OP_CUT);
156 "chmask" return TOKEN(T_OP_CHMASK);
157 "chsh" return TOKEN(T_OP_CHSH);
158 "flow_rev" return TOKEN(T_OP_FLOW_REV);
159 "bkt" return TOKEN(T_OP_BKT);
160 "stks" return TOKEN(T_OP_STKS);
161 "stkr" return TOKEN(T_OP_STKR);
162 "xset" return TOKEN(T_OP_XSET);
163 "xclr" return TOKEN(T_OP_XCLR);
164 "getlast" return TOKEN(T_OP_GETLAST);
165 "getone" return TOKEN(T_OP_GETONE);
166 "dbg" return TOKEN(T_OP_DBG);
167 "shps" return TOKEN(T_OP_SHPS);
168 "shpe" return TOKEN(T_OP_SHPE);
169 "predt" return TOKEN(T_OP_PREDT);
170 "predf" return TOKEN(T_OP_PREDF);
171 "prede" return TOKEN(T_OP_PREDE);
172
173 /* category 1: */
174 "movmsk" return TOKEN(T_OP_MOVMSK);
175 "mova1" return TOKEN(T_OP_MOVA1);
176 "mova" return TOKEN(T_OP_MOVA);
177 "mov" return TOKEN(T_OP_MOV);
178 "cov" return TOKEN(T_OP_COV);
179 "swz" return TOKEN(T_OP_SWZ);
180 "gat" return TOKEN(T_OP_GAT);
181 "sct" return TOKEN(T_OP_SCT);
182
183 ("f16"|"f32"|"u16"|"u32"|"s16"|"s32"|"u8"|"u8_32"){2} ir3_yylval.str = yytext; return T_CAT1_TYPE_TYPE;
184
185 /* category 2: */
186 "add.f" return TOKEN(T_OP_ADD_F);
187 "min.f" return TOKEN(T_OP_MIN_F);
188 "max.f" return TOKEN(T_OP_MAX_F);
189 "mul.f" return TOKEN(T_OP_MUL_F);
190 "sign.f" return TOKEN(T_OP_SIGN_F);
191 "cmps.f" return TOKEN(T_OP_CMPS_F);
192 "absneg.f" return TOKEN(T_OP_ABSNEG_F);
193 "cmpv.f" return TOKEN(T_OP_CMPV_F);
194 "floor.f" return TOKEN(T_OP_FLOOR_F);
195 "ceil.f" return TOKEN(T_OP_CEIL_F);
196 "rndne.f" return TOKEN(T_OP_RNDNE_F);
197 "rndaz.f" return TOKEN(T_OP_RNDAZ_F);
198 "trunc.f" return TOKEN(T_OP_TRUNC_F);
199 "add.u" return TOKEN(T_OP_ADD_U);
200 "add.s" return TOKEN(T_OP_ADD_S);
201 "sub.u" return TOKEN(T_OP_SUB_U);
202 "sub.s" return TOKEN(T_OP_SUB_S);
203 "cmps.u" return TOKEN(T_OP_CMPS_U);
204 "cmps.s" return TOKEN(T_OP_CMPS_S);
205 "min.u" return TOKEN(T_OP_MIN_U);
206 "min.s" return TOKEN(T_OP_MIN_S);
207 "max.u" return TOKEN(T_OP_MAX_U);
208 "max.s" return TOKEN(T_OP_MAX_S);
209 "absneg.s" return TOKEN(T_OP_ABSNEG_S);
210 "and.b" return TOKEN(T_OP_AND_B);
211 "or.b" return TOKEN(T_OP_OR_B);
212 "not.b" return TOKEN(T_OP_NOT_B);
213 "xor.b" return TOKEN(T_OP_XOR_B);
214 "cmpv.u" return TOKEN(T_OP_CMPV_U);
215 "cmpv.s" return TOKEN(T_OP_CMPV_S);
216 "mul.u24" return TOKEN(T_OP_MUL_U24);
217 "mul.s24" return TOKEN(T_OP_MUL_S24);
218 "mull.u" return TOKEN(T_OP_MULL_U);
219 "bfrev.b" return TOKEN(T_OP_BFREV_B);
220 "clz.s" return TOKEN(T_OP_CLZ_S);
221 "clz.b" return TOKEN(T_OP_CLZ_B);
222 "shl.b" return TOKEN(T_OP_SHL_B);
223 "shr.b" return TOKEN(T_OP_SHR_B);
224 "ashr.b" return TOKEN(T_OP_ASHR_B);
225 "bary.f" return TOKEN(T_OP_BARY_F);
226 "flat.b" return TOKEN(T_OP_FLAT_B);
227 "mgen.b" return TOKEN(T_OP_MGEN_B);
228 "getbit.b" return TOKEN(T_OP_GETBIT_B);
229 "setrm" return TOKEN(T_OP_SETRM);
230 "cbits.b" return TOKEN(T_OP_CBITS_B);
231 "shb" return TOKEN(T_OP_SHB);
232 "msad" return TOKEN(T_OP_MSAD);
233
234 /* category 3: */
235 "mad.u16" return TOKEN(T_OP_MAD_U16);
236 "madsh.u16" return TOKEN(T_OP_MADSH_U16);
237 "mad.s16" return TOKEN(T_OP_MAD_S16);
238 "madsh.m16" return TOKEN(T_OP_MADSH_M16);
239 "mad.u24" return TOKEN(T_OP_MAD_U24);
240 "mad.s24" return TOKEN(T_OP_MAD_S24);
241 "mad.f16" return TOKEN(T_OP_MAD_F16);
242 "mad.f32" return TOKEN(T_OP_MAD_F32);
243 "sel.b16" return TOKEN(T_OP_SEL_B16);
244 "sel.b32" return TOKEN(T_OP_SEL_B32);
245 "sel.s16" return TOKEN(T_OP_SEL_S16);
246 "sel.s32" return TOKEN(T_OP_SEL_S32);
247 "sel.f16" return TOKEN(T_OP_SEL_F16);
248 "sel.f32" return TOKEN(T_OP_SEL_F32);
249 "sad.s16" return TOKEN(T_OP_SAD_S16);
250 "sad.s32" return TOKEN(T_OP_SAD_S32);
251 "shrm" return TOKEN(T_OP_SHRM);
252 "shlm" return TOKEN(T_OP_SHLM);
253 "shrg" return TOKEN(T_OP_SHRG);
254 "shlg" return TOKEN(T_OP_SHLG);
255 "andg" return TOKEN(T_OP_ANDG);
256 "dp2acc" return TOKEN(T_OP_DP2ACC);
257 "dp4acc" return TOKEN(T_OP_DP4ACC);
258 "wmm" return TOKEN(T_OP_WMM);
259 "wmm.accu" return TOKEN(T_OP_WMM_ACCU);
260
261 /* category 4: */
262 "rcp" return TOKEN(T_OP_RCP);
263 "rsq" return TOKEN(T_OP_RSQ);
264 "log2" return TOKEN(T_OP_LOG2);
265 "exp2" return TOKEN(T_OP_EXP2);
266 "sin" return TOKEN(T_OP_SIN);
267 "cos" return TOKEN(T_OP_COS);
268 "sqrt" return TOKEN(T_OP_SQRT);
269 "hrsq" return TOKEN(T_OP_HRSQ);
270 "hlog2" return TOKEN(T_OP_HLOG2);
271 "hexp2" return TOKEN(T_OP_HEXP2);
272
273 /* category 5: */
274 "isam" return TOKEN(T_OP_ISAM);
275 "isaml" return TOKEN(T_OP_ISAML);
276 "isamm" return TOKEN(T_OP_ISAMM);
277 "sam" return TOKEN(T_OP_SAM);
278 "samb" return TOKEN(T_OP_SAMB);
279 "saml" return TOKEN(T_OP_SAML);
280 "samgq" return TOKEN(T_OP_SAMGQ);
281 "getlod" return TOKEN(T_OP_GETLOD);
282 "conv" return TOKEN(T_OP_CONV);
283 "convm" return TOKEN(T_OP_CONVM);
284 "getsize" return TOKEN(T_OP_GETSIZE);
285 "getbuf" return TOKEN(T_OP_GETBUF);
286 "getpos" return TOKEN(T_OP_GETPOS);
287 "getinfo" return TOKEN(T_OP_GETINFO);
288 "dsx" return TOKEN(T_OP_DSX);
289 "dsy" return TOKEN(T_OP_DSY);
290 "gather4r" return TOKEN(T_OP_GATHER4R);
291 "gather4g" return TOKEN(T_OP_GATHER4G);
292 "gather4b" return TOKEN(T_OP_GATHER4B);
293 "gather4a" return TOKEN(T_OP_GATHER4A);
294 "samgp0" return TOKEN(T_OP_SAMGP0);
295 "samgp1" return TOKEN(T_OP_SAMGP1);
296 "samgp2" return TOKEN(T_OP_SAMGP2);
297 "samgp3" return TOKEN(T_OP_SAMGP3);
298 "dsxpp.1" return TOKEN(T_OP_DSXPP_1);
299 "dsypp.1" return TOKEN(T_OP_DSYPP_1);
300 "rgetpos" return TOKEN(T_OP_RGETPOS);
301 "rgetinfo" return TOKEN(T_OP_RGETINFO);
302 "brcst.active" return TOKEN(T_OP_BRCST_A);
303 "quad_shuffle.brcst" return TOKEN(T_OP_QSHUFFLE_BRCST);
304 "quad_shuffle.horiz" return TOKEN(T_OP_QSHUFFLE_H);
305 "quad_shuffle.vert" return TOKEN(T_OP_QSHUFFLE_V);
306 "quad_shuffle.diag" return TOKEN(T_OP_QSHUFFLE_DIAG);
307 "tcinv" return TOKEN(T_OP_TCINV);
308
309 /* category 6: */
310 "ldg" return TOKEN(T_OP_LDG);
311 "ldg.a" return TOKEN(T_OP_LDG_A);
312 "ldg.k" return TOKEN(T_OP_LDG_K);
313 "ldl" return TOKEN(T_OP_LDL);
314 "ldp" return TOKEN(T_OP_LDP);
315 "stg" return TOKEN(T_OP_STG);
316 "stg.a" return TOKEN(T_OP_STG_A);
317 "stl" return TOKEN(T_OP_STL);
318 "stp" return TOKEN(T_OP_STP);
319 "ldib" return TOKEN(T_OP_LDIB);
320 "g2l" return TOKEN(T_OP_G2L);
321 "l2g" return TOKEN(T_OP_L2G);
322 "prefetch" return TOKEN(T_OP_PREFETCH);
323 "ldlw" return TOKEN(T_OP_LDLW);
324 "stlw" return TOKEN(T_OP_STLW);
325 "resfmt" return TOKEN(T_OP_RESFMT);
326 "resinfo" return TOKEN(T_OP_RESINFO);
327 "atomic.add" return TOKEN(T_OP_ATOMIC_ADD);
328 "atomic.sub" return TOKEN(T_OP_ATOMIC_SUB);
329 "atomic.xchg" return TOKEN(T_OP_ATOMIC_XCHG);
330 "atomic.inc" return TOKEN(T_OP_ATOMIC_INC);
331 "atomic.dec" return TOKEN(T_OP_ATOMIC_DEC);
332 "atomic.cmpxchg" return TOKEN(T_OP_ATOMIC_CMPXCHG);
333 "atomic.min" return TOKEN(T_OP_ATOMIC_MIN);
334 "atomic.max" return TOKEN(T_OP_ATOMIC_MAX);
335 "atomic.and" return TOKEN(T_OP_ATOMIC_AND);
336 "atomic.or" return TOKEN(T_OP_ATOMIC_OR);
337 "atomic.xor" return TOKEN(T_OP_ATOMIC_XOR);
338 "resinfo.b" return TOKEN(T_OP_RESINFO_B);
339 "ldib.b" return TOKEN(T_OP_LDIB_B);
340 "stib.b" return TOKEN(T_OP_STIB_B);
341 "atomic.b.add" return TOKEN(T_OP_ATOMIC_B_ADD);
342 "atomic.b.sub" return TOKEN(T_OP_ATOMIC_B_SUB);
343 "atomic.b.xchg" return TOKEN(T_OP_ATOMIC_B_XCHG);
344 "atomic.b.inc" return TOKEN(T_OP_ATOMIC_B_INC);
345 "atomic.b.dec" return TOKEN(T_OP_ATOMIC_B_DEC);
346 "atomic.b.cmpxchg" return TOKEN(T_OP_ATOMIC_B_CMPXCHG);
347 "atomic.b.min" return TOKEN(T_OP_ATOMIC_B_MIN);
348 "atomic.b.max" return TOKEN(T_OP_ATOMIC_B_MAX);
349 "atomic.b.and" return TOKEN(T_OP_ATOMIC_B_AND);
350 "atomic.b.or" return TOKEN(T_OP_ATOMIC_B_OR);
351 "atomic.b.xor" return TOKEN(T_OP_ATOMIC_B_XOR);
352 "atomic.s.add" return TOKEN(T_OP_ATOMIC_S_ADD);
353 "atomic.s.sub" return TOKEN(T_OP_ATOMIC_S_SUB);
354 "atomic.s.xchg" return TOKEN(T_OP_ATOMIC_S_XCHG);
355 "atomic.s.inc" return TOKEN(T_OP_ATOMIC_S_INC);
356 "atomic.s.dec" return TOKEN(T_OP_ATOMIC_S_DEC);
357 "atomic.s.cmpxchg" return TOKEN(T_OP_ATOMIC_S_CMPXCHG);
358 "atomic.s.min" return TOKEN(T_OP_ATOMIC_S_MIN);
359 "atomic.s.max" return TOKEN(T_OP_ATOMIC_S_MAX);
360 "atomic.s.and" return TOKEN(T_OP_ATOMIC_S_AND);
361 "atomic.s.or" return TOKEN(T_OP_ATOMIC_S_OR);
362 "atomic.s.xor" return TOKEN(T_OP_ATOMIC_S_XOR);
363 "atomic.g.add" return TOKEN(T_OP_ATOMIC_G_ADD);
364 "atomic.g.sub" return TOKEN(T_OP_ATOMIC_G_SUB);
365 "atomic.g.xchg" return TOKEN(T_OP_ATOMIC_G_XCHG);
366 "atomic.g.inc" return TOKEN(T_OP_ATOMIC_G_INC);
367 "atomic.g.dec" return TOKEN(T_OP_ATOMIC_G_DEC);
368 "atomic.g.cmpxchg" return TOKEN(T_OP_ATOMIC_G_CMPXCHG);
369 "atomic.g.min" return TOKEN(T_OP_ATOMIC_G_MIN);
370 "atomic.g.max" return TOKEN(T_OP_ATOMIC_G_MAX);
371 "atomic.g.and" return TOKEN(T_OP_ATOMIC_G_AND);
372 "atomic.g.or" return TOKEN(T_OP_ATOMIC_G_OR);
373 "atomic.g.xor" return TOKEN(T_OP_ATOMIC_G_XOR);
374
375 "ldgb" return TOKEN(T_OP_LDGB);
376 "stgb" return TOKEN(T_OP_STGB);
377 "stib" return TOKEN(T_OP_STIB);
378 "ldc" return TOKEN(T_OP_LDC);
379 "ldlv" return TOKEN(T_OP_LDLV);
380 "getspid" return TOKEN(T_OP_GETSPID);
381 "getwid" return TOKEN(T_OP_GETWID);
382 "getfiberid" return TOKEN(T_OP_GETFIBERID);
383 "stc" return TOKEN(T_OP_STC);
384 "stsc" return TOKEN(T_OP_STSC);
385
386 ("b16"|"b32"){1} ir3_yylval.str = yytext; return T_INSTR_TYPE;
387
388 /* category 7: */
389 "bar" return TOKEN(T_OP_BAR);
390 "fence" return TOKEN(T_OP_FENCE);
391 "sleep.l" return TOKEN(T_OP_SLEEP);
392 "icinv" return TOKEN(T_OP_ICINV);
393 "dccln.all" return TOKEN(T_OP_DCCLN);
394 "dcinv.all" return TOKEN(T_OP_DCINV);
395 "dcflu.all" return TOKEN(T_OP_DCFLU);
396 "ccinv" return TOKEN(T_OP_CCINV);
397 "lock" return TOKEN(T_OP_LOCK);
398 "unlock" return TOKEN(T_OP_UNLOCK);
399 "alias" return TOKEN(T_OP_ALIAS);
400
401 "print" return TOKEN(T_OP_PRINT);
402
403 "f16" return TOKEN(T_TYPE_F16);
404 "f32" return TOKEN(T_TYPE_F32);
405 "u16" return TOKEN(T_TYPE_U16);
406 "u32" return TOKEN(T_TYPE_U32);
407 "s16" return TOKEN(T_TYPE_S16);
408 "s32" return TOKEN(T_TYPE_S32);
409 "u8" return TOKEN(T_TYPE_U8);
410 "u8_32" return TOKEN(T_TYPE_U8_32);
411
412 "untyped" return TOKEN(T_UNTYPED);
413 "typed" return TOKEN(T_TYPED);
414
415 "unsigned" return TOKEN(T_UNSIGNED);
416 "mixed" return TOKEN(T_MIXED);
417 "low" return TOKEN(T_LOW);
418 "high" return TOKEN(T_HIGH);
419
420 "1d" return TOKEN(T_1D);
421 "2d" return TOKEN(T_2D);
422 "3d" return TOKEN(T_3D);
423 "4d" return TOKEN(T_4D);
424
425 "lt" return TOKEN(T_LT);
426 "le" return TOKEN(T_LE);
427 "gt" return TOKEN(T_GT);
428 "ge" return TOKEN(T_GE);
429 "eq" return TOKEN(T_EQ);
430 "ne" return TOKEN(T_NE);
431
432 "a" return 'a';
433 "o" return 'o';
434 "p" return 'p';
435 "s2en" return TOKEN(T_S2EN);
436 "s" return 's';
437 "k" return 'k';
438 "u" return 'u';
439 "v" return 'v';
440 "base"[0-9]+ ir3_yylval.num = strtol(yytext+4, NULL, 10); return T_BASE;
441 "offset"[0-9]+ ir3_yylval.num = strtol(yytext+6, NULL, 10); return T_OFFSET;
442 "uniform" return T_UNIFORM;
443 "nonuniform" return T_NONUNIFORM;
444 "imm" return T_IMM;
445
446 "tex" return T_MOD_TEX;
447 "mem" return T_MOD_MEM;
448 "rt" return T_MOD_RT;
449
450 "h" return 'h';
451 "=" return '=';
452 "(" return '(';
453 ")" return ')';
454 "[" return '[';
455 "]" return ']';
456 "," return ',';
457 "." return '.';
458 "-" return '-';
459 "+" return '+';
460 "|" return '|';
461 "c" return 'c';
462 "r" return 'r';
463 "hc" return TOKEN(T_HC);
464 "hr" return TOKEN(T_HR);
465 "g" return 'g';
466 "w" return 'w';
467 "l" return 'l';
468 "<" return '<';
469 ">" return '>';
470 "!" return '!';
471 "#" return '#';
472 ":" return ':';
473
474 "nan" return TOKEN(T_NAN);
475 "inf" return TOKEN(T_INF);
476
477 [a-zA-Z_][a-zA-Z_0-9]* ir3_yylval.str = ralloc_strdup(ir3_parser_dead_ctx, yytext); return T_IDENTIFIER;
478 . fprintf(stderr, "error at line %d: Unknown token: %s\n", ir3_yyget_lineno(), yytext); yyterminate();
479 %%
480