QEMU-Devel Archive mirror
 help / color / mirror / Atom feed
From: 'Anton Johansson' via <qemu-devel@nongnu.org>
To: ltaylorsimpson@gmail.com
Cc: qemu-devel@nongnu.org, ale@rev.ng, bcain@quicinc.com
Subject: Re: [PATCH 4/4] target/hexagon: idef-parser simplify predicate init
Date: Tue, 7 May 2024 13:18:28 +0200	[thread overview]
Message-ID: <jx7e3hvlsxld3h7736twjjaoaguamzeqtonjnrpr4yzmz44qlj@4paocplivllt> (raw)
In-Reply-To: <067e01da9fe7$4ffddd30$eff99790$@gmail.com>

On 06/05/24, ltaylorsimpson@gmail.com wrote:
> 
> 
> > -----Original Message-----
> > From: Anton Johansson <anjo@rev.ng>
> > Sent: Monday, May 6, 2024 1:31 PM
> > To: qemu-devel@nongnu.org
> > Cc: ale@rev.ng; ltaylorsimpson@gmail.com; bcain@quicinc.com
> > Subject: [PATCH 4/4] target/hexagon: idef-parser simplify predicate init
> > 
> > Only predicate instruction arguments need to be initialized by
> idef-parser.
> > This commit removes registers from the init_list and simplifies
> > gen_inst_init_args() slightly.
> > 
> > Signed-off-by: Anton Johansson <anjo@rev.ng>
> > ---
> >  target/hexagon/idef-parser/idef-parser.y    |  2 --
> >  target/hexagon/idef-parser/parser-helpers.c | 20 +++++++++-----------
> >  2 files changed, 9 insertions(+), 13 deletions(-)
> 
> > diff --git a/target/hexagon/idef-parser/parser-helpers.c
> > b/target/hexagon/idef-parser/parser-helpers.c
> > index bae01c2bb8..33e8f82007 100644
> > --- a/target/hexagon/idef-parser/parser-helpers.c
> > +++ b/target/hexagon/idef-parser/parser-helpers.c
> > @@ -1652,26 +1652,24 @@ void gen_inst(Context *c, GString *iname)
> > 
> >  void gen_inst_init_args(Context *c, YYLTYPE *locp)  {
> > +    /* If init_list is NULL arguments have already been initialized */
> >      if (!c->inst.init_list) {
> >          return;
> >      }
> > 
> >      for (unsigned i = 0; i < c->inst.init_list->len; i++) {
> >          HexValue *val = &g_array_index(c->inst.init_list, HexValue, i);
> > -        if (val->type == REGISTER_ARG) {
> > -            /* Nothing to do here */
> > -        } else if (val->type == PREDICATE) {
> > -            char suffix = val->is_dotnew ? 'N' : 'V';
> > -            EMIT_HEAD(c, "tcg_gen_movi_i%u(P%c%c, 0);\n", val->bit_width,
> > -                      val->pred.id, suffix);
> > -        } else {
> > -            yyassert(c, locp, false, "Invalid arg type!");
> > -        }
> > +        yyassert(c, locp, val->type == PREDICATE,
> > +                 "Only predicates need to be initialized!");
> > +        char suffix = val->is_dotnew ? 'N' : 'V';
> 
> Declarations should be at the beginning of the function per QEMU coding
> standards.

Agh right!

>
> > +        EMIT_HEAD(c, "tcg_gen_movi_i%u(P%c%c, 0);\n", val->bit_width,
> 
> Since you know this is a predicate, the bit_width will always be 32.  You
> can hard-code that instead of using %u.

Good point, I'll add a paranoia assertion as well.

//Anton


      reply	other threads:[~2024-05-07 11:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-06 18:31 [PATCH 0/4] target/hexagon: Minor idef-parser cleanup Anton Johansson via
2024-05-06 18:31 ` [PATCH 1/4] target/hexagon: idef-parser remove unused defines Anton Johansson via
2024-05-06 18:58   ` ltaylorsimpson
2024-05-06 18:31 ` [PATCH 2/4] target/hexagon: idef-parser remove undefined functions Anton Johansson via
2024-05-06 18:58   ` ltaylorsimpson
2024-05-06 18:31 ` [PATCH 3/4] target/hexagon: idef-parser fix leak of init_list Anton Johansson via
2024-05-06 18:58   ` ltaylorsimpson
2024-05-07  9:47     ` 'Anton Johansson' via
2024-05-07 21:05       ` ltaylorsimpson
2024-05-08 14:24         ` 'Anton Johansson' via
2024-05-06 18:31 ` [PATCH 4/4] target/hexagon: idef-parser simplify predicate init Anton Johansson via
2024-05-06 18:57   ` ltaylorsimpson
2024-05-07 11:18     ` 'Anton Johansson' via [this message]

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=jx7e3hvlsxld3h7736twjjaoaguamzeqtonjnrpr4yzmz44qlj@4paocplivllt \
    --to=qemu-devel@nongnu.org \
    --cc=ale@rev.ng \
    --cc=anjo@rev.ng \
    --cc=bcain@quicinc.com \
    --cc=ltaylorsimpson@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).