S/390: Fix zvector vec_double builtin
authorAndreas Krebbel <krebbel@linux.ibm.com>
Thu, 13 Dec 2018 11:57:16 +0000 (11:57 +0000)
committerAndreas Krebbel <krebbel@gcc.gnu.org>
Thu, 13 Dec 2018 11:57:16 +0000 (11:57 +0000)
The (unsigned) long int to double vector conversion instructions
expect 2 immediate parameters. One for the inexact suppression
control and another one for the rounding mode.  However, the
vec_double builtin has just the vector source operand.  The 2
addtional operands need to be added with an intermediate expander.
The expanders were already there but unfortunately not wired up
correctly to the builtin.

gcc/ChangeLog:

2018-12-13  Andreas Krebbel  <krebbel@linux.ibm.com>

* config/s390/s390-builtins.def (s390_vec_double_s64): Map to
s390_vec_double_s64 instead of s390_vcdgb.
(s390_vec_double_u64): Map to s390_vec_double_u64 instead of
s390_vcdlgb.

gcc/testsuite/ChangeLog:

2018-12-13  Andreas Krebbel  <krebbel@linux.ibm.com>

* gcc.target/s390/zvector/vec-double-1.c: New test.
* gcc.target/s390/zvector/vec-double-2.c: New test.

From-SVN: r267084

gcc/ChangeLog
gcc/config/s390/s390-builtins.def
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/s390/zvector/vec-double-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/s390/zvector/vec-double-2.c [new file with mode: 0644]

index de4a75b5a9efe4054fb5d8a10d53f5ed590f4398..7c93dedf10f66e9ddbcfc981faa7d58096429c7d 100644 (file)
@@ -1,3 +1,10 @@
+2018-12-13  Andreas Krebbel  <krebbel@linux.ibm.com>
+
+       * config/s390/s390-builtins.def (s390_vec_double_s64): Map to
+       s390_vec_double_s64 instead of s390_vcdgb.
+       (s390_vec_double_u64): Map to s390_vec_double_u64 instead of
+       s390_vcdlgb.
+
 2018-12-13  Andreas Krebbel  <krebbel@linux.ibm.com>
 
        * config/s390/vx-builtins.md ("vec_ctd_s64", "vec_ctd_u64")
index 49caa01245db913cee96e7ff41336840757fc0ab..0fbe838cbf9ec943dd6c99e412309a1b3d24ee29 100644 (file)
@@ -2811,8 +2811,8 @@ B_DEF      (s390_vfsqsb,                sqrtv4sf2,          0,
 B_DEF      (s390_vfsqdb,                sqrtv2df2,          0,                  B_VX,               0,                  BT_FN_V2DF_V2DF)
 
 OB_DEF     (s390_vec_double,            s390_vec_double_s64,s390_vec_double_u64,B_VX,               BT_FN_OV4SI_OV4SI)
-OB_DEF_VAR (s390_vec_double_s64,        s390_vcdgb,         0,                  0,                  BT_OV_V2DF_V2DI)
-OB_DEF_VAR (s390_vec_double_u64,        s390_vcdlgb,        0,                  0,                  BT_OV_V2DF_UV2DI)
+OB_DEF_VAR (s390_vec_double_s64,        s390_vec_double_s64,0,                  0,                  BT_OV_V2DF_V2DI)
+OB_DEF_VAR (s390_vec_double_u64,        s390_vec_double_u64,0,                  0,                  BT_OV_V2DF_UV2DI)
 
 B_DEF      (s390_vec_double_s64,        vec_double_s64,     0,                  B_INT | B_VX,       0,                  BT_FN_V2DF_V2DI)  /* vcdgb */
 B_DEF      (s390_vec_double_u64,        vec_double_u64,     0,                  B_INT | B_VX,       0,                  BT_FN_V2DF_UV2DI) /* vcdlgb */
index 33d4ff349ebe79b927d00ce3fb435d9fb594885a..fd750d785ec97461d1720bfe91fee4b76e95dc60 100644 (file)
@@ -1,3 +1,8 @@
+2018-12-13  Andreas Krebbel  <krebbel@linux.ibm.com>
+
+       * gcc.target/s390/zvector/vec-double-1.c: New test.
+       * gcc.target/s390/zvector/vec-double-2.c: New test.
+
 2018-12-13  Wei Xiao  <wei3.xiao@intel.com>
 
        * gcc.target/i386/funcspec-56.inc: Handle new march.
diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec-double-1.c b/gcc/testsuite/gcc.target/s390/zvector/vec-double-1.c
new file mode 100644 (file)
index 0000000..39b6d84
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -march=z13 -mzvector" } */
+
+#include <vecintrin.h>
+
+vector double
+test (vector unsigned long long x)
+{
+  return vec_double (x);
+}
+
+/* { dg-final { scan-assembler-times "vcdlgb\t" 1 } } */
diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec-double-2.c b/gcc/testsuite/gcc.target/s390/zvector/vec-double-2.c
new file mode 100644 (file)
index 0000000..c592ea2
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mzarch -march=z13 -mzvector" } */
+
+#include <vecintrin.h>
+
+vector double
+test (vector long long x)
+{
+  return vec_double (x);
+}
+
+/* { dg-final { scan-assembler-times "vcdgb\t" 1 } } */