qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [PATCH v3 09/12] target/hexagon: import lexer for idef-parser


From: Taylor Simpson
Subject: RE: [PATCH v3 09/12] target/hexagon: import lexer for idef-parser
Date: Wed, 28 Apr 2021 15:47:34 +0000


>From: Paolo Montesel <paolo.montesel.revng@gmail.com> 
>Sent: Wednesday, April 28, 2021 5:41 AM
>To: Taylor Simpson <tsimpson@quicinc.com>
>Cc: Alessandro Di Federico <ale.qemu@rev.ng>; qemu-devel@nongnu.org; Brian 
>Cain <bcain@quicinc.com>; nizzo@rev.ng; >philmd@redhat.com; 
>richard.henderson@linaro.org; Alessandro Di Federico <ale@rev.ng>
>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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]