[PATCH] Fix PR91069

Richard Biener rguenther@suse.de
Thu Jul 4 07:34:00 GMT 2019


On Thu, 4 Jul 2019, Jakub Jelinek wrote:

> On Wed, Jul 03, 2019 at 12:49:34PM +0200, Richard Biener wrote:
> > 2019-07-03  Richard Biener  <rguenther@suse.de>
> > 
> > 	PR middle-end/91069
> > 	* match.pd (vec_perm -> bit_insert): Fix element read from
> > 	first vector.
> > 
> > 	* gcc.dg/pr91069.c: New testcase.
> 
> I've noticed the testcase FAILs on ia32, the problem is that long is
> 32-bit and so v2di type isn't v2di we are expecting, but v4si and mismatches
> the v2df in number of elements and element precision.
> 
> Fixed thusly, regtested on x86_64-linux and i686-linux, committed to trunk.
> 
> Note, still not truly portable, if double and long long have different
> sizes on some target, this will still fail.

Hmm, yeah.  I guess some #if on __SIZEOF_LONG_LONG__ != __SIZEOF_DOUBLE__
might do the trick.  OTOH it would be nice if we'd not need to
spell out the vector type for constant shuffles but have the FE
autodetect them, thus make

 __builtin_shuffle ((v2df) { 1.0, 0.0 }, x, { 1, 3 })

work magically.

Richard.

> 2019-07-04  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR middle-end/91069
> 	* gcc.dg/pr91069.c (v2df): Use 2 * sizeof (double) instead of
> 	hardcoded 16 for better portability.
> 	(v2di): Change from long vector to long long vector.  Use
> 	2 * sizeof (long long) instead of hardcoded 16.
> 
> --- gcc/testsuite/gcc.dg/pr91069.c.jj	2019-07-04 00:18:31.510099301 +0200
> +++ gcc/testsuite/gcc.dg/pr91069.c	2019-07-04 07:08:24.944046933 +0200
> @@ -1,8 +1,8 @@
>  /* { dg-do run } */
>  /* { dg-options "-std=gnu11" } */
>  
> -typedef double v2df __attribute__((vector_size(16)));
> -typedef long v2di __attribute__((vector_size(16)));
> +typedef double v2df __attribute__((vector_size(2 * sizeof (double))));
> +typedef long long v2di __attribute__((vector_size(2 * sizeof (long long))));
>  
>  void foo (v2df *res, v2df *src)
>  {
> 



More information about the Gcc-patches mailing list