public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Joern Rennecke <joernr@arc.com>
To: cgen@sources.redhat.com
Subject: define-hardware, abs, and modes
Date: Wed, 07 Mar 2007 10:27:00 -0000	[thread overview]
Message-ID: <20070307102618.GA17077@elsdt-spawn.arc.com> (raw)

I've found that an 'abs' instruction using the 'abs'
rtl code didn't actually compute the absolute value.
Looking at the generated C code, I found that the
expression inside the ABSSI macro was unsigned,
and the ABSSI macro assumes that the expression is signed.

The expression was generated from a normal operand, which
indexes a register set by an instruction field.
The registe rset was defined with define-hardware using
the mode SI.  However, it had a special get function,
which had a (case SI index ... construct.  One of the
cases uses h-pc.
It turns out that h-pc translates into an unsigned variable,
and the generated does not actually use the declared modes.

Once the problem was known, I could work around it by assigning
the operand to a temporary variable with the proper mode first;
but I don't think that you should be required to do this.
Having abs of an SI value not compute the absolute value
is certainly unexpected.

Do you thing the GET macro generated for the register is
at fault for yielding a value with a type not consistent with
the declared mode, the ABSSI macro for not casting its input
to be signed first, or both?

                 reply	other threads:[~2007-03-07 10:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20070307102618.GA17077@elsdt-spawn.arc.com \
    --to=joernr@arc.com \
    --cc=cgen@sources.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).