On Fri, 15 Jun 2012, Ramana Radhakrishnan wrote:

On 15 June 2012 18:18, Marc Glisse <marc.gli...@inria.fr> wrote:
On Fri, 15 Jun 2012, Ramana Radhakrishnan wrote:

I just noticed this part. Rereading my comment in

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51033#c22


I haven't been able to make it break with -std=c++11 . Is there
something I'm missing here ?


I don't remember. It might just be that trying to create a constexpr vector
variable or calling __builtin_shuffle on it ICEs instead of giving an error.
I can keep a note to make some tests at the end of July (I will be mostly
away until then), but I believe the code from comment 22 is safer than the
one from comment 20, if memory serves.

I'm not qualified enough to take a call on what's better in this case
and will have to defer to Jason and the C++ maintainers on this one.

Now that you've said this I decided to go back and throw more tests through it
I've tried to chug through most of the testcases for __builtin_shuffle
including a few of my own the simplest of which I show below trying to
trigger this issue but can't seem to do so.

Maybe something like:

#include <x86intrin.h>
int main(){
  constexpr __m128d x={1.,2.};
  constexpr __m128i y={1,0};
  constexpr __m128d z=__builtin_shuffle(x,y);
}

?
(sorry for the x86 specific code, should be easy to adapt)

See also:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53094

Long term, vectors should be literals. But we need something to avoid crashes on operator[] and __builtin_shuffle (ideally implementing the constant version of them). Keeping vectors as non-literals (what I was suggesting) is quite a crude hack. Maybe having them as literals now is a good thing, but it would be good to avoid the ICEs.

--
Marc Glisse

Reply via email to