Created attachment 25978 [details] Minimal example. In avxintrin.h:762, the second parameter (__D) of the function _mm256_insert_epi64 is declared as int where it should be long long. This results in an uncorrect behavior (truncation to 32 bits then sign extension) when the attached minimal program is compiled with options -O3 -mavx. A look at the corresponding assembler code confirms this: [...] vpxor %xmm0, %xmm0, %xmm0 movslq %ebx, %rax vpinsrq $0, %rax, %xmm0, %xmm0 [...]
Created attachment 25979 [details] Patch to fix the reported typo. This simple patch should fix the typo in avxintrin.h.
The patch looks good, but patches should be sent to gcc-patches at gcc.gnu.org mailing list, with a proper ChangeLog entry. This one is short enough that it doesn't need copyright assignment, can you please send it there? Thanks.
Done, thanks!
Author: uros Date: Sun Dec 4 12:47:25 2011 New Revision: 181986 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181986 Log: PR target/51393 * config/i386/avxintrin.h (_mm256_insert_epi64): Declare second parameter as long long. testsuite/ChangeLog: 2011-12-04 Uros Bizjak <ubizjak@gmail.com> Jérémie Detrey <Jeremie.Detrey@loria.fr> PR target/51393 * gcc.target/i386/pr51393.c: New test. Added: trunk/gcc/testsuite/gcc.target/i386/pr51393.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/avxintrin.h trunk/gcc/testsuite/ChangeLog
Perfect, thank you very much!
Author: uros Date: Sun Dec 4 13:23:48 2011 New Revision: 181988 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181988 Log: PR target/51393 * config/i386/avxintrin.h (_mm256_insert_epi64): Declare second parameter as long long. testsuite/ChangeLog: PR target/51393 * gcc.target/i386/pr51393.c: New test. Added: branches/gcc-4_6-branch/gcc/testsuite/gcc.target/i386/pr51393.c Modified: branches/gcc-4_6-branch/gcc/ChangeLog branches/gcc-4_6-branch/gcc/config/i386/avxintrin.h branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Author: uros Date: Sun Dec 4 13:38:58 2011 New Revision: 181989 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181989 Log: PR target/51393 * config/i386/avxintrin.h (_mm256_insert_epi64): Declare second parameter as long long. testsuite/ChangeLog: PR target/51393 * gcc.target/i386/pr51393.c: New test. Added: branches/gcc-4_5-branch/gcc/testsuite/gcc.target/i386/pr51393.c Modified: branches/gcc-4_5-branch/gcc/ChangeLog branches/gcc-4_5-branch/gcc/config/i386/avxintrin.h branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
.
Author: jakub Date: Thu Dec 8 10:43:13 2011 New Revision: 182106 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182106 Log: Backported from mainline 2011-12-04 Jérémie Detrey <Jeremie.Detrey@loria.fr> PR target/51393 * config/i386/avxintrin.h (_mm256_insert_epi64): Declare second parameter as long long. 2011-12-04 Uros Bizjak <ubizjak@gmail.com> Jérémie Detrey <Jeremie.Detrey@loria.fr> PR target/51393 * gcc.target/i386/pr51393.c: New test. Added: branches/gcc-4_4-branch/gcc/testsuite/gcc.target/i386/pr51393.c Modified: branches/gcc-4_4-branch/gcc/ChangeLog branches/gcc-4_4-branch/gcc/config/i386/avxintrin.h branches/gcc-4_4-branch/gcc/testsuite/ChangeLog