Q:

Mingw confusing function names

I am currently working on porting some code from Visual Studio to Mingw. 
The person that had written the component is no longer available and I am not really familiar with the details of the component.  Currently I am running into an issue where I thing Mingw is confusing the name of a function with an internal function.  The code is something like this
 void _mm_prefetch(char const *_A, int _Sel); 

static FORCE_INLINE void sysdep_intrin_prefetch(void *ptr, cardinal_t offset)
{
  _mm_prefetch(REINTERPRET_CAST(const char *, cardinal_to_ptr(ptr_to_cardinal(ptr) + offset)),
           1 /* _MM_HINT_T0 */);
}

The error is as follows:
||=== Build: Debug x64 in AVS_Wrapper (compiler: MinGW GCC - 2/17/2015) ===|
avs2\include\win32\aiw.h|247|error: variable or field '__builtin_prefetch' declared void|
avs2\include\win32\aiw.h|247|error: expected primary-expression before 'char'|
avs2\include\win32\aiw.h|247|error: expected ')' before 'char'|
avs2\include\win32\aaw64.h|13|error: expected unqualified-id before '__asm__'|
||=== Build failed: 4 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|

This is my build window
g++.exe -std=c++11 -DWIN32 -D_DEBUG -D_WINDOWS -D_USRDLL -DAVS_WRAPPER_EXPORTS -DAVS_TARGET_WIN7 -std=c++11 -Iavs2\include\win32 -I..\..\..\..\mingw64\required\boost_1_57_0 -I. -IC:\Users\admin\gc3\avw -c C:\Users\admin\gc3\avw\avw.cpp -o "Win32\Debug x64\avw.o"
g++.exe -std=c++11 -DWIN32 -D_DEBUG -D_WINDOWS -D_USRDLL -DAVS_WRAPPER_EXPORTS -DAVS_TARGET_WIN7 -std=c++11 -Iavs2\include\win32 -I..\..\..\..\mingw64\required\boost_1_57_0 -I. -IC:\Users\admin\gc3\avw\wrapper -c C:\Users\admin\gc3\avw\wrapper\AvsSystem.cpp -o "Win32\Debug x64\wrapper\AvsSystem.o"
In file included from C:/mingw64/lib/gcc/x86_64-w64-mingw32/4.8.2/include/x86intrin.h:34:0,
                 from C:/mingw64/x86_64-w64-mingw32/include/winnt.h:1495,
                 from C:/mingw64/x86_64-w64-mingw32/include/minwindef.h:147,
                 from C:/mingw64/x86_64-w64-mingw32/include/windef.h:8,
                 from C:/mingw64/x86_64-w64-mingw32/include/windows.h:69,
                 from C:\Users\admin\gc3\avw\wrapper\AvsSystem.cpp:1:
avs2\include\win32/aiw.h:247:6: error: variable or field '__builtin_prefetch' declared void
 void _mm_prefetch(char const *_A, int _Sel);

Apparently from what I understand so far is that the compiler thinks
_mm_prefetch function is __builtin_prefetch 
How do i tell the compiler that they are different.  What options do I have to circumvent this issue ? 

A:

Mingw is confusing the name of a function with an internal function

It's 100% entitled to do so.   The language rules (2.10p3) say that:

Each  identifier  that  begins  with  an  underscore  is  reserved  to  the  implementation  for  use  as  a  name  in the global namespace. 

Do not name your own function _mm_prefetch.   (That is, to fix the error you must rename the function.)