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