public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-12] amdgcn: Various fixes for SIMD math library
@ 2022-11-07 15:15 Kwok Yeung
0 siblings, 0 replies; only message in thread
From: Kwok Yeung @ 2022-11-07 15:15 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:6c40e3f5daad1ff317d3dcc15aba98f87ed4106d
commit 6c40e3f5daad1ff317d3dcc15aba98f87ed4106d
Author: Kwok Cheung Yeung <kcy@codesourcery.com>
Date: Mon Nov 7 12:28:23 2022 +0000
amdgcn: Various fixes for SIMD math library
Fix an error if VECTOR_RETURN is used on a constant.
Simplify the implementation of ilogb by removing VECTOR_IFs with a trivial
body.
2022-11-07 Kwok Cheung Yeung <kcy@codesourcery.com>
libgcc/
* config/gcn/simd-math/amdgcnmach.h (VECTOR_RETURN): Store value of
return value in a local variable first.
* config/gcn/simd-math/v64df_ilogb.c (ilogb): Simplify.
Diff:
---
libgcc/ChangeLog.omp | 6 ++++++
libgcc/config/gcn/simd-math/amdgcnmach.h | 3 ++-
libgcc/config/gcn/simd-math/v64df_ilogb.c | 34 +++++++++++++------------------
3 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/libgcc/ChangeLog.omp b/libgcc/ChangeLog.omp
index af9abdb220e..f41bbbb339a 100644
--- a/libgcc/ChangeLog.omp
+++ b/libgcc/ChangeLog.omp
@@ -1,3 +1,9 @@
+2022-11-07 Kwok Cheung Yeung <kcy@codesourcery.com>
+
+ * config/gcn/simd-math/amdgcnmach.h (VECTOR_RETURN): Store value of
+ return value in a local variable first.
+ * config/gcn/simd-math/v64df_ilogb.c (ilogb): Simplify.
+
2022-11-07 Kwok Cheung Yeung <kcy@codesourcery.com>
* config/gcn/simd-math/v64df_rint.c (rint): Simplified. Fixed bug in
diff --git a/libgcc/config/gcn/simd-math/amdgcnmach.h b/libgcc/config/gcn/simd-math/amdgcnmach.h
index f821f7b2c77..4436a950825 100644
--- a/libgcc/config/gcn/simd-math/amdgcnmach.h
+++ b/libgcc/config/gcn/simd-math/amdgcnmach.h
@@ -177,7 +177,8 @@ do { \
do { \
_Static_assert (__builtin_types_compatible_p (typeof (retval), typeof (__ret))); \
__auto_type __cond = __builtin_convertvector ((cond), typeof (__mask)); \
- VECTOR_COND_MOVE (__ret, (retval), __cond); \
+ __auto_type __retval = (retval); \
+ VECTOR_COND_MOVE (__ret, __retval, __cond); \
__mask &= ~__cond; \
} while (0)
diff --git a/libgcc/config/gcn/simd-math/v64df_ilogb.c b/libgcc/config/gcn/simd-math/v64df_ilogb.c
index aa71b845dc1..ea51bf10523 100644
--- a/libgcc/config/gcn/simd-math/v64df_ilogb.c
+++ b/libgcc/config/gcn/simd-math/v64df_ilogb.c
@@ -16,33 +16,27 @@
DEF_VD_MATH_PRED (v64si, ilogb, v64df x)
{
FUNCTION_INIT(v64si);
-
v64si hx, lx, ix;
EXTRACT_WORDS (hx, lx, x);
hx &= 0x7fffffff;
VECTOR_IF (hx < 0x00100000, cond)
- VECTOR_IF2 ((hx | lx) == 0, cond2, cond)
- VECTOR_RETURN (VECTOR_INIT (-__INT_MAX__), cond2); // FP_ILOGB0
- VECTOR_ELSE (cond2)
- VECTOR_IF2 (hx == 0, cond3, cond2)
- ix = VECTOR_INIT (-1043);
- for (v64si i = lx;
- !ALL_ZEROES_P (cond3 & (i > 0));
- i <<= 1)
- VECTOR_COND_MOVE (ix, ix - 1, cond3 & (i > 0));
- VECTOR_ELSE2 (cond3, cond2)
- ix = VECTOR_INIT (-1022);
- for (v64si i = (hx << 11);
- !ALL_ZEROES_P (cond3 & (i > 0));
- i <<= 1)
- VECTOR_COND_MOVE (ix, ix - 1, cond3 & (i > 0));
- VECTOR_ENDIF
+ VECTOR_RETURN (VECTOR_INIT (-__INT_MAX__), cond & ((hx | lx) == 0)); // FP_ILOGB0
+ VECTOR_IF2 (hx == 0, cond2, cond)
+ ix = VECTOR_INIT (-1043);
+ for (v64si i = lx;
+ !ALL_ZEROES_P (cond2 & (i > 0));
+ i <<= 1)
+ VECTOR_COND_MOVE (ix, ix - 1, cond2 & (i > 0));
+ VECTOR_ELSE2 (cond2, cond)
+ ix = VECTOR_INIT (-1022);
+ for (v64si i = (hx << 11);
+ !ALL_ZEROES_P (cond2 & (i > 0));
+ i <<= 1)
+ VECTOR_COND_MOVE (ix, ix - 1, cond2 & (i > 0));
VECTOR_ENDIF
VECTOR_RETURN (ix, cond);
VECTOR_ENDIF
- VECTOR_IF (hx < 0x7ff00000, cond)
- VECTOR_RETURN ((hx >> 20) - 1023, cond);
- VECTOR_ENDIF
+ VECTOR_RETURN ((hx >> 20) - 1023, hx < 0x7ff00000);
VECTOR_RETURN (VECTOR_INIT (__INT_MAX__), NO_COND);
FUNCTION_RETURN;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-07 15:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-07 15:15 [gcc/devel/omp/gcc-12] amdgcn: Various fixes for SIMD math library Kwok Yeung
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).