• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2013 Rob Clark <robclark@freedesktop.org>
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 "@localsize"                      return TOKEN(T_A_LOCALSIZE);
100 "@const"                          return TOKEN(T_A_CONST);
101 "@buf"                            return TOKEN(T_A_BUF);
102 "@invocationid"                   return TOKEN(T_A_INVOCATIONID);
103 "@wgid"                           return TOKEN(T_A_WGID);
104 "@numwg"                          return TOKEN(T_A_NUMWG);
105 "@branchstack"                    return TOKEN(T_A_BRANCHSTACK);
106 "@in"                             return TOKEN(T_A_IN);
107 "@out"                            return TOKEN(T_A_OUT);
108 "@tex"                            return TOKEN(T_A_TEX);
109 "@pvtmem"                         return TOKEN(T_A_PVTMEM);
110 "@earlypreamble"                  return TOKEN(T_A_EARLYPREAMBLE);
111 "(sy)"                            return TOKEN(T_SY);
112 "(ss)"                            return TOKEN(T_SS);
113 "(absneg)"                        return TOKEN(T_ABSNEG);
114 "(neg)"                           return TOKEN(T_NEG);
115 "(abs)"                           return TOKEN(T_ABS);
116 "(r)"                             return TOKEN(T_R);
117 "(ul)"                            return TOKEN(T_UL);
118 "(even)"                          return TOKEN(T_EVEN);
119 "(pos_infinity)"                  return TOKEN(T_POS_INFINITY);
120 "(neg_infinity)"                  return TOKEN(T_NEG_INFINITY);
121 "(ei)"                            return TOKEN(T_EI);
122 "(jp)"                            return TOKEN(T_JP);
123 "(sat)"                           return TOKEN(T_SAT);
124 "(rpt"[0-7]")"                    ir3_yylval.num = strtol(yytext+4, NULL, 10); return T_RPT;
125 "(nop"[0-7]")"                    ir3_yylval.num = strtol(yytext+4, NULL, 10); return T_NOP;
126 "("[x]?[y]?[z]?[w]?")"            ir3_yylval.num = parse_wrmask(yytext); return T_WRMASK;
127 
128 [h]?"r"[0-9]+"."[xyzw]            ir3_yylval.num = parse_reg(yytext); return T_REGISTER;
129 [h]?"c"[0-9]+"."[xyzw]            ir3_yylval.num = parse_reg(yytext); return T_CONSTANT;
130 "a0.x"                            return T_A0;
131 "a1.x"                            return T_A1;
132 "p0."[xyzw]                       ir3_yylval.num = parse_reg(yytext); return T_P0;
133 "w"[0-9]+                         ir3_yylval.num = strtol(yytext+1, NULL, 10); return T_W;
134 "s#"[0-9]+                        ir3_yylval.num = strtol(yytext+2, NULL, 10); return T_SAMP;
135 "t#"[0-9]+                        ir3_yylval.num = strtol(yytext+2, NULL, 10); return T_TEX;
136 
137                                   /* category 0: */
138 "nop"                             return TOKEN(T_OP_NOP);
139 "br"                              return TOKEN(T_OP_BR);
140 "brao"                            return TOKEN(T_OP_BRAO);
141 "braa"                            return TOKEN(T_OP_BRAA);
142 "brac"                            return TOKEN(T_OP_BRAC);
143 "bany"                            return TOKEN(T_OP_BANY);
144 "ball"                            return TOKEN(T_OP_BALL);
145 "brax"                            return TOKEN(T_OP_BRAX);
146 "jump"                            return TOKEN(T_OP_JUMP);
147 "call"                            return TOKEN(T_OP_CALL);
148 "ret"                             return TOKEN(T_OP_RET);
149 "kill"                            return TOKEN(T_OP_KILL);
150 "end"                             return TOKEN(T_OP_END);
151 "emit"                            return TOKEN(T_OP_EMIT);
152 "cut"                             return TOKEN(T_OP_CUT);
153 "chmask"                          return TOKEN(T_OP_CHMASK);
154 "chsh"                            return TOKEN(T_OP_CHSH);
155 "flow_rev"                        return TOKEN(T_OP_FLOW_REV);
156 "bkt"                             return TOKEN(T_OP_BKT);
157 "stks"                            return TOKEN(T_OP_STKS);
158 "stkr"                            return TOKEN(T_OP_STKR);
159 "xset"                            return TOKEN(T_OP_XSET);
160 "xclr"                            return TOKEN(T_OP_XCLR);
161 "getlast"                         return TOKEN(T_OP_GETLAST);
162 "getone"                          return TOKEN(T_OP_GETONE);
163 "dbg"                             return TOKEN(T_OP_DBG);
164 "shps"                            return TOKEN(T_OP_SHPS);
165 "shpe"                            return TOKEN(T_OP_SHPE);
166 "predt"                           return TOKEN(T_OP_PREDT);
167 "predf"                           return TOKEN(T_OP_PREDF);
168 "prede"                           return TOKEN(T_OP_PREDE);
169 
170                                   /* category 1: */
171 "movmsk"                          return TOKEN(T_OP_MOVMSK);
172 "mova1"                           return TOKEN(T_OP_MOVA1);
173 "mova"                            return TOKEN(T_OP_MOVA);
174 "mov"                             return TOKEN(T_OP_MOV);
175 "cov"                             return TOKEN(T_OP_COV);
176 "swz"                             return TOKEN(T_OP_SWZ);
177 "gat"                             return TOKEN(T_OP_GAT);
178 "sct"                             return TOKEN(T_OP_SCT);
179 
180 ("f16"|"f32"|"u16"|"u32"|"s16"|"s32"|"u8"|"s8"){2} ir3_yylval.str = yytext; return T_CAT1_TYPE_TYPE;
181 
182                                   /* category 2: */
183 "add.f"                           return TOKEN(T_OP_ADD_F);
184 "min.f"                           return TOKEN(T_OP_MIN_F);
185 "max.f"                           return TOKEN(T_OP_MAX_F);
186 "mul.f"                           return TOKEN(T_OP_MUL_F);
187 "sign.f"                          return TOKEN(T_OP_SIGN_F);
188 "cmps.f"                          return TOKEN(T_OP_CMPS_F);
189 "absneg.f"                        return TOKEN(T_OP_ABSNEG_F);
190 "cmpv.f"                          return TOKEN(T_OP_CMPV_F);
191 "floor.f"                         return TOKEN(T_OP_FLOOR_F);
192 "ceil.f"                          return TOKEN(T_OP_CEIL_F);
193 "rndne.f"                         return TOKEN(T_OP_RNDNE_F);
194 "rndaz.f"                         return TOKEN(T_OP_RNDAZ_F);
195 "trunc.f"                         return TOKEN(T_OP_TRUNC_F);
196 "add.u"                           return TOKEN(T_OP_ADD_U);
197 "add.s"                           return TOKEN(T_OP_ADD_S);
198 "sub.u"                           return TOKEN(T_OP_SUB_U);
199 "sub.s"                           return TOKEN(T_OP_SUB_S);
200 "cmps.u"                          return TOKEN(T_OP_CMPS_U);
201 "cmps.s"                          return TOKEN(T_OP_CMPS_S);
202 "min.u"                           return TOKEN(T_OP_MIN_U);
203 "min.s"                           return TOKEN(T_OP_MIN_S);
204 "max.u"                           return TOKEN(T_OP_MAX_U);
205 "max.s"                           return TOKEN(T_OP_MAX_S);
206 "absneg.s"                        return TOKEN(T_OP_ABSNEG_S);
207 "and.b"                           return TOKEN(T_OP_AND_B);
208 "or.b"                            return TOKEN(T_OP_OR_B);
209 "not.b"                           return TOKEN(T_OP_NOT_B);
210 "xor.b"                           return TOKEN(T_OP_XOR_B);
211 "cmpv.u"                          return TOKEN(T_OP_CMPV_U);
212 "cmpv.s"                          return TOKEN(T_OP_CMPV_S);
213 "mul.u24"                         return TOKEN(T_OP_MUL_U24);
214 "mul.s24"                         return TOKEN(T_OP_MUL_S24);
215 "mull.u"                          return TOKEN(T_OP_MULL_U);
216 "bfrev.b"                         return TOKEN(T_OP_BFREV_B);
217 "clz.s"                           return TOKEN(T_OP_CLZ_S);
218 "clz.b"                           return TOKEN(T_OP_CLZ_B);
219 "shl.b"                           return TOKEN(T_OP_SHL_B);
220 "shr.b"                           return TOKEN(T_OP_SHR_B);
221 "ashr.b"                          return TOKEN(T_OP_ASHR_B);
222 "bary.f"                          return TOKEN(T_OP_BARY_F);
223 "flat.b"                          return TOKEN(T_OP_FLAT_B);
224 "mgen.b"                          return TOKEN(T_OP_MGEN_B);
225 "getbit.b"                        return TOKEN(T_OP_GETBIT_B);
226 "setrm"                           return TOKEN(T_OP_SETRM);
227 "cbits.b"                         return TOKEN(T_OP_CBITS_B);
228 "shb"                             return TOKEN(T_OP_SHB);
229 "msad"                            return TOKEN(T_OP_MSAD);
230 
231                                   /* category 3: */
232 "mad.u16"                         return TOKEN(T_OP_MAD_U16);
233 "madsh.u16"                       return TOKEN(T_OP_MADSH_U16);
234 "mad.s16"                         return TOKEN(T_OP_MAD_S16);
235 "madsh.m16"                       return TOKEN(T_OP_MADSH_M16);
236 "mad.u24"                         return TOKEN(T_OP_MAD_U24);
237 "mad.s24"                         return TOKEN(T_OP_MAD_S24);
238 "mad.f16"                         return TOKEN(T_OP_MAD_F16);
239 "mad.f32"                         return TOKEN(T_OP_MAD_F32);
240 "sel.b16"                         return TOKEN(T_OP_SEL_B16);
241 "sel.b32"                         return TOKEN(T_OP_SEL_B32);
242 "sel.s16"                         return TOKEN(T_OP_SEL_S16);
243 "sel.s32"                         return TOKEN(T_OP_SEL_S32);
244 "sel.f16"                         return TOKEN(T_OP_SEL_F16);
245 "sel.f32"                         return TOKEN(T_OP_SEL_F32);
246 "sad.s16"                         return TOKEN(T_OP_SAD_S16);
247 "sad.s32"                         return TOKEN(T_OP_SAD_S32);
248 "shrm"                            return TOKEN(T_OP_SHRM);
249 "shlm"                            return TOKEN(T_OP_SHLM);
250 "shrg"                            return TOKEN(T_OP_SHRG);
251 "shlg"                            return TOKEN(T_OP_SHLG);
252 "andg"                            return TOKEN(T_OP_ANDG);
253 "dp2acc"                          return TOKEN(T_OP_DP2ACC);
254 "dp4acc"                          return TOKEN(T_OP_DP4ACC);
255 "wmm"                             return TOKEN(T_OP_WMM);
256 "wmm.accu"                        return TOKEN(T_OP_WMM_ACCU);
257 
258                                   /* category 4: */
259 "rcp"                             return TOKEN(T_OP_RCP);
260 "rsq"                             return TOKEN(T_OP_RSQ);
261 "log2"                            return TOKEN(T_OP_LOG2);
262 "exp2"                            return TOKEN(T_OP_EXP2);
263 "sin"                             return TOKEN(T_OP_SIN);
264 "cos"                             return TOKEN(T_OP_COS);
265 "sqrt"                            return TOKEN(T_OP_SQRT);
266 "hrsq"                            return TOKEN(T_OP_HRSQ);
267 "hlog2"                           return TOKEN(T_OP_HLOG2);
268 "hexp2"                           return TOKEN(T_OP_HEXP2);
269 
270                                   /* category 5: */
271 "isam"                            return TOKEN(T_OP_ISAM);
272 "isaml"                           return TOKEN(T_OP_ISAML);
273 "isamm"                           return TOKEN(T_OP_ISAMM);
274 "sam"                             return TOKEN(T_OP_SAM);
275 "samb"                            return TOKEN(T_OP_SAMB);
276 "saml"                            return TOKEN(T_OP_SAML);
277 "samgq"                           return TOKEN(T_OP_SAMGQ);
278 "getlod"                          return TOKEN(T_OP_GETLOD);
279 "conv"                            return TOKEN(T_OP_CONV);
280 "convm"                           return TOKEN(T_OP_CONVM);
281 "getsize"                         return TOKEN(T_OP_GETSIZE);
282 "getbuf"                          return TOKEN(T_OP_GETBUF);
283 "getpos"                          return TOKEN(T_OP_GETPOS);
284 "getinfo"                         return TOKEN(T_OP_GETINFO);
285 "dsx"                             return TOKEN(T_OP_DSX);
286 "dsy"                             return TOKEN(T_OP_DSY);
287 "gather4r"                        return TOKEN(T_OP_GATHER4R);
288 "gather4g"                        return TOKEN(T_OP_GATHER4G);
289 "gather4b"                        return TOKEN(T_OP_GATHER4B);
290 "gather4a"                        return TOKEN(T_OP_GATHER4A);
291 "samgp0"                          return TOKEN(T_OP_SAMGP0);
292 "samgp1"                          return TOKEN(T_OP_SAMGP1);
293 "samgp2"                          return TOKEN(T_OP_SAMGP2);
294 "samgp3"                          return TOKEN(T_OP_SAMGP3);
295 "dsxpp.1"                         return TOKEN(T_OP_DSXPP_1);
296 "dsypp.1"                         return TOKEN(T_OP_DSYPP_1);
297 "rgetpos"                         return TOKEN(T_OP_RGETPOS);
298 "rgetinfo"                        return TOKEN(T_OP_RGETINFO);
299 "brcst.active"                    return TOKEN(T_OP_BRCST_A);
300 "quad_shuffle.brcst"              return TOKEN(T_OP_QSHUFFLE_BRCST);
301 "quad_shuffle.horiz"              return TOKEN(T_OP_QSHUFFLE_H);
302 "quad_shuffle.vert"               return TOKEN(T_OP_QSHUFFLE_V);
303 "quad_shuffle.diag"               return TOKEN(T_OP_QSHUFFLE_DIAG);
304 
305                                   /* category 6: */
306 "ldg"                             return TOKEN(T_OP_LDG);
307 "ldg.a"                           return TOKEN(T_OP_LDG_A);
308 "ldl"                             return TOKEN(T_OP_LDL);
309 "ldp"                             return TOKEN(T_OP_LDP);
310 "stg"                             return TOKEN(T_OP_STG);
311 "stg.a"                           return TOKEN(T_OP_STG_A);
312 "stl"                             return TOKEN(T_OP_STL);
313 "stp"                             return TOKEN(T_OP_STP);
314 "ldib"                            return TOKEN(T_OP_LDIB);
315 "g2l"                             return TOKEN(T_OP_G2L);
316 "l2g"                             return TOKEN(T_OP_L2G);
317 "prefetch"                        return TOKEN(T_OP_PREFETCH);
318 "ldlw"                            return TOKEN(T_OP_LDLW);
319 "stlw"                            return TOKEN(T_OP_STLW);
320 "resfmt"                          return TOKEN(T_OP_RESFMT);
321 "resinfo"                         return TOKEN(T_OP_RESINFO);
322 "atomic.add"                      return TOKEN(T_OP_ATOMIC_ADD);
323 "atomic.sub"                      return TOKEN(T_OP_ATOMIC_SUB);
324 "atomic.xchg"                     return TOKEN(T_OP_ATOMIC_XCHG);
325 "atomic.inc"                      return TOKEN(T_OP_ATOMIC_INC);
326 "atomic.dec"                      return TOKEN(T_OP_ATOMIC_DEC);
327 "atomic.cmpxchg"                  return TOKEN(T_OP_ATOMIC_CMPXCHG);
328 "atomic.min"                      return TOKEN(T_OP_ATOMIC_MIN);
329 "atomic.max"                      return TOKEN(T_OP_ATOMIC_MAX);
330 "atomic.and"                      return TOKEN(T_OP_ATOMIC_AND);
331 "atomic.or"                       return TOKEN(T_OP_ATOMIC_OR);
332 "atomic.xor"                      return TOKEN(T_OP_ATOMIC_XOR);
333 "resinfo.b"                       return TOKEN(T_OP_RESINFO_B);
334 "ldib.b"                          return TOKEN(T_OP_LDIB_B);
335 "stib.b"                          return TOKEN(T_OP_STIB_B);
336 "atomic.b.add"                    return TOKEN(T_OP_ATOMIC_B_ADD);
337 "atomic.b.sub"                    return TOKEN(T_OP_ATOMIC_B_SUB);
338 "atomic.b.xchg"                   return TOKEN(T_OP_ATOMIC_B_XCHG);
339 "atomic.b.inc"                    return TOKEN(T_OP_ATOMIC_B_INC);
340 "atomic.b.dec"                    return TOKEN(T_OP_ATOMIC_B_DEC);
341 "atomic.b.cmpxchg"                return TOKEN(T_OP_ATOMIC_B_CMPXCHG);
342 "atomic.b.min"                    return TOKEN(T_OP_ATOMIC_B_MIN);
343 "atomic.b.max"                    return TOKEN(T_OP_ATOMIC_B_MAX);
344 "atomic.b.and"                    return TOKEN(T_OP_ATOMIC_B_AND);
345 "atomic.b.or"                     return TOKEN(T_OP_ATOMIC_B_OR);
346 "atomic.b.xor"                    return TOKEN(T_OP_ATOMIC_B_XOR);
347 "atomic.s.add"                    return TOKEN(T_OP_ATOMIC_S_ADD);
348 "atomic.s.sub"                    return TOKEN(T_OP_ATOMIC_S_SUB);
349 "atomic.s.xchg"                   return TOKEN(T_OP_ATOMIC_S_XCHG);
350 "atomic.s.inc"                    return TOKEN(T_OP_ATOMIC_S_INC);
351 "atomic.s.dec"                    return TOKEN(T_OP_ATOMIC_S_DEC);
352 "atomic.s.cmpxchg"                return TOKEN(T_OP_ATOMIC_S_CMPXCHG);
353 "atomic.s.min"                    return TOKEN(T_OP_ATOMIC_S_MIN);
354 "atomic.s.max"                    return TOKEN(T_OP_ATOMIC_S_MAX);
355 "atomic.s.and"                    return TOKEN(T_OP_ATOMIC_S_AND);
356 "atomic.s.or"                     return TOKEN(T_OP_ATOMIC_S_OR);
357 "atomic.s.xor"                    return TOKEN(T_OP_ATOMIC_S_XOR);
358 "atomic.g.add"                    return TOKEN(T_OP_ATOMIC_G_ADD);
359 "atomic.g.sub"                    return TOKEN(T_OP_ATOMIC_G_SUB);
360 "atomic.g.xchg"                   return TOKEN(T_OP_ATOMIC_G_XCHG);
361 "atomic.g.inc"                    return TOKEN(T_OP_ATOMIC_G_INC);
362 "atomic.g.dec"                    return TOKEN(T_OP_ATOMIC_G_DEC);
363 "atomic.g.cmpxchg"                return TOKEN(T_OP_ATOMIC_G_CMPXCHG);
364 "atomic.g.min"                    return TOKEN(T_OP_ATOMIC_G_MIN);
365 "atomic.g.max"                    return TOKEN(T_OP_ATOMIC_G_MAX);
366 "atomic.g.and"                    return TOKEN(T_OP_ATOMIC_G_AND);
367 "atomic.g.or"                     return TOKEN(T_OP_ATOMIC_G_OR);
368 "atomic.g.xor"                    return TOKEN(T_OP_ATOMIC_G_XOR);
369 
370 "ldgb"                            return TOKEN(T_OP_LDGB);
371 "stgb"                            return TOKEN(T_OP_STGB);
372 "stib"                            return TOKEN(T_OP_STIB);
373 "ldc"                             return TOKEN(T_OP_LDC);
374 "ldlv"                            return TOKEN(T_OP_LDLV);
375 "getspid"                         return TOKEN(T_OP_GETSPID);
376 "getwid"                          return TOKEN(T_OP_GETWID);
377 "getfiberid"                      return TOKEN(T_OP_GETFIBERID);
378 "stc"                             return TOKEN(T_OP_STC);
379 
380                                   /* category 7: */
381 "bar"                             return TOKEN(T_OP_BAR);
382 "fence"                           return TOKEN(T_OP_FENCE);
383 
384 "f16"                             return TOKEN(T_TYPE_F16);
385 "f32"                             return TOKEN(T_TYPE_F32);
386 "u16"                             return TOKEN(T_TYPE_U16);
387 "u32"                             return TOKEN(T_TYPE_U32);
388 "s16"                             return TOKEN(T_TYPE_S16);
389 "s32"                             return TOKEN(T_TYPE_S32);
390 "u8"                              return TOKEN(T_TYPE_U8);
391 "s8"                              return TOKEN(T_TYPE_S8);
392 
393 "untyped"                         return TOKEN(T_UNTYPED);
394 "typed"                           return TOKEN(T_TYPED);
395 
396 "unsigned"                        return TOKEN(T_UNSIGNED);
397 "mixed"                           return TOKEN(T_MIXED);
398 "low"                             return TOKEN(T_LOW);
399 "high"                            return TOKEN(T_HIGH);
400 
401 "1d"                              return TOKEN(T_1D);
402 "2d"                              return TOKEN(T_2D);
403 "3d"                              return TOKEN(T_3D);
404 "4d"                              return TOKEN(T_4D);
405 
406 "lt"                              return TOKEN(T_LT);
407 "le"                              return TOKEN(T_LE);
408 "gt"                              return TOKEN(T_GT);
409 "ge"                              return TOKEN(T_GE);
410 "eq"                              return TOKEN(T_EQ);
411 "ne"                              return TOKEN(T_NE);
412 
413 "a"                               return 'a';
414 "o"                               return 'o';
415 "p"                               return 'p';
416 "s2en"                            return TOKEN(T_S2EN);
417 "s"                               return 's';
418 "k"                               return 'k';
419 "base"[0-9]+                      ir3_yylval.num = strtol(yytext+4, NULL, 10); return T_BASE;
420 "offset"[0-9]+                    ir3_yylval.num = strtol(yytext+6, NULL, 10); return T_OFFSET;
421 "uniform"                         return T_UNIFORM;
422 "nonuniform"                      return T_NONUNIFORM;
423 "imm"                             return T_IMM;
424 
425 "h"                               return 'h';
426 "="                               return '=';
427 "("                               return '(';
428 ")"                               return ')';
429 "["                               return '[';
430 "]"                               return ']';
431 ","                               return ',';
432 "."                               return '.';
433 "-"                               return '-';
434 "+"                               return '+';
435 "|"                               return '|';
436 "c"                               return 'c';
437 "r"                               return 'r';
438 "hc"                              return TOKEN(T_HC);
439 "hr"                              return TOKEN(T_HR);
440 "g"                               return 'g';
441 "w"                               return 'w';
442 "l"                               return 'l';
443 "<"                               return '<';
444 ">"                               return '>';
445 "!"                               return '!';
446 "#"                               return '#';
447 ":"                               return ':';
448 
449 "nan"                             return TOKEN(T_NAN);
450 "inf"                             return TOKEN(T_INF);
451 
452 [a-zA-Z_][a-zA-Z_0-9]*            ir3_yylval.str = ralloc_strdup(ir3_parser_dead_ctx, yytext); return T_IDENTIFIER;
453 .                                 fprintf(stderr, "error at line %d: Unknown token: %s\n", ir3_yyget_lineno(), yytext); yyterminate();
454 %%
455