This is the mail archive of the gcc-patches@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]

Patch: Make _mm_prefetch accept const pointers




Patch Description
=================

This patch fixes a regression from 4.2.1.

Without this change, the following code compiles at -O2 with 4.2.1, but not with current trunk:

const void* a = ...;
_mm_prefetch (a, ...);

The proposed change adds "const" to the first parameter of _mm_prefetch.

-_mm_prefetch (void *__P, enum _mm_hint __I)
+_mm_prefetch (const void *__P, enum _mm_hint __I)

The proposed change would make the signature closer to the corresponding one in the Intel C++ compiler for Linux, which is "void _mm_prefetch(char const*a, int sel)". See http://www.intel.com/software/products/compilers/clin/docs/ug_cpp/comm1030.htm.


Tested ======

Bootstrapped on i686.
make -k check showed no regression with vs. without this proposed patch.


gcc/ChangeLog =============

2008-01-29 Silvius Rus <rus@google.com>

* config/i386/xmmintrin.h (_mm_prefetch): Add const to first arg.


Thank you, Silvius



Index: config/i386/xmmintrin.h
===================================================================
--- config/i386/xmmintrin.h	(revision 131843)
+++ config/i386/xmmintrin.h	(working copy)
@@ -1193,7 +1193,7 @@
    processor.  The selector I specifies the type of prefetch operation.  */
 #ifdef __OPTIMIZE__
 static __inline void __attribute__((__always_inline__, __artificial__))
-_mm_prefetch (void *__P, enum _mm_hint __I)
+_mm_prefetch (const void *__P, enum _mm_hint __I)
 {
   __builtin_prefetch (__P, 0, __I);
 }


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