public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59071] New: sse2 intrinsics and constant expressions
@ 2013-11-10 20:05 vermaelen.wouter at gmail dot com
  2013-11-11 15:44 ` [Bug c++/59071] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vermaelen.wouter at gmail dot com @ 2013-11-10 20:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59071

            Bug ID: 59071
           Summary: sse2 intrinsics and constant expressions
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vermaelen.wouter at gmail dot com

gcc-4.8.2 with -O0 rejects the following code. With -O1 it works fine. Gcc-4.6,
4.7 and clang also work fine. I *believe* the stuff below is a constant
expression, so it should compile (even without optimizations enabled).

-------

#include "emmintrin.h"

template<int N> __m128i foo(__m128i x) {
    return _mm_slli_si128(x, sizeof(__m128i) - N);
}

void bar(__m128i x) { foo<4>(x); }

--------

> g++ test.cc
In file included from test.cc:1:0:
test.cc: In function ‘__m128i foo(__m128i) [with int N = 4; __m128i =
__vector(2) long long int]’:
test.cc:4:9: error: the last argument must be an 8-bit immediate
  return _mm_slli_si128(x, sizeof(__m128i) - N);
>From gcc-bugs-return-434206-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Nov 10 20:09:42 2013
Return-Path: <gcc-bugs-return-434206-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 31811 invoked by alias); 10 Nov 2013 20:09:41 -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 31782 invoked by uid 48); 10 Nov 2013 20:09:36 -0000
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/50643] Suppress cc1: warnings being treated as errors
Date: Sun, 10 Nov 2013 20:09:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.5.4
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: normal
X-Bugzilla-Who: pinskia at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.8.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status resolution target_milestone
Message-ID: <bug-50643-4-wVT33uOzIe@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-50643-4@http.gcc.gnu.org/bugzilla/>
References: <bug-50643-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: 2013-11/txt/msg00983.txt.bz2
Content-length: 598

http://gcc.gnu.org/bugzilla/show_bug.cgi?idP643

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.8.0

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
In GCC 4.8.0 and above, it shows what option enabled the error (in most cases)
including the warning option that enabled it.


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

* [Bug c++/59071] sse2 intrinsics and constant expressions
  2013-11-10 20:05 [Bug c++/59071] New: sse2 intrinsics and constant expressions vermaelen.wouter at gmail dot com
@ 2013-11-11 15:44 ` rguenth at gcc dot gnu.org
  2014-03-16 10:45 ` mark.j.abraham at gmail dot com
  2014-03-16 19:58 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-11 15:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59071

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Target|                            |x86_64-*-*, i?86-*-*
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-11-11
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.


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

* [Bug c++/59071] sse2 intrinsics and constant expressions
  2013-11-10 20:05 [Bug c++/59071] New: sse2 intrinsics and constant expressions vermaelen.wouter at gmail dot com
  2013-11-11 15:44 ` [Bug c++/59071] " rguenth at gcc dot gnu.org
@ 2014-03-16 10:45 ` mark.j.abraham at gmail dot com
  2014-03-16 19:58 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mark.j.abraham at gmail dot com @ 2014-03-16 10:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59071

Mark Abraham <mark.j.abraham at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark.j.abraham at gmail dot com

--- Comment #2 from Mark Abraham <mark.j.abraham at gmail dot com> ---
The same error message with 4.8.2 is provoked by

_mm_srli_si128((x), sizeof(int) * (i))

and is fixed by

_mm_srli_si128((x), 4 * (i))


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

* [Bug c++/59071] sse2 intrinsics and constant expressions
  2013-11-10 20:05 [Bug c++/59071] New: sse2 intrinsics and constant expressions vermaelen.wouter at gmail dot com
  2013-11-11 15:44 ` [Bug c++/59071] " rguenth at gcc dot gnu.org
  2014-03-16 10:45 ` mark.j.abraham at gmail dot com
@ 2014-03-16 19:58 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-03-16 19:58 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59071

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

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
You would need constexpr int n = sizeof(__i128i) - N;
to guarantee it is folded into a constant, otherwise there is no guarantee it
will be, it is normal expression and it is purely an optimization issue (which
you've requested not to be performed through -O0) whether it is evaluated as
constant or not.


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

end of thread, other threads:[~2014-03-16 19:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-10 20:05 [Bug c++/59071] New: sse2 intrinsics and constant expressions vermaelen.wouter at gmail dot com
2013-11-11 15:44 ` [Bug c++/59071] " rguenth at gcc dot gnu.org
2014-03-16 10:45 ` mark.j.abraham at gmail dot com
2014-03-16 19:58 ` 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).