public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: reichelt@igpm.rwth-aachen.de
To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, kronoz@tiscali.it,
	nobody@gcc.gnu.org
Subject: Re: optimization/8878: miscompilation with -O and SSE
Date: Wed, 11 Dec 2002 06:08:00 -0000	[thread overview]
Message-ID: <20021211140815.24611.qmail@sources.redhat.com> (raw)

Synopsis: miscompilation with -O and SSE

State-Changed-From-To: open->analyzed
State-Changed-By: reichelt
State-Changed-When: Wed Dec 11 06:08:13 2002
State-Changed-Why:
    Confirmed.
    
    Here's a cleaned-up testcase (which does not suffer from
    aliasing problems as the original one, where &c is casted):
    
    ----------------------------snip here-------------------------
    #include <stdio.h>
    
    typedef int v4sf __attribute__((mode(V4SF)));
    
    int main(void)
    {
        v4sf v = {1.0, 2.0, 3.0, 4.0};
        union { v4sf v; float f[4]; } u;
    
        u.v = __builtin_ia32_mulps(v,v);
    
        printf("%f %f %f %f\n", u.f[0], u.f[1], u.f[2], u.f[3]);
    
        return 0;
    }
    ----------------------------snip here-------------------------
    
    Compiling this with "gcc -O -msse" on a i686-pc-linux-gnu machine
    results in an executable that prints
    
       16.000000 0.000000 0.000000 0.000000
    
    instead of
    
       1.000000 4.000000 9.000000 16.000000
    
    as expeceted. Replacing "mulps" by "addps" will generate equally wrong results.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8878


             reply	other threads:[~2002-12-11 14:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-11  6:08 reichelt [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-05-02 16:34 reichelt
2003-04-03 19:36 Janis Johnson
2003-04-02 20:16 Janis Johnson
2003-04-02 20:16 Volker Reichelt
2002-12-09  9:56 Luca Kronos Tettamanti

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=20021211140815.24611.qmail@sources.redhat.com \
    --to=reichelt@igpm.rwth-aachen.de \
    --cc=gcc-bugs@gcc.gnu.org \
    --cc=gcc-gnats@gcc.gnu.org \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=kronoz@tiscali.it \
    --cc=nobody@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).