public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/64554] New: _mm_clmulepi64_si128 doesn't compile with -O2
@ 2015-01-09 21:32 charles at kde dot org
  2015-01-09 21:37 ` [Bug target/64554] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: charles at kde dot org @ 2015-01-09 21:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64554

            Bug ID: 64554
           Summary: _mm_clmulepi64_si128 doesn't compile with -O2
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: charles at kde dot org

The following trivial program:

#include <wmmintrin.h>

int main()
{
        __m128i a, b;
        _mm_clmulepi64_si128(a, b, 1);
}

Produces the following error at compile time:

In file included from test.c:1:0:
test.c: In function ‘main’:
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/wmmintrin.h:116:1: error: inlining
failed in call to always_inline ‘_mm_clmulepi64_si128’: target specific option
mismatch
 _mm_clmulepi64_si128 (__m128i __X, __m128i __Y, const int __I)
 ^
test.c:6:2: error: called from here
  _mm_clmulepi64_si128(a, b, 1);
  ^

When compiled with the option -O2 or -O1. Compiling succeeds with -O0.



Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.1-19'
--with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.9 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify
--enable-plugin --with-system-zlib --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.9.1 (Debian 4.9.1-19) 

(Debian testing)
>From gcc-bugs-return-472668-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Jan 09 21:35:51 2015
Return-Path: <gcc-bugs-return-472668-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 11378 invoked by alias); 9 Jan 2015 21:35:51 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 11357 invoked by uid 48); 9 Jan 2015 21:35:47 -0000
From: "charles at kde dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/64554] _mm_clmulepi64_si128 doesn't compile with -O2
Date: Fri, 09 Jan 2015 21:35:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.9.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: charles at kde dot org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-64554-4-n472u2ervi@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64554-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64554-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-01/txt/msg00662.txt.bz2
Content-length: 182

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd554

--- Comment #1 from charles at kde dot org ---
It does compile with -march=westmere or later. I guess this is intended
behavior.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/64554] _mm_clmulepi64_si128 doesn't compile with -O2
  2015-01-09 21:32 [Bug c/64554] New: _mm_clmulepi64_si128 doesn't compile with -O2 charles at kde dot org
@ 2015-01-09 21:37 ` pinskia at gcc dot gnu.org
  2015-01-09 21:43 ` charles at kde dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-01-09 21:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64554

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-linux-gnu

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
What is the command line you are invoking to compile this source?  Do have the
correct options to enable it?  Like say -mpclmul?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/64554] _mm_clmulepi64_si128 doesn't compile with -O2
  2015-01-09 21:32 [Bug c/64554] New: _mm_clmulepi64_si128 doesn't compile with -O2 charles at kde dot org
  2015-01-09 21:37 ` [Bug target/64554] " pinskia at gcc dot gnu.org
@ 2015-01-09 21:43 ` charles at kde dot org
  2015-01-09 21:53 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: charles at kde dot org @ 2015-01-09 21:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64554

--- Comment #3 from charles at kde dot org ---
with "gcc test.c -O2" it fails
with "gcc test.c -O2 -mpclmul" it succeeds.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/64554] _mm_clmulepi64_si128 doesn't compile with -O2
  2015-01-09 21:32 [Bug c/64554] New: _mm_clmulepi64_si128 doesn't compile with -O2 charles at kde dot org
  2015-01-09 21:37 ` [Bug target/64554] " pinskia at gcc dot gnu.org
  2015-01-09 21:43 ` charles at kde dot org
@ 2015-01-09 21:53 ` jakub at gcc dot gnu.org
  2015-01-09 21:55 ` charles at kde dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-01-09 21:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64554

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I don't see any bug in that.  You can't use intrinsics for ISAs that aren't
enabled, either from command line, or default -march selection, or through
target attribute on particular function, or function multi-versioning.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/64554] _mm_clmulepi64_si128 doesn't compile with -O2
  2015-01-09 21:32 [Bug c/64554] New: _mm_clmulepi64_si128 doesn't compile with -O2 charles at kde dot org
                   ` (2 preceding siblings ...)
  2015-01-09 21:53 ` jakub at gcc dot gnu.org
@ 2015-01-09 21:55 ` charles at kde dot org
  2015-01-12  9:41 ` [Bug middle-end/64554] using _mm_clmulepi64_si128 doesn't error with -O0 rguenth at gcc dot gnu.org
  2015-01-12 10:05 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: charles at kde dot org @ 2015-01-09 21:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64554

--- Comment #5 from charles at kde dot org ---
No you're right.

I could add, though, that the compiler should have said something.

Also, why did it compile just fine with -O0?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/64554] using _mm_clmulepi64_si128 doesn't error with -O0
  2015-01-09 21:32 [Bug c/64554] New: _mm_clmulepi64_si128 doesn't compile with -O2 charles at kde dot org
                   ` (3 preceding siblings ...)
  2015-01-09 21:55 ` charles at kde dot org
@ 2015-01-12  9:41 ` rguenth at gcc dot gnu.org
  2015-01-12 10:05 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-12  9:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64554

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-01-12
                 CC|                            |hubicka at gcc dot gnu.org
          Component|target                      |middle-end
            Summary|_mm_clmulepi64_si128        |using _mm_clmulepi64_si128
                   |doesn't compile with -O2    |doesn't error with -O0
     Ever confirmed|0                           |1

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to charles from comment #5)
> No you're right.
> 
> I could add, though, that the compiler should have said something.
> 
> Also, why did it compile just fine with -O0?

Sounds like a bug (we should error immediately here IMHO).  Probably
needs to annotate the CIF codes with whether this is "fatal" (won't
change with other inlining, IPA or LTO).

OTOH the headers are also poorly designed to trigger this kind of error.

Maybe we want to support __attribute__((always_inline("ISA not enabled")))
instead to be able to print a custom error message?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/64554] using _mm_clmulepi64_si128 doesn't error with -O0
  2015-01-09 21:32 [Bug c/64554] New: _mm_clmulepi64_si128 doesn't compile with -O2 charles at kde dot org
                   ` (4 preceding siblings ...)
  2015-01-12  9:41 ` [Bug middle-end/64554] using _mm_clmulepi64_si128 doesn't error with -O0 rguenth at gcc dot gnu.org
@ 2015-01-12 10:05 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-01-12 10:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64554

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #6)
> (In reply to charles from comment #5)
> > No you're right.
> > 
> > I could add, though, that the compiler should have said something.
> > 
> > Also, why did it compile just fine with -O0?
> 
> Sounds like a bug (we should error immediately here IMHO).  Probably
> needs to annotate the CIF codes with whether this is "fatal" (won't
> change with other inlining, IPA or LTO).
> 
> OTOH the headers are also poorly designed to trigger this kind of error.
> 
> Maybe we want to support __attribute__((always_inline("ISA not enabled")))
> instead to be able to print a custom error message?

The difference is that for __OPTIMIZE__   _mm_clmulepi64_si128 is implemented
as always_inline function (surrounded by #pragma GCC target("pclmul")), so for
-O1+ the inlining error is expected, such function can't be inlined into the
current function, and always_inline mandates that it is inlined (without
always_inline it would simply not be inlined, and the out of line
_mm_clmulepi64_si128 would use the pclmul ISA, while the caller would not).

For -O0, this is implemented using a macro, since the last argument must be a
constant, and the reason you get no error is that the function is const and you
don't use the result, so it is DCEd.
If you actually use the result (at -O0 it is enough to store it into say
__m128i c = _mm_clmulepi64_si128(a, b, 1); , for -O1 you'd need something
better, store into volatile var, or global var or otherwise make sure it isn't
DCEd), then you get this diagnosed:

/tmp/z.c: In function ‘main’:
/tmp/z.c:6:11: error: ‘__builtin_ia32_pclmulqdq128’ needs isa option -m32
-mpclmul
   __m128i c = _mm_clmulepi64_si128(a, b, 1);
           ^

So I don't see any bug on the gcc side here.
>From gcc-bugs-return-472775-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Jan 12 10:10:57 2015
Return-Path: <gcc-bugs-return-472775-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 7619 invoked by alias); 12 Jan 2015 10:10:56 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 7526 invoked by uid 48); 12 Jan 2015 10:10:51 -0000
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/64535] Emergency buffer for exception allocation too small
Date: Mon, 12 Jan 2015 10:10:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jakub at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-64535-4-wqB0sXBlBs@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64535-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64535-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-01/txt/msg00769.txt.bz2
Content-length: 350

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd535

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
If all allocations from the emergency pool are at least
sizeof(__cxa_refcounted_exception) long (or what is the minimum), then trying
to split the memory into smaller chunks (down to sizeof(free_entry)) might be
counter-productive.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-01-12 10:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-09 21:32 [Bug c/64554] New: _mm_clmulepi64_si128 doesn't compile with -O2 charles at kde dot org
2015-01-09 21:37 ` [Bug target/64554] " pinskia at gcc dot gnu.org
2015-01-09 21:43 ` charles at kde dot org
2015-01-09 21:53 ` jakub at gcc dot gnu.org
2015-01-09 21:55 ` charles at kde dot org
2015-01-12  9:41 ` [Bug middle-end/64554] using _mm_clmulepi64_si128 doesn't error with -O0 rguenth at gcc dot gnu.org
2015-01-12 10:05 ` jakub at gcc dot gnu.org

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 read-only IMAP folder(s) and NNTP newsgroup(s).