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: Paolo Montesel
Subject: Re: [PATCH v3 09/12] target/hexagon: import lexer for idef-parser
Date: Wed, 28 Apr 2021 12:40:47 +0200

> +"fLSBNEW(P"{LOWER_PRE}"N)" { yylval->rvalue.type = PREDICATE;
> +                           yylval->rvalue.pre.id = yytext[9];
> +                           yylval->rvalue.bit_width = 32;
> +                           yylval->rvalue.is_dotnew = true;
> +                           return PRE; }
> +"fLSBNEW0"               { yylval->rvalue.type = PREDICATE;
> +                           yylval->rvalue.pre.id = '0';
> +                           yylval->rvalue.bit_width = 32;
> +                           yylval->rvalue.is_dotnew = true;
> +                           return PRE; }
> +"fLSBNEW1"               { yylval->rvalue.type = PREDICATE;
> +                           yylval->rvalue.pre.id = '1';
> +                           yylval->rvalue.bit_width = 32;
> +                           yylval->rvalue.is_dotnew = true;
> +                           return PRE; }
> +"fLSBNEW1NOT"            { yylval->rvalue.type = PREDICATE;
> +                           yylval->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

reply via email to

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