public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Greg McGary <greg@mcgary.org>
To: "Frank Ch. Eigler" <fche@redhat.com>
Cc: cgen@sourceware.cygnus.com
Subject: Re: defining 2-operand version of 3-operand insns?
Date: Fri, 01 Dec 2000 15:55:00 -0000	[thread overview]
Message-ID: <msy9xzvgrq.fsf@mcgary.org> (raw)
In-Reply-To: <20001201173254.G20294@redhat.com>

"Frank Ch. Eigler" <fche@redhat.com> writes:

> You can define these outside the alias mechanism, by the way.
> Just provide two different insn objects.

I thought I did that via `dni', but as stated before, cgen was
unhappy with the encoding.

> Have you tried
> 	(emit addr dest (f-src1 f-dest) src2)
> instead?

Yes.  CGEN accepts it, but there's no change in the output.

> OTOH, I've only seen (f-FIELD VALUE) construct used with
> literal VALUE arguments.

That appears to be the limitation.

I got this to work by employing a dirty trick.  Fortunately,
the dest and src1 operands are contiguous, so I defined a
new field that encompasses both, called f-dest2, and used
encode/decode magic to propagate:

(df  f-dest2   "dest dup'ed into src1"      () 25 10 UINT
     ((value pc) (add UWI value (sll UWI value (const 5))))
     ((value pc) (srl UWI value 5)))

The decode part is actually unused, since the insn that uses
dest2 has a NO-DIS attribute.

I used a similar dirty-trick to define a subtract immediate
pattern where only an `addi' instruction exists in the machine.
Alongside the normal 16-bit signed immediate field  f-simm16,
I defined f-nimm16 which is a negated version:

(df  f-nimm16  "negated 16-bit immediate"   () 15 16 INT
     ((value pc) (neg HI value))
     ((value pc) (neg HI value)))

Both of these work just the way I want.

Should we endorse or deprecate such abuses? 8^)

Greg

  reply	other threads:[~2000-12-01 15:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-01 14:17 Greg McGary
2000-12-01 14:33 ` Frank Ch. Eigler
2000-12-01 15:55   ` Greg McGary [this message]
2000-12-06 10:29     ` Greg McGary
2000-12-06 10:40       ` Greg McGary
2000-12-06 10:45         ` Doug Evans
2000-12-06 10:42       ` Frank Ch. Eigler
2000-12-06 11:13     ` Doug Evans
2000-12-06 11:26       ` Frank Ch. Eigler
2000-12-06 11:51         ` Doug Evans
2000-12-06 11:40       ` Greg McGary

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=msy9xzvgrq.fsf@mcgary.org \
    --to=greg@mcgary.org \
    --cc=cgen@sourceware.cygnus.com \
    --cc=fche@redhat.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).