clang miscompile prevents ATLAS build

Hi,

I believe I've found a bug in clang/llvm on a sandy bridge CPU. I am using
the svn version of clang downloaded yesterday:

sb4>clang -v
clang version 3.0 (trunk 139049)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Take this piece of code:

Hi,

I believe I've found a bug in clang/llvm on a sandy bridge CPU. I am using
the svn version of clang downloaded yesterday:

sb4>clang -v
clang version 3.0 (trunk 139049)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Take this piece of code:
*******************************************************************************
void ATL_UGEMV(const int M, const int N, const double *A, const int lda,
const double *X, double *Y)
/*
* y = [0,1]*y + A*x, A is MxN, storing the transpose of the matrix
*/
{
double ry, iy;
const int lda2 = lda+lda;
int j;
void dotu_sub(const int, const double*, const int, const double*,
const int, double *);

for (j=0; j < N; j++, A += lda2, Y += 2)
{
ry = *Y; iy = Y[1];
dotu_sub(M, A, 1, X, 1, Y);
*Y += ry;
Y[1] += iy;
}
}
*******************************************************************************

If you compile with
clang -fomit-frame-pointer -mavx -O2 -m64 -S

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

-Eli

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.

:frowning:
Clint

Proper AVX support is non-trivial, and it simply isn't in a working
state. We are making progress...

-Eli

Are you using tot clang and llvm? We are just about done with -mavx. It has passed all of Intel's test suite.

Evan

Are you using tot clang and llvm? We are just about done with -mavx. It has passed all of Intel's test suite.

Really? I thought it was somewhat less stable, considering the amount
of development work going into AVX support recently (not to mention
the number of open bugs with AVX in the title).

-Eli

Are you using tot clang and llvm? We are just about done with -mavx. It has passed all of Intel's test suite.

Really? I thought it was somewhat less stable, considering the amount
of development work going into AVX support recently (not to mention
the number of open bugs with AVX in the title).

It's considered functionality complete. The only missing piece is the vzeroupper pass. The current focus is on performance. Obviously there are bugs since we have only run Intel and LLVM test suite through it. We welcome bug reports to help to flush out all the issues.

Evan