[cfe-dev] clang miscompile prevents ATLAS build

Clint Whaley whaley at cs.utsa.edu
Sun Sep 4 12:40:12 PDT 2011


Eli,

>Don't use -mavx with clang... the support is incomplete at best.  (I'm
>actually not entirely sure why exactly the option exists.)

People want to compile ATLAS with clang.  ATLAS is in the performance
business.  Not using AVX cuts your peak in half compared to SSE on 
sandy bridge.  I'm aware clang itself is probably not using AVX well, but
ATLAS contains intrinsics code that people want to compile with clang.  
Without -mavx flag, clang is not a competitive compiler for ATLAS.

:(
Clint


> I believe you will find that clang waits until *after* the subroutine call
> to load the values, at which point they have been overwritten by the call.
>
> In order to get clang to produce the right answer, you must rewrite
> the loop in this way:
>   for (j=0; j < N; j++, A += lda2, Y += 2)
>   {
>      double dot[2]
>      dotu_sub(M, A, 1, X, 1, dot);
>      *Y += dot[0];
>      Y[1] += dot[1];
>   }
>
> Thanks,
> Clint
>
> **************************************************************************
> ** R. Clint Whaley, PhD ** Assist Prof, UTSA ** www.cs.utsa.edu/~whaley **
> **************************************************************************
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>


**************************************************************************
** R. Clint Whaley, PhD ** Assist Prof, UTSA ** www.cs.utsa.edu/~whaley **
**************************************************************************



More information about the cfe-dev mailing list