public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/63379] New: Incorrect vectorization when enabling SSE and O3, initialises loop with wrong value
@ 2014-09-26  9:39 jwyatt at feralinteractive dot com
  2014-09-26  9:41 ` [Bug tree-optimization/63379] " jwyatt at feralinteractive dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: jwyatt at feralinteractive dot com @ 2014-09-26  9:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63379
           Summary: Incorrect vectorization when enabling SSE and O3,
                    initialises loop with wrong value
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jwyatt at feralinteractive dot com

Created attachment 33579
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33579&action=edit
.i file for simple test case

Enabling SSE and 03 causes gcc to vectorize the following for loop:

Point min_pt = pt_array[0];
for (Point *ptr = pt_array+1, *ptr_end = pt_array+size; ptr != ptr_end; ++ptr)
{
    min_pt.x = (min_pt.x < ptr->x) ? min_pt.x : ptr->x;
    min_pt.y = (min_pt.y < ptr->y) ? min_pt.y : ptr->y;
}

where pt_array is an array of:

struct Point {
    int x;
    int y;
};

This sets the min_pt.y value to an x value if the y values are greater than the
x values.

Looking at the assembly, the vectorization splits this into two. It looks like
for one of these, it initialises the first min y value as the min x value.

Compiled with g++ -msse --std=c++11 -O3 -Wall -Wextra test.cpp, which gives no
warnings.

Version info:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.3/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin
--enable-initfini-array --enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-isl=/builddir/build/BUILD/gcc-4.8.3-20140911/obj-x86_64-redhat-linux/isl-install
--with-cloog=/builddir/build/BUILD/gcc-4.8.3-20140911/obj-x86_64-redhat-linux/cloog-install
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.3 20140911 (Red Hat 4.8.3-7) (GCC)


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

end of thread, other threads:[~2014-11-26 13:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-26  9:39 [Bug tree-optimization/63379] New: Incorrect vectorization when enabling SSE and O3, initialises loop with wrong value jwyatt at feralinteractive dot com
2014-09-26  9:41 ` [Bug tree-optimization/63379] " jwyatt at feralinteractive dot com
2014-10-09  8:52 ` rguenth at gcc dot gnu.org
2014-10-09  8:58 ` rguenth at gcc dot gnu.org
2014-10-09 12:21 ` rguenth at gcc dot gnu.org
2014-10-09 12:40 ` [Bug tree-optimization/63379] [4.8/4.9/5 Regression] " rguenth at gcc dot gnu.org
2014-10-10 11:17 ` rguenth at gcc dot gnu.org
2014-10-10 14:24 ` [Bug tree-optimization/63379] [4.8 " rguenth at gcc dot gnu.org
2014-10-10 14:24 ` rguenth at gcc dot gnu.org
2014-10-13 14:26 ` clyon at gcc dot gnu.org
2014-10-15 13:40 ` rguenth at gcc dot gnu.org
2014-11-26 13:16 ` rguenth at gcc dot gnu.org
2014-11-26 13:16 ` rguenth 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).