Patchwork Fix flt to 32 bit int conversion in ILP32 aarch64

login
register
mail settings
Submitter Steve Ellcey
Date Nov. 29, 2016, 9:04 p.m.
Message ID <201611292104.uATL4lGK020856@sellcey-lt.caveonetworks.com>
Download mbox | patch
Permalink /patch/18051/
State New
Headers show

Comments

Steve Ellcey - Nov. 29, 2016, 9:04 p.m.
Here is a patch to fix two of the failures in the glibc testsuite for
ILP32 aarch64.  The basic problem was that the code was doing conversions
from float to 64 bits in some cases where it should have been targeting
a 32 bit result.

This fixes the math/test-float and math/test-float-finite failures in
32 bit mode.  It does not fix math/test-double or math/test-double-finite,
but it reduced the individual failures in each test from 133 to 11.  The
remaining failures all involve the Inexact bit being set.

This patch can be checked in separately from the full ILP32 patchset and
does not cause any regressions in LP64 testing.

OK to checkin?


2016-11-29  Steve Ellcey  <sellcey@caviumnetworks.com>

	* sysdeps/aarch64/fpu/s_llrint.c (OREGS): Add define to match OTYPE. 
	* sysdeps/aarch64/fpu/s_llrintf.c (OREGS): Ditto.
	* sysdeps/aarch64/fpu/s_llround.c (OREGS): Ditto.
	* sysdeps/aarch64/fpu/s_llroundf.c (OREGS): Ditto.
	* sysdeps/aarch64/fpu/s_lrint.c (OREGS): Set based on __ILP32__ if
	it is not already set.
	* sysdeps/aarch64/fpu/s_lround.c (OREGS): Ditto.

Patch

diff --git a/sysdeps/aarch64/fpu/s_llrint.c b/sysdeps/aarch64/fpu/s_llrint.c
index 9769311..c8833b4 100644
--- a/sysdeps/aarch64/fpu/s_llrint.c
+++ b/sysdeps/aarch64/fpu/s_llrint.c
@@ -18,4 +18,5 @@ 
 
 #define FUNC llrint
 #define OTYPE long long int
+#define OREGS "x"
 #include <s_lrint.c>
diff --git a/sysdeps/aarch64/fpu/s_llrintf.c b/sysdeps/aarch64/fpu/s_llrintf.c
index 51024a9..8ede339 100644
--- a/sysdeps/aarch64/fpu/s_llrintf.c
+++ b/sysdeps/aarch64/fpu/s_llrintf.c
@@ -20,4 +20,5 @@ 
 #define ITYPE float
 #define IREGS "s"
 #define OTYPE long long int
+#define OREGS "x"
 #include <s_lrint.c>
diff --git a/sysdeps/aarch64/fpu/s_llround.c b/sysdeps/aarch64/fpu/s_llround.c
index dd2b3a2..7a229a5 100644
--- a/sysdeps/aarch64/fpu/s_llround.c
+++ b/sysdeps/aarch64/fpu/s_llround.c
@@ -18,4 +18,5 @@ 
 
 #define FUNC llround
 #define OTYPE long long int
+#define OREGS "x"
 #include <s_lround.c>
diff --git a/sysdeps/aarch64/fpu/s_llroundf.c b/sysdeps/aarch64/fpu/s_llroundf.c
index 8b5d263..9d1beac 100644
--- a/sysdeps/aarch64/fpu/s_llroundf.c
+++ b/sysdeps/aarch64/fpu/s_llroundf.c
@@ -20,4 +20,5 @@ 
 #define ITYPE float
 #define IREGS "s"
 #define OTYPE long long int
+#define OREGS "x"
 #include <s_lround.c>
diff --git a/sysdeps/aarch64/fpu/s_lrint.c b/sysdeps/aarch64/fpu/s_lrint.c
index e51de0f..5693784 100644
--- a/sysdeps/aarch64/fpu/s_lrint.c
+++ b/sysdeps/aarch64/fpu/s_lrint.c
@@ -33,9 +33,17 @@ 
 
 #ifndef OTYPE
 # define OTYPE long int
+# ifndef __ILP32__
+#  define OREGS "x"
+# else
+#  define OREGS "w"
+# endif
+#else
+# ifndef OREGS
+#  error OREGS not defined
+# endif
 #endif
 
-#define OREGS "x"
 
 #define __CONCATX(a,b) __CONCAT(a,b)
 
diff --git a/sysdeps/aarch64/fpu/s_lround.c b/sysdeps/aarch64/fpu/s_lround.c
index a14d347..19b0705 100644
--- a/sysdeps/aarch64/fpu/s_lround.c
+++ b/sysdeps/aarch64/fpu/s_lround.c
@@ -33,10 +33,17 @@ 
 
 #ifndef OTYPE
 # define OTYPE long int
+# ifndef __ILP32__
+#  define OREGS "x"
+# else
+#  define OREGS "w"
+# endif
+#else
+# ifndef OREGS
+#  error OREGS not defined
+# endif
 #endif
 
-#define OREGS "x"
-
 #define __CONCATX(a,b) __CONCAT(a,b)
 
 OTYPE