r239883 - Update the intel intrinsic headers to use the target attribute support.

Dimitry Andric dimitry at andric.com
Sun Aug 2 11:33:47 PDT 2015


On 17 Jun 2015, at 09:09, Eric Christopher <echristo at gmail.com> wrote:
> 
> Author: echristo
> Date: Wed Jun 17 02:09:32 2015
> New Revision: 239883
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=239883&view=rev
> Log:
> Update the intel intrinsic headers to use the target attribute support.
> 
> This involved removing the conditional inclusion and replacing them
> with target attributes matching the original conditional inclusion
> and checks.

One big problem with this approach, which I unfortunately found out just now, is that it trips up a lot of GNU configure scripts, which tend to check for SSE/SSE2 using fragments like the following:

    #include <xmmintrin.h>

    __m128 testfunc(float *a, float *b)
    {
      return _mm_add_ps(_mm_loadu_ps(a), _mm_loadu_ps(b));
    }

    int main(void)
    {
      return 0;
    }

Before this change, if you attempted to compile such a test on i386, clang would produce errors similar to:

    In file included from detect-sse.c:1:
    /usr/bin/../lib/clang/3.6.1/include/xmmintrin.h:28:2: error: "SSE instruction set not enabled"
    #error "SSE instruction set not enabled"
     ^
    detect-sse.c:3:1: error: unknown type name '__m128'
    __m128 testfunc(float *a, float *b)
    ^
    detect-sse.c:5:10: warning: implicit declaration of function '_mm_add_ps' is invalid in C99 [-Wimplicit-function-declaration]
      return _mm_add_ps(_mm_loadu_ps(a), _mm_loadu_ps(b));
             ^
    detect-sse.c:5:21: warning: implicit declaration of function '_mm_loadu_ps' is invalid in C99 [-Wimplicit-function-declaration]
      return _mm_add_ps(_mm_loadu_ps(a), _mm_loadu_ps(b));
                        ^
    2 warnings and 2 errors generated.

Whereas after this change, clang will compile and link the test program successfully.  Thus, the configure script will assume SSE is available, while it really isn't, which leads to problems later on ("fatal error in backend", which I reported in https://llvm.org/bugs/show_bug.cgi?id=24335 ).

I'm not sure what was gained by completely removing the #error guards, but it appears to do some real damage.  To make most SSE-using ports work correctly, I think I will be forced to locally restore them again, but I would really appreciate their restoration upstream too.

-Dimitry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150802/15eb75b7/attachment.sig>


More information about the cfe-commits mailing list