i386: Skip decimal float vector modes in type_natural_mode [PR79754]

Message ID CAFULd4YDeomHJKnUK2NEVLy31iq=B7=S5ucTF1o0TiGg1j-rvw@mail.gmail.com
State Committed
Commit edadc7e0510b703d9727cf5ff68d55d84bb95def
Headers
Series i386: Skip decimal float vector modes in type_natural_mode [PR79754] |

Commit Message

Uros Bizjak Feb. 12, 2022, 9:57 a.m. UTC
  2022-02-12  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:

    PR target/79754
    * config/i386/i386.cc (type_natural_mode):
    Skip decimal float vector modes.

gcc/testsuite/ChangeLog:

    PR target/79754
    * gcc.target/i386/pr79754.c: New test.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Pushed to master.

Uros.
  

Comments

Eric Botcazou Feb. 17, 2022, 4:05 p.m. UTC | #1
> gcc/testsuite/ChangeLog:
> 
>     PR target/79754
>     * gcc.target/i386/pr79754.c: New test.
> 
> Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
> 
> Pushed to master.

And 11 branch apparently, but it should be:

/* { dg-do compile { target dfp } } */

instead of just:

/* { dg-do compile } *
  

Patch

diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 6b97a2b0e50..cf246e74e57 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -1876,10 +1876,14 @@  type_natural_mode (const_tree type, const CUMULATIVE_ARGS *cum,
 	{
 	  machine_mode innermode = TYPE_MODE (TREE_TYPE (type));
 
-	  /* There are no XFmode vector modes.  */
+	  /* There are no XFmode vector modes ...  */
 	  if (innermode == XFmode)
 	    return mode;
 
+	  /* ... and no decimal float vector modes.  */
+	  if (DECIMAL_FLOAT_MODE_P (innermode))
+	    return mode;
+
 	  if (TREE_CODE (TREE_TYPE (type)) == REAL_TYPE)
 	    mode = MIN_MODE_VECTOR_FLOAT;
 	  else
diff --git a/gcc/testsuite/gcc.target/i386/pr79754.c b/gcc/testsuite/gcc.target/i386/pr79754.c
new file mode 100644
index 00000000000..27845c9d5b9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr79754.c
@@ -0,0 +1,7 @@ 
+/* PR target/79754 */
+/* { dg-do compile } */
+/* { dg-options "-Wno-psabi" } */
+
+typedef _Decimal32 V __attribute__ ((vector_size(16)));
+
+V fn1 (V a) { return a; }