public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kkojima at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/52394] SH Target: SH2A defunct bitops
Date: Tue, 28 Feb 2012 00:49:00 -0000	[thread overview]
Message-ID: <bug-52394-4-FFdIZXsEMH@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-52394-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2012-02-28 00:37:56 UTC ---
I guess that now these tests require -fno-strict-volatile-bitfields,
though it isn't enough to avoid failures.  It looks that something
wrong happens in expmed.c:{store, extract}_bit_field_1 and they decide
to use slow fallback {store, extract}_fixed_bit_field instead of
generating insv/extv.

Here is suspicious part of {store, extract}_bit_field_1:

      /* Now convert from counting within UNIT to counting in EXT_MODE.  */
      if (BYTES_BIG_ENDIAN && !MEM_P (xop0))
    xbitpos += GET_MODE_BITSIZE (ext_mode) - unit;

      unit = GET_MODE_BITSIZE (ext_mode);

      /* If BITS_BIG_ENDIAN is zero on a BYTES_BIG_ENDIAN machine, we count
         "backwards" from the size of the unit we are extracting from.
     Otherwise, we count bits from the most significant on a
     BYTES/BITS_BIG_ENDIAN machine.  */

      if (BITS_BIG_ENDIAN != BYTES_BIG_ENDIAN)
    xbitpos = unit - bitsize - xbitpos;

In the problematic cases, xop0 is a QImode memory and ext_mode is SImode.
The initial value of unit is 8.  When starting xbitops is 3 and bitsize is
1 for example, these lines set xbitspos to 28!  There is no insv/extv which
inserts/extracts such bit position for QImode memory and maybe_expand_insn
for CODE_FOR_{insv, extv} fails.  Perhaps, these parts should be something
like

      /* We have been counting XBITPOS within UNIT.
     Count instead within the size of the register.  */
      if (BYTES_BIG_ENDIAN && !MEM_P (xop0))
    xbitpos += GET_MODE_BITSIZE (op_mode) - unit;

      /* If BITS_BIG_ENDIAN is zero on a BYTES_BIG_ENDIAN machine, we count
         "backwards" from the size of the unit we are inserting into.
     Otherwise, we count bits from the most significant on a
     BYTES/BITS_BIG_ENDIAN machine.  */

      if (BITS_BIG_ENDIAN != BYTES_BIG_ENDIAN)
    {
      if (!MEM_P (xop0))
        xbitpos = GET_MODE_BITSIZE (op_mode) - bitsize - xbitpos;
      else
        xbitpos = unit - bitsize - xbitpos;
    }

      unit = GET_MODE_BITSIZE (op_mode);

though I don't understand these routines well.


  reply	other threads:[~2012-02-28  0:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-27  2:51 [Bug target/52394] New: " olegendo at gcc dot gnu.org
2012-02-28  0:49 ` kkojima at gcc dot gnu.org [this message]
2015-09-20  3:37 ` [Bug target/52394] " olegendo at gcc dot gnu.org
2015-09-20 10:01 ` olegendo at gcc dot gnu.org

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-52394-4-FFdIZXsEMH@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).