public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/47825] SSE bitwise operations on floats work -g, fail -O3
Date: Mon, 21 Feb 2011 10:44:00 -0000	[thread overview]
Message-ID: <bug-47825-4-ozcOU0dusX@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-47825-4@http.gcc.gnu.org/bugzilla/>

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-*-*
             Status|RESOLVED                    |REOPENED
   Last reconfirmed|                            |2011.02.21 10:40:58
                 CC|                            |hjl at gcc dot gnu.org
          Component|c                           |target
         Resolution|INVALID                     |
     Ever Confirmed|0                           |1

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-02-21 10:40:58 UTC ---
The issue is that maskarray is initialized as array of ints but then you
load it as array of floats, the scheduler re-orders those so you see
a load from uninitialized stack:

test_setelement:
.LFB546:
        subq    $40, %rsp
.LCFI0:
        movaps  16(%rsp), %xmm0
        movl    $0, 16(%rsp)
        movl    $0, 20(%rsp)
        movaps  %xmm0, %xmm1
        andnps  .LC1(%rip), %xmm0
        movl    $0, 24(%rsp)
        movl    $-1, 28(%rsp)
...

what is a bit inconsistent is that for mm_load_pd we use a type that
allows aliasing:

/* The Intel API is flexible enough that we must allow aliasing with other
   vector types, and their scalar components.  */
typedef long long __m128i __attribute__ ((__vector_size__ (16),
__may_alias__));
typedef double __m128d __attribute__ ((__vector_size__ (16), __may_alias__));

...

/* Load two DPFP values from P.  The address must be 16-byte aligned.  */
extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
_mm_load_pd (double const *__P)
{
  return *(__m128d *)__P;
}

but for mm_load_ps we don't:

/* Internal data types for implementing the intrinsics.  */
typedef float __v4sf __attribute__ ((__vector_size__ (16)));

...

/* Load four SPFP values from P.  The address must be 16-byte aligned.  */
extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
_mm_load_ps (float const *__P)
{
  return (__m128) *(__v4sf *)__P;
}


re-opening to investigate that.  HJ, are the SSE1 intrinsics not
aliasing in the Intel API?  The above snippets are from trunk.


  parent reply	other threads:[~2011-02-21 10:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-20 17:03 [Bug c/47825] New: " cck0011 at yahoo dot com
2011-02-20 17:36 ` [Bug c/47825] " rguenth at gcc dot gnu.org
2011-02-20 17:42 ` cck0011 at yahoo dot com
2011-02-20 18:08 ` rguenth at gcc dot gnu.org
2011-02-20 18:57 ` cck0011 at yahoo dot com
2011-02-21 10:44 ` rguenth at gcc dot gnu.org [this message]
2011-02-21 14:26 ` [Bug target/47825] " hjl.tools at gmail dot com
2011-02-22  1:53 ` cck0011 at yahoo dot com
2021-08-13 23:23 ` pinskia 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-47825-4-ozcOU0dusX@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).