This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

multiple conversion bugs in xmmintrin.h


Hi,

I think I found out a recurrent bug in the Intel's SSE intrinsics headers
(xmmintrin.h, but other Intel intrinsics headers may be concerned too).

The resulting compiler error is simply a conversion from  const type *  to
type *  which is forbidden in C++.
There is also another error message that shows up about another pointer
conversion error in __mm_stream_pi. Although it's not related to the bug I
explain here I think it's important to point it out as it might be another
bug too.

Here I used the intrinsic __mm_loadu_ps() as an example to replicate the
bug, but there are other intrinsics that are affected by that bug (most of
them, if not all, related to loading from memory).

The bug is partially due to Intel's specifications as they talk about
__mm_loadu_ps(float *)  while in fact it should be  __mm_loadu_ps(const
float *).
While their specifications are not correct, their headers properly implement
it and declare it with  const float * . (confirmed with Intel C++ Compiler
6.0 and Visual Studio .NET (2002 and 2003) headers).

Thus, some parameters of some intrinsics declared as  type *  instead of
const type *  make the use of these intrinsics nearly impossible in C++.


PS: _mm_malloc() and _mm_free() doesn't seem to be implemented in the
version of GCC I have. Is it correct to use malloc() instead, assuming that
the returned address will always be aligned on 16 bytes? Man pages aren't
very clear about it.


Thanks.
Best regards,

Tanguy


-------------------------------------


g++-3.2 -v -save-temps -msse simd_bug.cpp

Reading specs from /usr/lib/gcc-lib/i386-linux/3.2.3/specs
Configured with:
../src/configure -v --enable-languages=c,c++,java,f77,proto,pascal,objc,ada 
--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-i
nclude-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-
nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --
enable-java-gc=boehm --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.2.3 20030309 (Debian prerelease)
/usr/lib/gcc-lib/i386-linux/3.2.3/cpp0 -lang-c++ -D__GNUG__=3 -D__DEPRECATED
 -D__EXCEPTIONS -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=3 -
D__GXX_ABI_VERSION=102 -D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D
__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__N
O_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di38
6 -D__i386 -D__i386__ -D__SSE__ -D__MMX__ -D__tune_i386__ simd_bug.cpp
simd_bug.ii
GNU CPP version 3.2.3 20030309 (Debian prerelease) (cpplib) (i386 Linux/ELF)
ignoring nonexistent directory "/usr/i386-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/3.2
/usr/include/c++/3.2/i386-linux
/usr/include/c++/3.2/backward
/usr/local/include
/usr/lib/gcc-lib/i386-linux/3.2.3/include
/usr/include
End of search list.
/usr/lib/gcc-lib/i386-linux/3.2.3/cc1plus -fpreprocessed
simd_bug.ii -quiet -dumpbase simd_bug.cpp -msse -version -o simd_bug.s
GNU CPP version 3.2.3 20030309 (Debian prerelease) (cpplib) (i386 Linux/ELF)
GNU C++ version 3.2.3 20030309 (Debian prerelease) (i386-linux)
compiled by GNU C version 3.2.3 20030309 (Debian prerelease).
In file included from simd_bug.cpp:2:
/usr/lib/gcc-lib/i386-linux/3.2.3/include/xmmintrin.h: In function `void
_mm_stream_pi(vector int*, vector int)':
/usr/lib/gcc-lib/i386-linux/3.2.3/include/xmmintrin.h:1036: cannot convert `
vector int*' to `long long unsigned int*' for argument `1' to `void
__builtin_ia32_movntq(long long unsigned int*, long long unsigned int)'
simd_bug.cpp: In function `int main()':
simd_bug.cpp:13: invalid conversion from `const float*' to `float*'

Attachment: simd_bug.zip
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]