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