public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Minor updates to the new math code
@ 2018-07-11 10:12 Szabolcs Nagy
  2018-07-11 10:12 ` [PATCH 1/2] Fix the documentation comments for log_inline in pow Szabolcs Nagy
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2018-07-11 10:12 UTC (permalink / raw)
  To: newlib; +Cc: nd

Further issues caught while testing the same code for glibc.
The generated code should not change on any targets.
Tested on aarch64.

Szabolcs Nagy (2):
   Fix the documentation comments for log_inline in pow
   Remove float compare option from sincosf

  newlib/libm/common/pow.c     |  6 +++---
  newlib/libm/common/sincosf.h | 11 +----------
  2 files changed, 4 insertions(+), 13 deletions(-)

-- 
2.14.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] Fix the documentation comments for log_inline in pow
  2018-07-11 10:12 [PATCH 0/2] Minor updates to the new math code Szabolcs Nagy
@ 2018-07-11 10:12 ` Szabolcs Nagy
  2018-07-11 12:39 ` [PATCH 2/2] Remove float compare option from sincosf Szabolcs Nagy
  2018-07-11 15:18 ` [PATCH 0/2] Minor updates to the new math code Corinna Vinschen
  2 siblings, 0 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2018-07-11 10:12 UTC (permalink / raw)
  To: newlib; +Cc: nd

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: 0001-Fix-the-documentation-comments-for-log_inline-in-pow.patch --]
[-- Type: text/x-patch, Size: 1157 bytes --]

From 3d8215160f71affa1a5a0977cac79e0aba33e868 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date: Tue, 10 Jul 2018 17:13:27 +0100
Subject: [PATCH 1/2] Fix the documentation comments for log_inline in pow

There was a typo and the arguments were not explained clearly.
---
 newlib/libm/common/pow.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/newlib/libm/common/pow.c b/newlib/libm/common/pow.c
index a5504e5e9..e02817ec2 100644
--- a/newlib/libm/common/pow.c
+++ b/newlib/libm/common/pow.c
@@ -53,9 +53,9 @@ top12 (double x)
   return asuint64 (x) >> 52;
 }
 
-/* Compute y+tail = log(x) where the rounded result is y and tail has about
-   additional 15 bits precision.  The bit representation of x if in ix, but
-   normalized in the subnormal range using sign bit too for the exponent.  */
+/* Compute y+TAIL = log(x) where the rounded result is y and TAIL has about
+   additional 15 bits precision.  IX is the bit representation of x, but
+   normalized in the subnormal range using the sign bit for the exponent.  */
 static inline double_t
 log_inline (uint64_t ix, double_t *tail)
 {
-- 
2.14.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] Remove float compare option from sincosf
  2018-07-11 10:12 [PATCH 0/2] Minor updates to the new math code Szabolcs Nagy
  2018-07-11 10:12 ` [PATCH 1/2] Fix the documentation comments for log_inline in pow Szabolcs Nagy
@ 2018-07-11 12:39 ` Szabolcs Nagy
  2018-07-11 15:18 ` [PATCH 0/2] Minor updates to the new math code Corinna Vinschen
  2 siblings, 0 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2018-07-11 12:39 UTC (permalink / raw)
  To: newlib; +Cc: nd

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: 0002-Remove-float-compare-option-from-sincosf.patch --]
[-- Type: text/x-patch, Size: 1573 bytes --]

From 82d80802dd01b6cbbf361c027e1af02e626bd5bd Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date: Tue, 10 Jul 2018 17:14:32 +0100
Subject: [PATCH 2/2] Remove float compare option from sincosf

PREFER_FLOAT_COMPARISON setting was not correct as it could raise
spurious exceptions.  Fixing it is easy: just use ISLESS(x, y) instead
of abstop12(x) < abstop12(y) with appropriate non-signaling definition
for ISLESS.  However it seems this setting is not very useful (there is
only minor performance difference on various architectures), so remove
this option for now.
---
 newlib/libm/common/sincosf.h | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/newlib/libm/common/sincosf.h b/newlib/libm/common/sincosf.h
index 27f24ffe3..3cac8e88f 100644
--- a/newlib/libm/common/sincosf.h
+++ b/newlib/libm/common/sincosf.h
@@ -43,21 +43,12 @@ extern const sincos_t __sincosf_table[2] HIDDEN;
 
 extern const uint32_t __inv_pio4[] HIDDEN;
 
-/* abstop12 assumes floating point reinterpret is fast by default.
-   If floating point comparisons are faster, define PREFER_FLOAT_COMPARISON.  */
-#if PREFER_FLOAT_COMPARISON
-static inline float
-abstop12 (float x)
-{
-  return fabsf (x);
-}
-#else
+/* Top 12 bits of the float representation with the sign bit cleared.  */
 static inline uint32_t
 abstop12 (float x)
 {
   return (asuint (x) >> 20) & 0x7ff;
 }
-#endif
 
 /* Compute the sine and cosine of inputs X and X2 (X squared), using the
    polynomial P and store the results in SINP and COSP.  N is the quadrant,
-- 
2.14.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] Minor updates to the new math code
  2018-07-11 10:12 [PATCH 0/2] Minor updates to the new math code Szabolcs Nagy
  2018-07-11 10:12 ` [PATCH 1/2] Fix the documentation comments for log_inline in pow Szabolcs Nagy
  2018-07-11 12:39 ` [PATCH 2/2] Remove float compare option from sincosf Szabolcs Nagy
@ 2018-07-11 15:18 ` Corinna Vinschen
  2 siblings, 0 replies; 4+ messages in thread
From: Corinna Vinschen @ 2018-07-11 15:18 UTC (permalink / raw)
  To: Szabolcs Nagy; +Cc: newlib, nd

[-- Attachment #1: Type: text/plain, Size: 571 bytes --]

On Jul 11 11:10, Szabolcs Nagy wrote:
> Further issues caught while testing the same code for glibc.
> The generated code should not change on any targets.
> Tested on aarch64.
> 
> Szabolcs Nagy (2):
>   Fix the documentation comments for log_inline in pow
>   Remove float compare option from sincosf
> 
>  newlib/libm/common/pow.c     |  6 +++---
>  newlib/libm/common/sincosf.h | 11 +----------
>  2 files changed, 4 insertions(+), 13 deletions(-)
> 
> -- 
> 2.14.1

Pushed.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-11 15:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-11 10:12 [PATCH 0/2] Minor updates to the new math code Szabolcs Nagy
2018-07-11 10:12 ` [PATCH 1/2] Fix the documentation comments for log_inline in pow Szabolcs Nagy
2018-07-11 12:39 ` [PATCH 2/2] Remove float compare option from sincosf Szabolcs Nagy
2018-07-11 15:18 ` [PATCH 0/2] Minor updates to the new math code Corinna Vinschen

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).