Bug 51393 - Wrong parameter type for _mm256_insert_epi64 in avxintrin.h
Summary: Wrong parameter type for _mm256_insert_epi64 in avxintrin.h
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.6.2
: P3 normal
Target Milestone: 4.5.4
Assignee: Not yet assigned to anyone
URL: http://gcc.gnu.org/ml/gcc-patches/201...
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-03 11:19 UTC by Jérémie Detrey
Modified: 2011-12-08 10:43 UTC (History)
1 user (show)

See Also:
Host:
Target: x86
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-12-03 00:00:00


Attachments
Minimal example. (318 bytes, text/x-c)
2011-12-03 11:19 UTC, Jérémie Detrey
Details
Patch to fix the reported typo. (286 bytes, patch)
2011-12-03 11:21 UTC, Jérémie Detrey
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jérémie Detrey 2011-12-03 11:19:38 UTC
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
  [...]
Comment 1 Jérémie Detrey 2011-12-03 11:21:17 UTC
Created attachment 25979 [details]
Patch to fix the reported typo.

This simple patch should fix the typo in avxintrin.h.
Comment 2 Jakub Jelinek 2011-12-03 16:56:23 UTC
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.
Comment 3 Jérémie Detrey 2011-12-03 17:25:10 UTC
Done, thanks!
Comment 4 uros 2011-12-04 12:47:28 UTC
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
Comment 5 Jérémie Detrey 2011-12-04 12:51:53 UTC
Perfect, thank you very much!
Comment 6 uros 2011-12-04 13:23:52 UTC
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
Comment 7 uros 2011-12-04 13:39:03 UTC
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
Comment 8 Uroš Bizjak 2011-12-04 13:42:32 UTC
.
Comment 9 Jakub Jelinek 2011-12-08 10:43:18 UTC
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