All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Montesel <paolo.montesel.revng@gmail.com>
To: Taylor Simpson <tsimpson@quicinc.com>
Cc: Alessandro Di Federico <ale@rev.ng>,
	Brian Cain <bcain@quicinc.com>,
	"richard.henderson@linaro.org" <richard.henderson@linaro.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Alessandro Di Federico <ale.qemu@rev.ng>,
	"nizzo@rev.ng" <nizzo@rev.ng>,
	"philmd@redhat.com" <philmd@redhat.com>
Subject: Re: [PATCH v3 09/12] target/hexagon: import lexer for idef-parser
Date: Wed, 28 Apr 2021 12:40:47 +0200	[thread overview]
Message-ID: <CANnx7NPRY98VDqD7EXd6tWT3Nc5Z42pgq6oLRMATRtCc5NoxRA@mail.gmail.com> (raw)
In-Reply-To: <BYAPR02MB488623DCA2A3E942BE196E4EDE419@BYAPR02MB4886.namprd02.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 1889 bytes --]

>
> > +"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

[-- Attachment #2: Type: text/html, Size: 3032 bytes --]

  reply	other threads:[~2021-04-28 13:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30 14:37 [PATCH v3 00/12] target/hexagon: introduce idef-parser Alessandro Di Federico via
2021-03-30 14:37 ` [PATCH v3 01/12] tcg: expose TCGCond manipulation routines Alessandro Di Federico via
2021-03-30 14:37 ` [PATCH v3 02/12] target/hexagon: update MAINTAINERS for idef-parser Alessandro Di Federico via
2021-03-30 14:37 ` [PATCH v3 03/12] target/hexagon: import README " Alessandro Di Federico via
2021-03-30 14:37 ` [PATCH v3 04/12] target/hexagon: make slot number an unsigned Alessandro Di Federico via
2021-03-30 14:37 ` [PATCH v3 05/12] target/hexagon: make helper functions non-static Alessandro Di Federico via
2021-03-30 14:37 ` [PATCH v3 06/12] target/hexagon: introduce new helper functions Alessandro Di Federico via
2021-03-30 14:37 ` [PATCH v3 07/12] target/hexagon: expose next PC in DisasContext Alessandro Di Federico via
2021-03-30 14:37 ` [PATCH v3 08/12] target/hexagon: prepare input for the idef-parser Alessandro Di Federico via
2021-03-30 14:37 ` [PATCH v3 09/12] target/hexagon: import lexer for idef-parser Alessandro Di Federico via
2021-04-27  2:11   ` Taylor Simpson
2021-04-28 10:40     ` Paolo Montesel [this message]
2021-04-28 15:47       ` Taylor Simpson
2021-03-30 14:37 ` [PATCH v3 10/12] target/hexagon: import parser " Alessandro Di Federico via
2021-03-30 14:37 ` [PATCH v3 11/12] target/hexagon: call idef-parser functions Alessandro Di Federico via
2021-03-30 14:37 ` [PATCH v3 12/12] target/hexagon: import additional tests Alessandro Di Federico via
2021-03-30 15:57 ` [PATCH v3 00/12] target/hexagon: introduce idef-parser no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANnx7NPRY98VDqD7EXd6tWT3Nc5Z42pgq6oLRMATRtCc5NoxRA@mail.gmail.com \
    --to=paolo.montesel.revng@gmail.com \
    --cc=ale.qemu@rev.ng \
    --cc=ale@rev.ng \
    --cc=bcain@quicinc.com \
    --cc=nizzo@rev.ng \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=tsimpson@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.