>From: Paolo Montesel <[email protected]> >Sent: Wednesday, April 28, 2021 5:41 AM >To: Taylor Simpson <[email protected]> >Cc: Alessandro Di Federico <[email protected]>; [email protected]; Brian >Cain <[email protected]>; [email protected]; >[email protected]; >[email protected]; Alessandro Di Federico <[email protected]> >Subject: Re: [PATCH v3 09/12] target/hexagon: import lexer for idef-parser > >> +"fLSBNEW(P"{LOWER_PRE}"N)" { yylval->rvalue.type = PREDICATE; >> + yylval->http://rvalue.pre.id = yytext[9]; >> + yylval->rvalue.bit_width = 32; >> + yylval->rvalue.is_dotnew = true; >> + return PRE; } >> +"fLSBNEW0" { yylval->rvalue.type = PREDICATE; >> + yylval->http://rvalue.pre.id = '0'; >> + yylval->rvalue.bit_width = 32; >> + yylval->rvalue.is_dotnew = true; >> + return PRE; } >> +"fLSBNEW1" { yylval->rvalue.type = PREDICATE; >> + yylval->http://rvalue.pre.id = '1'; >> + yylval->rvalue.bit_width = 32; >> + yylval->rvalue.is_dotnew = true; >> + return PRE; } >> +"fLSBNEW1NOT" { yylval->rvalue.type = PREDICATE; >> + yylval->http://rvalue.pre.id = '1'; >> + yylval->rvalue.bit_width = 32; >> + yylval->rvalue.is_dotnew = true; >> + return PRE; } > >These represent the least significant bit of the operand. Perhaps you should >set the bit_width to 1? Or do tcg_gen_andi_tl(..., 1)? > >What I ended up doing is reworking how LSB* are handled. >Now there's a special token `LSBNEW` that's implemented as a `tcg_gen_andi` in >the parser, and it's used only for `fLSBNEW`. >The other cases are expanded in the preprocessing part like this: > >/* Least significant bit operations */ >#define fLSBNEW0 fLSBNEW(P0N) >#define fLSBNEW1 fLSBNEW(P1N) >#define fLSBOLDNOT(VAL) fGETBIT(0, ~VAL) >#define fLSBNEWNOT(PRED) (fLSBNEW(~PRED)) >#define fLSBNEW0NOT fLSBNEW(~P0N) >#define fLSBNEW1NOT fLSBNEW(~P1N) > >Let me know what you think. > >~Paolo
That should work. Taylor
