public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Paulo Matos <pmatos@linki.tools>
To: cgen@sourceware.org
Subject: Macro with same operands is misbehaving
Date: Fri, 05 Apr 2019 14:44:00 -0000	[thread overview]
Message-ID: <2978b83b-e5eb-434d-f39b-b763782c11cf@linki.tools> (raw)

Hi,

Before going ahead and start modifying CGEN I wanted to confirm if one
can implement something like this with the current CGEN.

Take a floating point instruction like the RISC-V `fsgnj.s f0, f1, 2`.
`fmv.s` is a floating point move instruction that can be defined in
terms of `fsgnj.s` as:
`fmv.s f0, f1` == `fsgnj.s f0, f1, f1`.

If I define the instruction fsgnj.s and followed by fmv.s macro, during
disassembly `fsgnj.s` is always chosen, although assembly works fine.
If on the other hand I define `fmv.s` macro followed by the instruction,
assembly works fine again but all disassembly is broken because the
instruction `fsgnj.s ft0, ft1, ft2` will be disassembled as `fmv.s ft0,
ft1` - i.e. ft2 is ignored.

I can't find a way to say: `fmv.s` matches for disassembly but only if
`f1` == `f2` in `fsgnj.s f0, f1, f2`.

I tried to actually define `fmv.s` as a new instruction instead of a
macro but it doesn't work. Actually the same problem occurs because
bitwise `fmv.s` is going to be the same as a `fsgnj.s` with two
registers being the same.

How can I tell the disassembler in CGEN about this `fmv.s` constraint?

-- 
Paulo Matos

             reply	other threads:[~2019-04-05 14:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-05 14:44 Paulo Matos [this message]
2019-04-08  1:28 ` Frank Ch. Eigler
2019-04-08  6:09   ` Paulo Matos

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=2978b83b-e5eb-434d-f39b-b763782c11cf@linki.tools \
    --to=pmatos@linki.tools \
    --cc=cgen@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).