From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>,
Liang Li <liang.z.li@intel.com>
Cc: Amit Shah <amit.shah@redhat.com>,
Juan Quintela <quintela@redhat.com>,
qemu list <qemu-devel@nongnu.org>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [Qemu-devel] [PULL 0/5] migration pull
Date: Tue, 23 Feb 2016 15:04:46 +0100 [thread overview]
Message-ID: <56CC66FE.30702@redhat.com> (raw)
In-Reply-To: <CAFEAcA9+xoLBtFFv+wPpz7jvXj+NOi4KsmS_9Cvzx1FG=-LWXg@mail.gmail.com>
On 23/02/2016 12:25, Peter Maydell wrote:
> On 23 February 2016 at 10:43, Peter Maydell <peter.maydell@linaro.org> wrote:
>> That code fragment you suggest compiles fine normally, but not if I
>> add -save-temps:
>>
>> $ cat /tmp/zz9.c
>> #pragma GCC target("avx2")
>> #include <immintrin.h>
>> __m256i foo;
>> $ gcc -g -Wall -o /tmp/zz9.o -c /tmp/zz9.c
>> $ echo $?
>> 0
>> $ gcc -g -Wall -o /tmp/zz9.o -c /tmp/zz9.c -save-temps
>> /tmp/zz9.c:4:1: error: unknown type name ‘__m256i’
>> __m256i foo;
>> ^
>> /tmp/zz9.c: In function ‘bar’:
>> /tmp/zz9.c:7:19: error: ‘__m256i’ undeclared (first use in this function)
>> return sizeof(__m256i);
>> ^
>> /tmp/zz9.c:7:19: note: each undeclared identifier is reported only
>> once for each function it appears in
>> /tmp/zz9.c:8:1: warning: control reaches end of non-void function
>> [-Wreturn-type]
>> }
>> ^
>>
>> This seems to be because -save-temps causes the #pragma not to
>> actually #define __AVX__.
>
> This is because -save-temps causes gcc to invoke the
> preprocessor and the compiler as separate passes, and the
> standalone preprocessor doesn't know that the target pragma
> should result in a new #define, so the result is that the
> immintrin.h doesn't pull in what it should.
>
> This is also the reason why my build failed -- I use ccache,
> which is another tool that results in the preprocessor being
> done as a standalone pass rather than in the same pass as
> compilation proper.
>
> Arguably it's a gcc bug that the target pragma doesn't cause
> the standalone preprocessor to define the same #defines that
> you get if it's all in one pass, but regardless I don't think
> we can break ccache builds, so you'll need to find a different
> way to do this, I'm afraid.
It's a bug in the header file, it was fixed in 4.9.
https://gcc.gnu.org/ml/gcc-patches/2013-06/txtvBBiTsFs8g.txt
Amit or Liang, can you restrict the new optimization to GCC 4.9+?
Paolo
next prev parent reply other threads:[~2016-02-23 14:05 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-23 7:30 [Qemu-devel] [PULL 0/5] migration pull Amit Shah
2016-02-23 7:30 ` [Qemu-devel] [PULL 1/5] migration: move bdrv_invalidate_cache_all of of coroutine context Amit Shah
2016-02-23 7:30 ` [Qemu-devel] [PULL 2/5] " Amit Shah
2016-03-07 12:49 ` Dr. David Alan Gilbert
2016-03-07 13:30 ` Paolo Bonzini
2016-03-07 18:06 ` Dr. David Alan Gilbert
2016-03-07 18:58 ` Denis V. Lunev
2016-03-08 10:45 ` Dr. David Alan Gilbert
2016-03-08 10:54 ` Denis V. Lunev
2016-02-23 7:30 ` [Qemu-devel] [PULL 3/5] migration: reorder code to make it symmetric Amit Shah
2016-02-23 7:30 ` [Qemu-devel] [PULL 4/5] configure: detect ifunc and avx2 attribute Amit Shah
2016-02-23 7:30 ` [Qemu-devel] [PULL 5/5] cutils: add avx2 instruction optimization Amit Shah
2016-02-23 9:09 ` [Qemu-devel] [PULL 0/5] migration pull Peter Maydell
2016-02-23 9:38 ` Amit Shah
2016-02-23 9:48 ` Paolo Bonzini
2016-02-23 10:43 ` Peter Maydell
2016-02-23 11:18 ` Li, Liang Z
2016-02-23 11:25 ` Peter Maydell
2016-02-23 14:04 ` Paolo Bonzini [this message]
2016-02-24 9:27 ` Li, Liang Z
2016-03-08 4:23 ` Amit Shah
2016-03-08 4:28 ` Li, Liang Z
2016-02-23 9:55 ` Li, Liang Z
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56CC66FE.30702@redhat.com \
--to=pbonzini@redhat.com \
--cc=amit.shah@redhat.com \
--cc=dgilbert@redhat.com \
--cc=liang.z.li@intel.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).