Dear all, Attached is a patch which fixes bug target/51393:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51393 Also attached, avx_bug.c is a minimal example to reproduce the bug (requires an AVX-capable CPU): $ gcc -O3 -mavx avx_bug.c $ ./a.out 0x80000000 in = 0x0000000080000000 out = 0xffffffff80000000 The correct output should be: $ ./a.out 0x80000000 in = 0x0000000080000000 out = 0x0000000080000000 As explained in the bug report, it's just a matter of the second parameter of _mm256_insert_epi64 being declared as int where it should be long long (avxintrin.h:762). A simple typo, trivially fixed by the attached patch. Thanks a lot! Cheers, Jérémie.
Index: gcc/config/i386/avxintrin.h =================================================================== --- gcc/config/i386/avxintrin.h (revision 181965) +++ gcc/config/i386/avxintrin.h (working copy) @@ -759,7 +759,7 @@ _mm256_insert_epi8 (__m256i __X, int __D #ifdef __x86_64__ extern __inline __m256i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -_mm256_insert_epi64 (__m256i __X, int __D, int const __N) +_mm256_insert_epi64 (__m256i __X, long long __D, int const __N) { __m128i __Y = _mm256_extractf128_si256 (__X, __N >> 1); __Y = _mm_insert_epi64 (__Y, __D, __N % 2);
2011-12-03 Jérémie Detrey <jeremie.det...@loria.fr> PR target/51393 * config/i386/avxintrin.h (_mm256_insert_epi64): Declare second parameter as long long.