public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "wilson at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/15184] [3.4/4.0/4.1 Regression] Direct access to byte inside word not working with -march=pentiumpro
Date: Fri, 14 Oct 2005 17:44:00 -0000	[thread overview]
Message-ID: <20051014174417.29279.qmail@sourceware.org> (raw)
In-Reply-To: <bug-15184-1037@http.gcc.gnu.org/bugzilla/>



------- Comment #9 from wilson at gcc dot gnu dot org  2005-10-14 17:44 -------
The cause of this problem is the following two lines in the i386.c file
const int x86_himode_math = ~(m_PPRO);
const int x86_promote_hi_regs = m_PPRO;

They were added here:
    http://gcc.gnu.org/ml/gcc-patches/2000-02/msg00890.html

The reason for this is, as a previous comment mentioned, that HImode
instructions are slow on the pentiumpro and should be avoided.  Doing this
gives better performance in general, but unfortunately, for this particular
testcase, it causes us to miss an optimization.

The issue in this case is a combiner limit.  If you compile for Pentium, you
get
  (set (reg:HI 61) (and:HI (mem/c/i:HI (symbol_ref:SI ("y")))
                           (const_int -256)))
  (set (reg:HI 63) (ior:HI (reg:HI 61)
                           (reg:HI 62)))
  (set (mem/c/i:HI (symbol_ref:SI ("y"))
       (reg:HI 63))
The combiner combines these 3 instructions to get
  (set (mem/c/i:QI (const:SI (plus:SI (symbol_ref:SI ("x"))
                                      (const_int 1 [0x1]))))
       (subreg:QI (reg:SI 59 [ c ])))

However, for pentium pro, we end up with 4 instructions due to the HImode
promotion.
  (set (reg:HI 61 [ y ])
       (mem/c/i:HI (symbol_ref:SI ("y"))))
  (set (reg:SI 62) (and:SI (subreg:SI (reg:HI 61 [ y ]) 0)
                           (const_int -256 [0xffffffffffffff00])))
  (set (reg:SI 65) (ior:SI (reg:SI 62)
                           (subreg:SI (reg:HI 63 [ c ]) 0)))                    
  (set (mem/c/i:HI (symbol_ref:SI ("y"))
        (subreg:HI (reg:SI 65) 0))

The combiner combines at most 3 instructions, to avoid combinatorial explosion,
and hence we are not able to optimize this.

I'll look at this a bit more, but at the moment, I'm skeptical that there is
any easy solution.


-- 


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


       reply	other threads:[~2005-10-14 17:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-15184-1037@http.gcc.gnu.org/bugzilla/>
2005-10-14 17:44 ` wilson at gcc dot gnu dot org [this message]
2005-10-30 22:26 ` mmitchel at gcc dot gnu dot org
2006-03-11  3:20 ` [Bug target/15184] [3.4/4.0/4.1/4.2 " mmitchel at gcc dot gnu dot org
2006-06-08  8:42 ` [Bug target/15184] [4.0/4.1/4.2 " bonzini at gnu dot org
2007-01-18  2:55 ` [Bug target/15184] [4.0/4.1/4.2/4.3 " gdr at gcc dot gnu dot org
2007-01-21 21:18 ` pinskia at gcc dot gnu dot org
2007-02-14  9:28 ` mmitchel at gcc dot gnu dot org
2007-07-01 19:52 ` rask at sygehus dot dk
2008-07-04 16:32 ` [Bug target/15184] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
2009-03-31 16:18 ` [Bug target/15184] [4.3/4.4/4.5 " jsm28 at gcc dot gnu dot org
2009-08-04 12:27 ` rguenth at gcc dot gnu dot org
2010-05-22 18:13 ` [Bug target/15184] [4.3/4.4/4.5/4.6 " rguenth at gcc dot gnu dot org
2004-04-27 23:52 [Bug optimization/15184] New: " cesarb at nitnet dot com dot br
2005-05-19 17:30 ` [Bug target/15184] [3.4/4.0/4.1 Regression] " mmitchel at gcc dot gnu dot org
2005-07-22 21:18 ` pinskia at gcc dot gnu dot org
2005-09-27 16:13 ` mmitchel at gcc dot gnu dot 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=20051014174417.29279.qmail@sourceware.org \
    --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).