Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <FE498902828045B7BE18810130943437@H270>
Date: Sat, 7 Dec 2019 21:15:34 +0100
From: "Stefan Kanthak" <stefan.kanthak@...go.de>
To: <musl@...ts.openwall.com>
Subject: Patches for math subtree

Just some optimisations.

--- -/src/math/i386/remquo.s
+++ +/src/math/i386/remquo.s
@@ -23,23 +23,17 @@
 remquo:
         mov 20(%esp),%ecx
         fldl 12(%esp)
         fldl 4(%esp)
         mov 19(%esp),%dh
         xor 11(%esp),%dh
 1:      fprem1
         fnstsw %ax
         sahf
         jp 1b
         fstp %st(1)
-        mov %ah,%dl
-        shr %dl
-        and $1,%dl
-        mov %ah,%al
-        shr $5,%al
-        and $2,%al
-        or %al,%dl
-        mov %ah,%al
-        shl $2,%al
-        and $4,%al
-        or %al,%dl
+        setc %dl
+        shl $2,%ah
+        adc %dl,%dl
+        shl $5,%ah
+        adc %dl,%dl
         test %dh,%dh

--- -/src/math/ceil.c
+++ +/src/math/ceil.c
@@ -18,10 +18,10 @@
+        /* special case because of non-nearest rounding modes */
+        if (e < 0x3ff) {
+                FORCE_EVAL(y);
+                return u.i >> 63 ? -0.0 : 1.0;
+        }
         /* y = int(x) - x, where int(x) is an integer neighbor of x */
         if (u.i >> 63)
                 y = x - toint + toint - x;
         else
                 y = x + toint - toint - x;
-        /* special case because of non-nearest rounding modes */
-        if (e <= 0x3ff-1) {
-                FORCE_EVAL(y);
-                return u.i >> 63 ? -0.0 : 1;
-        }

--- -/src/math/floor.c
+++ +/src/math/floor.c
@@ -18,10 +18,10 @@
+        /* special case because of non-nearest rounding modes */
+        if (e < 0x3ff) {
+                 FORCE_EVAL(y);
+                 return u.i >> 63 ? -1.0 : 0.0;
+        }
         /* y = int(x) - x, where int(x) is an integer neighbor of x */
         if (u.i >> 63)
                 y = x - toint + toint - x;
         else
                 y = x + toint - toint - x;
-        /* special case because of non-nearest rounding modes */
-        if (e <= 0x3ff-1) {
-                 FORCE_EVAL(y);
-                 return u.i >> 63 ? -1 : 0;
-        }

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.