public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug regression/67609] New: [Regression] Generates wrong code for SSE2 _mm_load_pd
@ 2015-09-17 11:37 bisqwit at iki dot fi
  2015-09-17 12:51 ` [Bug target/67609] [5/6 Regression] " rguenth at gcc dot gnu.org
                   ` (31 more replies)
  0 siblings, 32 replies; 33+ messages in thread
From: bisqwit at iki dot fi @ 2015-09-17 11:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67609

            Bug ID: 67609
           Summary: [Regression] Generates wrong code for SSE2 _mm_load_pd
           Product: gcc
           Version: 5.2.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: regression
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bisqwit at iki dot fi
  Target Milestone: ---

For this program (needs -msse2 to compile).

    #include <emmintrin.h>
    __m128d reg;
    void set_lower(double b)
    {
        double v[2];
        _mm_store_pd(v, reg);
        v[0] = b;
        reg = _mm_load_pd(v);
    }

On optimization levels -O1 and up, GCC 5.2 incorrectly generates code that
destroys the upper half of reg.
        movapd  %xmm0, %xmm1
        movaps  %xmm1, reg(%rip)

On -O0, the bug does not occur.
If the index expression is changed into an expression whose value is not known
at compile-time, the code will work properly.

GCC 4.9 does this correctly (if with bit too much labor):

        movdqa  reg(%rip), %xmm1
        movaps  %xmm1, -24(%rsp)
        movsd   %xmm0, -24(%rsp)
        movapd  -24(%rsp), %xmm2
        movaps  %xmm2, reg(%rip)

For comparison, Clang 3.4 and 3.5:
        movlpd  %xmm0, reg(%rip)

For comparison, Clang 3.6:
        movaps  reg(%rip), %xmm1
        movsd   %xmm0, %xmm1
        movaps  %xmm1, reg(%rip)


^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2015-10-29 18:45 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-17 11:37 [Bug regression/67609] New: [Regression] Generates wrong code for SSE2 _mm_load_pd bisqwit at iki dot fi
2015-09-17 12:51 ` [Bug target/67609] [5/6 Regression] " rguenth at gcc dot gnu.org
2015-09-17 13:13 ` ubizjak at gmail dot com
2015-09-17 13:48 ` rguenth at gcc dot gnu.org
2015-09-17 18:09 ` [Bug regression/67609] " bisqwit at iki dot fi
2015-09-17 19:03 ` [Bug rtl-optimization/67609] " ubizjak at gmail dot com
2015-10-16 12:44 ` vmakarov at gcc dot gnu.org
2015-10-16 12:50 ` vmakarov at gcc dot gnu.org
2015-10-20 16:26 ` vmakarov at gcc dot gnu.org
2015-10-20 16:32 ` vmakarov at gcc dot gnu.org
2015-10-20 19:12 ` ubizjak at gmail dot com
2015-10-21  7:52 ` ubizjak at gmail dot com
2015-10-21 16:30 ` vmakarov at gcc dot gnu.org
2015-10-21 17:34 ` ubizjak at gmail dot com
2015-10-21 18:16 ` law at redhat dot com
2015-10-21 18:42 ` vmakarov at gcc dot gnu.org
2015-10-22  8:23 ` rguenth at gcc dot gnu.org
2015-10-22 12:49 ` law at redhat dot com
2015-10-22 13:40 ` rguenth at gcc dot gnu.org
2015-10-22 19:34 ` law at redhat dot com
2015-10-22 21:55 ` rth at gcc dot gnu.org
2015-10-22 22:54 ` rth at gcc dot gnu.org
2015-10-23  1:58 ` vmakarov at gcc dot gnu.org
2015-10-23  5:02 ` vmakarov at gcc dot gnu.org
2015-10-23  8:30 ` rguenth at gcc dot gnu.org
2015-10-23 13:14 ` vmakarov at gcc dot gnu.org
2015-10-23 19:06 ` rth at gcc dot gnu.org
2015-10-26 19:18 ` rth at gcc dot gnu.org
2015-10-26 21:48 ` vmakarov at gcc dot gnu.org
2015-10-27 10:18 ` rguenth at gcc dot gnu.org
2015-10-27 20:00 ` rth at gcc dot gnu.org
2015-10-29 18:37 ` rth at gcc dot gnu.org
2015-10-29 18:45 ` [Bug rtl-optimization/67609] [5 " rth at gcc dot gnu.org

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).