Bug 33944 - streaming 64-bit integer stores
Summary: streaming 64-bit integer stores
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.3.0
: P3 enhancement
Target Milestone: 4.7.0
Assignee: Not yet assigned to anyone
URL: http://gcc.gnu.org/ml/gcc-patches/201...
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-29 18:51 UTC by dean
Modified: 2018-03-12 10:52 UTC (History)
3 users (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2011-11-18 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dean 2007-10-29 18:51:41 UTC
x86_64 extended the sse2 movnti instruction to support 64-bit integer registers as well.  i don't see any builtin for generating this... nor is there an intrinsic listed in the intel manuals or apparently in icc 10.0.023 header files either.  the natural name would be _mm_stream_si64 -- which fortunately does not conflict with _mm_stream_pi, the mmx 64-bit store version.

on a whim i tried this:

void foo(unsigned long *d, unsigned long v)
{
  __builtin_ia32_movntq((unsigned long long *)d, v);
}

results in this code:

0000000000000000 <foo>:
   0:   48 89 74 24 f8          mov    %rsi,0xfffffffffffffff8(%rsp)
   5:   0f 6f 44 24 f8          movq   0xfffffffffffffff8(%rsp),%mm0
   a:   0f e7 07                movntq %mm0,(%rdi)
   d:   c3                      retq

perhaps this builtin could be overloaded to generate the "movnti %rsi,(%rdi)" directly instead of shuffling through the mmx reg file?

(note if i throw in -mtune=core2 it eliminates the trip through the stack)

-dean

/home/odo/gcc/bin/gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc/configure --prefix=/home/odo/gcc --disable-multilib --disable-biarch x86_64-unknown-linux-gnu --enable-languages=c
Thread model: posix
gcc version 4.3.0 20071029 (experimental) (GCC)
Comment 1 H.J. Lu 2011-11-18 18:00:24 UTC
A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2011-11/msg01938.html
Comment 2 hjl@gcc.gnu.org 2011-11-18 19:02:49 UTC
Author: hjl
Date: Fri Nov 18 19:02:45 2011
New Revision: 181491

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181491
Log:
Add _mm_stream_si64.

2011-11-18  H.J. Lu  <hongjiu.lu@intel.com>

	PR target/33944
	* doc/extend.texi: Document __builtin_ia32_movnti64.

	* config/i386/emmintrin.h (_mm_stream_si64): New.

	* config/i386/i386-builtin-types.def: Add VOID_FTYPE_PLONGLONG_LONGLONG.

	* config/i386/i386.c (ix86_builtins): Add IX86_BUILTIN_MOVNTI64.
	(bdesc_special_args): Update __builtin_ia32_movnti.  Add
	__builtin_ia32_movnti64.
	(ix86_expand_special_args_builtin): Handle
	VOID_FTYPE_PLONGLONG_LONGLONG.

	* config/i386/i386.md (UNSPEC_MOVNTI): New.

	* config/i386/sse.md (sse2_movntsi): Renamed to ...
	(sse2_movnti<mode>): This.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/emmintrin.h
    trunk/gcc/config/i386/i386-builtin-types.def
    trunk/gcc/config/i386/i386.c
    trunk/gcc/config/i386/i386.md
    trunk/gcc/config/i386/sse.md
    trunk/gcc/doc/extend.texi
Comment 3 Eric Gallager 2018-03-12 04:26:35 UTC
(In reply to hjl@gcc.gnu.org from comment #2)
> Author: hjl
> Date: Fri Nov 18 19:02:45 2011
> New Revision: 181491
> 
> URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181491
> Log:
> Add _mm_stream_si64.
> 
> 2011-11-18  H.J. Lu  <hongjiu.lu@intel.com>
> 
> 	PR target/33944
> 	* doc/extend.texi: Document __builtin_ia32_movnti64.
> 
> 	* config/i386/emmintrin.h (_mm_stream_si64): New.
> 
> 	* config/i386/i386-builtin-types.def: Add VOID_FTYPE_PLONGLONG_LONGLONG.
> 
> 	* config/i386/i386.c (ix86_builtins): Add IX86_BUILTIN_MOVNTI64.
> 	(bdesc_special_args): Update __builtin_ia32_movnti.  Add
> 	__builtin_ia32_movnti64.
> 	(ix86_expand_special_args_builtin): Handle
> 	VOID_FTYPE_PLONGLONG_LONGLONG.
> 
> 	* config/i386/i386.md (UNSPEC_MOVNTI): New.
> 
> 	* config/i386/sse.md (sse2_movntsi): Renamed to ...
> 	(sse2_movnti<mode>): This.
> 
> Modified:
>     trunk/gcc/ChangeLog
>     trunk/gcc/config/i386/emmintrin.h
>     trunk/gcc/config/i386/i386-builtin-types.def
>     trunk/gcc/config/i386/i386.c
>     trunk/gcc/config/i386/i386.md
>     trunk/gcc/config/i386/sse.md
>     trunk/gcc/doc/extend.texi

Did this fix it?
Comment 4 H.J. Lu 2018-03-12 10:52:58 UTC
Fixed for 4.7.0.