public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "uros at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/17619] Non-optimal code for -mfpmath=387,sse
Date: Wed, 01 Dec 2004 16:03:00 -0000	[thread overview]
Message-ID: <20041201160240.18996.qmail@sourceware.org> (raw)
In-Reply-To: <20040922191917.17619.bangerth@dealii.org>


------- Additional Comments From uros at gcc dot gnu dot org  2004-12-01 16:02 -------
If the loop is splitted manually and putting a, b and c inside the foobar()
function [otherwise vectorizer complains about unaligned load]:

--cut here--
struct X
{
  float array[4];
};

float foobar()
{
  X a, b, c;

  float s = 0;
  for (unsigned int d = 0; d < 4; ++d)
    c.array[d] = a.array[d] * b.array[d];

  for (unsigned int d = 0; d < 4; ++d)
    s += c.array[d];

  return s;
}
--cut here--

Compiling this example with rigth pack of options: -O2 -march=pentium4
-ftree-vectorize -mfpmath=sse,387 -funroll-loops -fomit-frame-pointer
-ffast-math, this wonderful piece of code is produced:

_Z6foobarv:
.LFB2:
        subl    $60, %esp
.LCFI0:
        movaps  32(%esp), %xmm0
        mulps   16(%esp), %xmm0
        movaps  %xmm0, (%esp)
        flds    4(%esp)
        fadds   (%esp)
        fadds   8(%esp)
        fadds   12(%esp)
        addl    $60, %esp
        ret

I don't know why vectorized doesn't like original testcase.

Uros.

-- 


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


  parent reply	other threads:[~2004-12-01 16:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-22 19:19 [Bug target/17619] New: " bangerth at dealii dot org
2004-09-22 19:33 ` [Bug target/17619] " bangerth at dealii dot org
2004-09-22 21:16 ` pinskia at gcc dot gnu dot org
2004-09-22 21:22 ` bangerth at dealii dot org
2004-09-22 21:25 ` bangerth at dealii dot org
2004-09-22 21:35 ` bangerth at dealii dot org
2004-12-01 14:07 ` uros at gcc dot gnu dot org
2004-12-01 14:27 ` pinskia at gcc dot gnu dot org
2004-12-01 16:03 ` uros at gcc dot gnu dot org [this message]
2004-12-01 20:49 ` bangerth at dealii dot org
2004-12-01 20:59 ` bangerth at dealii 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=20041201160240.18996.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).