This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Committed 2/2] S/390: Fix zvector vec_double builtin
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.
---
gcc/config/s390/s390-builtins.def | 4 ++--
gcc/testsuite/gcc.target/s390/zvector/vec-double-1.c | 12 ++++++++++++
gcc/testsuite/gcc.target/s390/zvector/vec-double-2.c | 12 ++++++++++++
3 files changed, 26 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/s390/zvector/vec-double-1.c
create mode 100644 gcc/testsuite/gcc.target/s390/zvector/vec-double-2.c
diff --git a/gcc/config/s390/s390-builtins.def b/gcc/config/s390/s390-builtins.def
index 49caa01..0fbe838 100644
--- a/gcc/config/s390/s390-builtins.def
+++ b/gcc/config/s390/s390-builtins.def
@@ -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 */
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
index 0000000..39b6d84
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/zvector/vec-double-1.c
@@ -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
index 0000000..c592ea2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/zvector/vec-double-2.c
@@ -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 } } */
--
2.7.4