public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR67278, x86 target part
@ 2016-03-02  8:55 Richard Biener
  2016-03-02  8:56 ` Uros Bizjak
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Richard Biener @ 2016-03-02  8:55 UTC (permalink / raw)
  To: gcc-patches; +Cc: ubizjak


The following fix from Uros properly (not) handles XFmode vectors in
type_natural_mode.

Bootstrapped and tested on x86_64-unknown-linux-gnu by Uros, applied.

Richard.

2016-03-02  Richard Biener  <rguenther@suse.de>
	Uros Bizjak  <ubizjak@gmail.com>

	PR target/67278
	* config/i386/i386.c (type_natural_mode): Handle XFmode vectors.

	* gcc.dg/simd-8.c: New testcase.

Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c	(revision 233897)
+++ gcc/config/i386/i386.c	(working copy)
@@ -7794,6 +7794,10 @@ type_natural_mode (const_tree type, cons
 	{
 	  machine_mode innermode = TYPE_MODE (TREE_TYPE (type));
 
+	  /* There are no XFmode vector modes.  */
+	  if (innermode = XFmode)
+	    return mode;
+
 	  if (TREE_CODE (TREE_TYPE (type)) == REAL_TYPE)
 	    mode = MIN_MODE_VECTOR_FLOAT;
 	  else
Index: gcc/testsuite/gcc.dg/simd-8.c
===================================================================
--- gcc/testsuite/gcc.dg/simd-8.c	(revision 0)
+++ gcc/testsuite/gcc.dg/simd-8.c	(working copy)
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+
+#if __SIZEOF_LONG_DOUBLE__ == 16 || __SIZEOF_LONG_DOUBLE__ == 8
+typedef long double a __attribute__((vector_size (32)));
+
+a __attribute__((noinline))
+sum (a first, a second)
+{
+    return first + second;
+}
+
+a
+foo (a x, a y, a z)
+{
+  return sum (x, y) + z;
+}
+#else
+int main() {}
+#endif

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

* Re: [PATCH] Fix PR67278, x86 target part
  2016-03-02  8:55 [PATCH] Fix PR67278, x86 target part Richard Biener
@ 2016-03-02  8:56 ` Uros Bizjak
  2016-03-02 10:04   ` Richard Biener
  2016-03-02  9:01 ` Eric Botcazou
  2016-03-08 22:22 ` Andreas Schwab
  2 siblings, 1 reply; 5+ messages in thread
From: Uros Bizjak @ 2016-03-02  8:56 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

On Wed, Mar 2, 2016 at 9:54 AM, Richard Biener <rguenther@suse.de> wrote:
>
> The following fix from Uros properly (not) handles XFmode vectors in
> type_natural_mode.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu by Uros, applied.
>
> Richard.
>
> 2016-03-02  Richard Biener  <rguenther@suse.de>
>         Uros Bizjak  <ubizjak@gmail.com>
>
>         PR target/67278
>         * config/i386/i386.c (type_natural_mode): Handle XFmode vectors.
>
>         * gcc.dg/simd-8.c: New testcase.
>
> Index: gcc/config/i386/i386.c
> ===================================================================
> --- gcc/config/i386/i386.c      (revision 233897)
> +++ gcc/config/i386/i386.c      (working copy)
> @@ -7794,6 +7794,10 @@ type_natural_mode (const_tree type, cons
>         {
>           machine_mode innermode = TYPE_MODE (TREE_TYPE (type));
>
> +         /* There are no XFmode vector modes.  */
> +         if (innermode = XFmode)

No, not assignment "=" , but comparison "==" here!

Uros.

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

* Re: [PATCH] Fix PR67278, x86 target part
  2016-03-02  8:55 [PATCH] Fix PR67278, x86 target part Richard Biener
  2016-03-02  8:56 ` Uros Bizjak
@ 2016-03-02  9:01 ` Eric Botcazou
  2016-03-08 22:22 ` Andreas Schwab
  2 siblings, 0 replies; 5+ messages in thread
From: Eric Botcazou @ 2016-03-02  9:01 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches, ubizjak

> Index: gcc/config/i386/i386.c
> ===================================================================
> --- gcc/config/i386/i386.c	(revision 233897)
> +++ gcc/config/i386/i386.c	(working copy)
> @@ -7794,6 +7794,10 @@ type_natural_mode (const_tree type, cons
>  	{
>  	  machine_mode innermode = TYPE_MODE (TREE_TYPE (type));
> 
> +	  /* There are no XFmode vector modes.  */
> +	  if (innermode = XFmode)
> +	    return mode;
> +
>  	  if (TREE_CODE (TREE_TYPE (type)) == REAL_TYPE)
>  	    mode = MIN_MODE_VECTOR_FLOAT;
>  	  else

You lost one of the '=' though.

-- 
Eric Botcazou

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

* Re: [PATCH] Fix PR67278, x86 target part
  2016-03-02  8:56 ` Uros Bizjak
@ 2016-03-02 10:04   ` Richard Biener
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Biener @ 2016-03-02 10:04 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches

On Wed, 2 Mar 2016, Uros Bizjak wrote:

> On Wed, Mar 2, 2016 at 9:54 AM, Richard Biener <rguenther@suse.de> wrote:
> >
> > The following fix from Uros properly (not) handles XFmode vectors in
> > type_natural_mode.
> >
> > Bootstrapped and tested on x86_64-unknown-linux-gnu by Uros, applied.
> >
> > Richard.
> >
> > 2016-03-02  Richard Biener  <rguenther@suse.de>
> >         Uros Bizjak  <ubizjak@gmail.com>
> >
> >         PR target/67278
> >         * config/i386/i386.c (type_natural_mode): Handle XFmode vectors.
> >
> >         * gcc.dg/simd-8.c: New testcase.
> >
> > Index: gcc/config/i386/i386.c
> > ===================================================================
> > --- gcc/config/i386/i386.c      (revision 233897)
> > +++ gcc/config/i386/i386.c      (working copy)
> > @@ -7794,6 +7794,10 @@ type_natural_mode (const_tree type, cons
> >         {
> >           machine_mode innermode = TYPE_MODE (TREE_TYPE (type));
> >
> > +         /* There are no XFmode vector modes.  */
> > +         if (innermode = XFmode)
> 
> No, not assignment "=" , but comparison "==" here!

Argh.

Fixed.

Richard.

2016-03-02  Richard Biener  <rguenther@suse.de>

	* config/i386/i386.c (type_natural_mode): Fix typo.

Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c	(revision 233900)
+++ gcc/config/i386/i386.c	(working copy)
@@ -7795,7 +7795,7 @@ type_natural_mode (const_tree type, cons
 	  machine_mode innermode = TYPE_MODE (TREE_TYPE (type));
 
 	  /* There are no XFmode vector modes.  */
-	  if (innermode = XFmode)
+	  if (innermode == XFmode)
 	    return mode;
 
 	  if (TREE_CODE (TREE_TYPE (type)) == REAL_TYPE)

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

* Re: [PATCH] Fix PR67278, x86 target part
  2016-03-02  8:55 [PATCH] Fix PR67278, x86 target part Richard Biener
  2016-03-02  8:56 ` Uros Bizjak
  2016-03-02  9:01 ` Eric Botcazou
@ 2016-03-08 22:22 ` Andreas Schwab
  2 siblings, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2016-03-08 22:22 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches, ubizjak

Richard Biener <rguenther@suse.de> writes:

> Index: gcc/testsuite/gcc.dg/simd-8.c
> ===================================================================
> --- gcc/testsuite/gcc.dg/simd-8.c	(revision 0)
> +++ gcc/testsuite/gcc.dg/simd-8.c	(working copy)
> @@ -0,0 +1,19 @@
> +/* { dg-do compile } */
> +
> +#if __SIZEOF_LONG_DOUBLE__ == 16 || __SIZEOF_LONG_DOUBLE__ == 8
> +typedef long double a __attribute__((vector_size (32)));
> +
> +a __attribute__((noinline))
> +sum (a first, a second)
> +{
> +    return first + second;
> +}
> +
> +a
> +foo (a x, a y, a z)
> +{
> +  return sum (x, y) + z;
> +}
> +#else
> +int main() {}
> +#endif

On powerpc:

FAIL: gcc.dg/simd-8.c (test for excess errors)
Excess errors:
/daten/gcc/gcc-20160307/gcc/testsuite/gcc.dg/simd-8.c:8:1: warning: GCC vector returned by reference: non-standard ABI extension with no compatibility guarantee
/daten/gcc/gcc-20160307/gcc/testsuite/gcc.dg/simd-8.c:7:1: warning: GCC vector passed by reference: non-standard ABI extension with no compatibility guarantee

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

end of thread, other threads:[~2016-03-08 22:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-02  8:55 [PATCH] Fix PR67278, x86 target part Richard Biener
2016-03-02  8:56 ` Uros Bizjak
2016-03-02 10:04   ` Richard Biener
2016-03-02  9:01 ` Eric Botcazou
2016-03-08 22:22 ` Andreas Schwab

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).