public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "david.meggy at icron dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/50110] Endian reversal when adding extzv instruction
Date: Thu, 18 Aug 2011 02:24:00 -0000	[thread overview]
Message-ID: <bug-50110-4-kWVHswZRGa@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-50110-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50110

--- Comment #4 from David Meggy <david.meggy at icron dot com> 2011-08-17 23:15:26 UTC ---
>From rtl.def


/* Reference to a signed bit-field of specified size and position.
   Operand 0 is the memory unit (usually SImode or QImode) which
   contains the field's first bit.  Operand 1 is the width, in bits.
   Operand 2 is the number of bits in the memory unit before the
   first bit of this field.
   If BITS_BIG_ENDIAN is defined, the first bit is the msb and
   operand 2 counts from the msb of the memory unit.
   Otherwise, the first bit is the lsb and operand 2 counts from
   the lsb of the memory unit.
   This kind of expression can not appear as an lvalue in RTL.  */
DEF_RTL_EXPR(SIGN_EXTRACT, "sign_extract", "eee", RTX_BITFIELD_OPS)

/* Similar for unsigned bit-field.
   But note!  This kind of expression _can_ appear as an lvalue.  */
DEF_RTL_EXPR(ZERO_EXTRACT, "zero_extract", "eee", RTX_BITFIELD_OPS)



It appears that this behaviour is intended.  To me it seems logical that the
extract instruction is really just a "right shift", followed by an "and", where
the "and" uses a mask based on the width of the bitfield.  To count from the
MSB seems counter-intuitive to me.

If my understanding is correct this code comment should appear in
http://gcc.gnu.org/onlinedocs/gccint/Standard-Names.html#Standard-Names under
the extzv and extv headings.  I can fix up my define_insn to do the conversion
in our implementation.


  parent reply	other threads:[~2011-08-17 23:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-17 19:17 [Bug rtl-optimization/50110] New: " david.meggy at icron dot com
2011-08-17 19:23 ` [Bug rtl-optimization/50110] " david.meggy at icron dot com
2011-08-17 19:32 ` pinskia at gcc dot gnu.org
2011-08-17 20:35 ` david.meggy at icron dot com
2011-08-18  2:24 ` david.meggy at icron dot com [this message]
2012-01-10 19:16 ` david.meggy at icron dot com

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=bug-50110-4-kWVHswZRGa@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).