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]

GCC does not support *mmintrin.h with function specific opts


Hi,

    *mmintrin headers does not work with function specific opts.

Example 1:


#include <smmintrin.h>

__attribute__((target("sse4.1")))
__m128i foo(__m128i *V)
{
    return _mm_stream_load_si128(V);
}


$ g++ test.cc
smmintrin.h:31:3: error: #error "SSE4.1 instruction set not enabled"
 # error "SSE4.1 instruction set not enabled"

This error happens even though foo is marked "sse4.1"

There are multiple issues at play here. One, the headers are guarded
by macros that are switched on only when the target specific options,
like -msse4.1 in this case, are present in the command line. Also, the
target specific builtins, like __builtin_ia32_movntdqa called by
_mm_stream_load_si128, are exposed only in the presence of the
appropriate target ISA option.


I have attached a patch that fixes this. I have added an option
"-mgenerate-builtins" that will do two things.  It will define a macro
"__ALL_ISA__" which will expose the *intrin.h functions. It will also
expose all the target specific builtins.  -mgenerate-builtins will not
affect code generation.

This feature will greatly benefit the function multiversioning usability too.

Comments?

Thanks
Sri

Attachment: mmintrin_patch.txt
Description: Text document


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