public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-1559] IBM Z: Fix vector intrinsics vec_double and vec_floate
@ 2021-06-17 9:14 Marius Hillenbrand
0 siblings, 0 replies; only message in thread
From: Marius Hillenbrand @ 2021-06-17 9:14 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:a4fc63e0c3c6c7b895225c883137d152743be7fc
commit r12-1559-ga4fc63e0c3c6c7b895225c883137d152743be7fc
Author: Marius Hillenbrand <mhillen@linux.ibm.com>
Date: Wed Jun 16 18:26:48 2021 +0200
IBM Z: Fix vector intrinsics vec_double and vec_floate
Fix the mapping of vec_double and vec_floate to builtins.
gcc/ChangeLog:
PR target/100871
* config/s390/vecintrin.h (vec_doublee): Fix to use
__builtin_s390_vflls.
(vec_floate): Fix to use __builtin_s390_vflrd.
gcc/testsuite/ChangeLog:
* gcc.target/s390/zvector/vec-doublee.c: New test.
* gcc.target/s390/zvector/vec-floate.c: New test.
Diff:
---
gcc/config/s390/vecintrin.h | 4 ++--
.../gcc.target/s390/zvector/vec-doublee.c | 22 +++++++++++++++++++++
gcc/testsuite/gcc.target/s390/zvector/vec-floate.c | 23 ++++++++++++++++++++++
3 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/gcc/config/s390/vecintrin.h b/gcc/config/s390/vecintrin.h
index 6bd26f8a240..9a3f7c347ac 100644
--- a/gcc/config/s390/vecintrin.h
+++ b/gcc/config/s390/vecintrin.h
@@ -109,8 +109,8 @@ __lcbb(const void *ptr, int bndry)
#define vec_rint(X) __builtin_s390_vfi((X), 0, 0)
#define vec_roundc(X) __builtin_s390_vfi((X), 4, 0)
#define vec_round(X) __builtin_s390_vfi((X), 4, 4)
-#define vec_doublee(X) __builtin_s390_vfll((X))
-#define vec_floate(X) __builtin_s390_vflr((X), 0, 0)
+#define vec_doublee(X) __builtin_s390_vflls((X))
+#define vec_floate(X) __builtin_s390_vflrd((X), 0, 0)
#define vec_load_len_r(X,L) \
(__vector unsigned char)__builtin_s390_vlrlr((L),(X))
#define vec_store_len_r(X,Y,L) \
diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec-doublee.c b/gcc/testsuite/gcc.target/s390/zvector/vec-doublee.c
new file mode 100644
index 00000000000..11610f225e5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/zvector/vec-doublee.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch -mzvector --save-temps" } */
+/* { dg-do run { target { s390_z14_hw } } } */
+
+/*
+ * The vector intrinsic vec_doublee(a) converts the even-indexed
+ * single-precision numbers in a vector to double precision.
+ */
+#include <assert.h>
+#include <vecintrin.h>
+
+int
+main (void)
+{
+ vector float in = { 1.0, 2.0, 3.0, 4.0 };
+
+ vector double result = vec_doublee(in);
+ /* { dg-final { scan-assembler-times {\n\tvldeb} 1 } } */
+
+ assert(result[0] == (double)in[0]);
+ assert(result[1] == (double)in[2]);
+}
diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec-floate.c b/gcc/testsuite/gcc.target/s390/zvector/vec-floate.c
new file mode 100644
index 00000000000..0b9cbe3d89e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/zvector/vec-floate.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch -mzvector --save-temps" } */
+/* { dg-do run { target { s390_z14_hw } } } */
+
+/*
+ * The vector intrinsic vec_floate(a) rounds a vector of double-precision
+ * numbers to single-precision. The results are stored in the even-numbered
+ * target elements.
+ */
+#include <assert.h>
+#include <vecintrin.h>
+
+int
+main (void)
+{
+ vector double in = { 1.0, 2.0 };
+
+ vector float result = vec_floate(in);
+ /* { dg-final { scan-assembler-times {\n\tvledb} 1 } } */
+
+ assert(result[0] == (float)in[0]);
+ assert(result[2] == (float)in[1]);
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-17 9:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17 9:14 [gcc r12-1559] IBM Z: Fix vector intrinsics vec_double and vec_floate Marius Hillenbrand
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).