From a00ccce85885e1ddafe83c177dffa17cb7aff89d Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Thu, 13 Dec 2018 11:57:16 +0000 Subject: [PATCH] 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 * 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 * 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 | 7 +++++++ gcc/config/s390/s390-builtins.def | 4 ++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/s390/zvector/vec-double-1.c | 12 ++++++++++++ gcc/testsuite/gcc.target/s390/zvector/vec-double-2.c | 12 ++++++++++++ 5 files changed, 38 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/ChangeLog b/gcc/ChangeLog index de4a75b5a9e..7c93dedf10f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-12-13 Andreas Krebbel + + * 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 * config/s390/vx-builtins.md ("vec_ctd_s64", "vec_ctd_u64") diff --git a/gcc/config/s390/s390-builtins.def b/gcc/config/s390/s390-builtins.def index 49caa01245d..0fbe838cbf9 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/ChangeLog b/gcc/testsuite/ChangeLog index 33d4ff349eb..fd750d785ec 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-13 Andreas Krebbel + + * 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 * 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 index 00000000000..39b6d84f828 --- /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 + +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 00000000000..c592ea2e975 --- /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 + +vector double +test (vector long long x) +{ + return vec_double (x); +} + +/* { dg-final { scan-assembler-times "vcdgb\t" 1 } } */ -- 2.30.2