qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06


From: Peter Maydell
Subject: Re: [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06
Date: Mon, 6 Jun 2016 20:35:24 +0100

On 6 June 2016 at 20:22, Dr. David Alan Gilbert <address@hidden> wrote:
> Sigh I see; so the configure test is run with a different set of compiler
> options than the main compiles?  How is any configure test supposed to
> check that it's got a sane configuration?

I wasn't quite right -- we do run configure tests with ccache, we just
force it to not read the cache. So I think your problem is just that
your configure test doesn't fail when run under ccache, even though the
main cutils.c compile does:

$ cat /tmp/zz9.c
#pragma GCC push_options
#pragma GCC target("avx2")
#include <cpuid.h>
#include <immintrin.h>

static int bar(void *a) {
    return _mm256_movemask_epi8(_mm256_cmpeq_epi8(*(__m256i *)a, (__m256i){0}));
}
static void *bar_ifunc(void) {return (void*) bar;}
int foo(void *a) __attribute__((ifunc("bar_ifunc")));
int main(int argc, char *argv[]) { return foo(argv[0]);}
$ ccache gcc -g -Wall -o /tmp/zz9 /tmp/zz9.c

This seems to be because to get the compile failure you have
to be doing a .c to .o compile:

$ ccache gcc -g -Wall -o /tmp/zz9.o -c /tmp/zz9.c
/tmp/zz9.c: In function ‘bar’:
/tmp/zz9.c:7:5: warning: implicit declaration of function
‘_mm256_movemask_epi8’ [-Wimplicit-function-declaration]
     return _mm256_movemask_epi8(_mm256_cmpeq_epi8(*(__m256i *)a,
(__m256i){0}));
     ^
/tmp/zz9.c:7:5: warning: implicit declaration of function
‘_mm256_cmpeq_epi8’ [-Wimplicit-function-declaration]
/tmp/zz9.c:7:53: error: ‘__m256i’ undeclared (first use in this function)
     return _mm256_movemask_epi8(_mm256_cmpeq_epi8(*(__m256i *)a,
(__m256i){0}));
                                                     ^
/tmp/zz9.c:7:53: note: each undeclared identifier is reported only
once for each function it appears in
/tmp/zz9.c:7:62: error: expected expression before ‘)’ token
     return _mm256_movemask_epi8(_mm256_cmpeq_epi8(*(__m256i *)a,
(__m256i){0}));
                                                              ^
/tmp/zz9.c:8:1: warning: control reaches end of non-void function
[-Wreturn-type]
 }
 ^

but since your test is using compile_prog it does a .c to executable.

The difference is because ccache doesn't intercept .c-to-executable
compiles, so they go straight to real gcc and don't have -save-temps,
but it does intercept a .c-to-.o compile, which thus does get -save-temps
and so hits the gcc bug.

TLDR: if you make your configure test use compile_object it ought to
correctly detect that AVX2 doesn't work for this gcc+ccache combo.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]