This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/29881] union causes inefficient code
- From: "jose dot r dot fonseca at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Aug 2007 14:18:28 -0000
- Subject: [Bug middle-end/29881] union causes inefficient code
- References: <bug-29881-13582@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from jose dot r dot fonseca at gmail dot com 2007-08-07 14:18 -------
Created an attachment (id=14031)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14031&action=view)
Example code
This is the source-code for my example above. To get the assembly run as:
gcc -S -DCASE=0 -O3 -msse2 -o sse2-union-0.s sse2-union.cpp
gcc -S -DCASE=1 -O3 -msse2 -o sse2-union-1.s sse2-union.cpp
gcc -S -DCASE=2 -O3 -msse2 -o sse2-union-2.s sse2-union.cpp
gcc -S -DCASE=3 -O3 -msse2 -o sse2-union-3.s sse2-union.cpp
This was run on (gcc -v):
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.1.3 --program-suffix=-4.1
--enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug
--enable-mpfr --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.3 20070718 (prerelease) (Debian 4.1.2-14)
But I actually first discovered this in an unofficial build of gcc-4.2 for
MinGW.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29881