public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Jose E. Marchesi" <jose.marchesi@oracle.com>
To: David Faust via Binutils <binutils@sourceware.org>
Subject: Re: [PATCH] bpf: xBPF SDIV, SMOD instructions
Date: Fri, 18 Sep 2020 13:44:20 +0200	[thread overview]
Message-ID: <87tuvv1f8r.fsf@oracle.com> (raw)
In-Reply-To: <20200917170905.31816-1-david.faust@oracle.com> (David Faust via Binutils's message of "Thu, 17 Sep 2020 10:09:05 -0700")


Hi David.

> +(define-pmacro (define-alu-insn-xbpf x-basename x-suffix x-op-class x-op-code
> +                 x-endian x-mode x-semop)
> +  (begin
> +    ;; dst = dst OP immediate
> +    (dni (.sym x-basename x-suffix "i" x-endian)
> +         (.str x-basename x-suffix " immediate")
> +         ((ISA (.sym xbpf x-endian)))
> +         (.str x-basename x-suffix " $dst" x-endian ",$imm32")
> +         (+ imm32 (f-offset16 0) ((.sym f-src x-endian) 0) (.sym dst x-endian)
> +            x-op-class OP_SRC_K x-op-code)
> +         (set x-mode (.sym dst x-endian) (x-semop x-mode (.sym dst x-endian) imm32))
> +         ())
> +    ;; dst = dst OP src
> +    (dni (.sym x-basename x-suffix "r" x-endian)
> +         (.str x-basename x-suffix " register")
> +         ((ISA (.sym xbpf x-endian)))
> +         (.str x-basename x-suffix " $dst" x-endian ",$src" x-endian)
> +         (+ (f-imm32 0) (f-offset16 0) (.sym src x-endian) (.sym dst x-endian)
> +            x-op-class OP_SRC_X x-op-code)
> +         (set x-mode (.sym dst x-endian)
> +                      (x-semop x-mode (.sym dst x-endian) (.sym src x-endian)))
> +         ())))
> +

  [...]
  
> +(define-pmacro (daix x-basename x-op-code x-endian x-semop)
> +  (begin
> +    (define-alu-insn-xbpf x-basename "" OP_CLASS_ALU64 x-op-code x-endian DI x-semop)
> +    (define-alu-insn-xbpf x-basename "32" OP_CLASS_ALU x-op-code x-endian USI x-semop)))
> +

Why not using define-alu-insn-bin and daib instead of defining an
additional pair of macros?  We can pass the ISAs as arguments to
daib/daiu and thus avoid replicating logic ...

  reply	other threads:[~2020-09-18 11:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17 17:09 David Faust
2020-09-18 11:44 ` Jose E. Marchesi [this message]
2020-09-18 16:07   ` David Faust
2020-09-18 16:49     ` Jose E. Marchesi
2020-09-18 17:07       ` David Faust

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=87tuvv1f8r.fsf@oracle.com \
    --to=jose.marchesi@oracle.com \
    --cc=binutils@sourceware.org \
    /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).