Patchwork fixincludes for libquadmath build regression

login
register
mail settings
Submitter Alexandre Oliva
Date Jan. 6, 2013, 8:12 p.m.
Message ID <orr4lyyste.fsf@livre.localdomain>
Download mbox | patch
Permalink /patch/209798/
State New
Headers show

Comments

Alexandre Oliva - Jan. 6, 2013, 8:12 p.m.
On Dec 30, 2012, Bruce Korb <bkorb@gnu.org> wrote:

> On 12/30/12 01:42, Paolo Bonzini wrote:
>> Not my territory anymore, but it looks much better!  CCing Bruce.

> Long time.  It's no wonder you've forgotten this little world! :)

Indeed!

> Anyway, please make the expressions more readable and strip
> out the generated text from the review message.

Done.  Ok?
Bruce Korb - Jan. 6, 2013, 8:44 p.m.
On 01/06/13 12:12, Alexandre Oliva wrote:
> On Dec 30, 2012, Bruce Korb <bkorb@gnu.org> wrote:
> 
>> On 12/30/12 01:42, Paolo Bonzini wrote:
>>> Not my territory anymore, but it looks much better!  CCing Bruce.
> 
>> Long time.  It's no wonder you've forgotten this little world! :)
> 
> Indeed!
> 
>> Anyway, please make the expressions more readable and strip
>> out the generated text from the review message.
> 
> Done.  Ok?

Looks good to me.  Thanks!

Patch

Fix mandatory SSE in 2.1[56]ish glibc's feraiseexcept

From: Alexandre Oliva <aoliva@redhat.com>

for fixincludes/ChangeLog

	* inclhack.def (feraiseexcept_nosse_invalid): New.
	(feraiseexcept_nosse_divbyzero): Likewise.
	* fixincl.x: Rebuilt.
	* tests/base/bits/fenv.h: New.
---

 fixincludes/fixincl.x              |  130 ++++++++++++++++++++++++++++++++++--
 fixincludes/inclhack.def           |   49 ++++++++++++++
 fixincludes/tests/base/bits/fenv.h |   29 ++++++++
 3 files changed, 200 insertions(+), 8 deletions(-)
 create mode 100644 fixincludes/tests/base/bits/fenv.h


diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 09eac7c6..2406920 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -4815,4 +4815,53 @@  fix = {
     test_text = "extern char *\tsprintf();";
 };
 
+/*
+ *  Incorrect feraiseexcept extern inline in bits/fenv.h on x86_64
+ *  that fails when compiling for SSE-less 32-bit x86.
+ */
+fix = {
+    hackname  = feraiseexcept_nosse_invalid;
+    mach      = 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
+    files     = bits/fenv.h;
+    select    = "^([\t ]*)__asm__ __volatile__ \\(\"divss %0, %0 *\" : "
+		": \"x\" \\(__f\\)\\);$";
+    bypass    = "\"fdiv .*; fwait\"";
+    
+    c_fix     = format;
+    c_fix_arg = <<- _EOText_
+	# ifdef __SSE_MATH__
+	%0
+	# else
+	%1__asm__ __volatile__ ("fdiv %%%%st, %%%%st(0); fwait"
+	%1			: "=t" (__f) : "0" (__f));
+	# endif
+	_EOText_;
+
+    test_text = <<- _EOText_
+	  __asm__ __volatile__ ("divss %0, %0" : : "x" (__f));
+	_EOText_;
+};
+fix = {
+    hackname  = feraiseexcept_nosse_divbyzero;
+    mach      = 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
+    files     = bits/fenv.h;
+    select    = "^([\t ]*)__asm__ __volatile__ \\(\"divss %1, %0 *\" : "
+		": \"x\" \\(__f\\), \"x\" \\(__g\\)\\);$";
+    bypass    = "\"fdivp .*; fwait\"";
+    
+    c_fix     = format;
+    c_fix_arg = <<- _EOText_
+	# ifdef __SSE_MATH__
+	%0
+	# else
+	%1__asm__ __volatile__ ("fdivp %%%%st, %%%%st(1); fwait"
+	%1			: "=t" (__f) : "0" (__f), "u" (__g) : "st(1)");
+	# endif
+	_EOText_;
+
+    test_text = <<- _EOText_
+	  __asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g));
+	_EOText_;
+};
+
 /*EOF*/
diff --git a/fixincludes/tests/base/bits/fenv.h b/fixincludes/tests/base/bits/fenv.h
new file mode 100644
index 0000000..a82ec25
--- /dev/null
+++ b/fixincludes/tests/base/bits/fenv.h
@@ -0,0 +1,29 @@ 
+/*  DO NOT EDIT THIS FILE.
+
+    It has been auto-edited by fixincludes from:
+
+	"fixinc/tests/inc/bits/fenv.h"
+
+    This had to be done to correct non-standard usages in the
+    original, manufacturer supplied header file.  */
+
+
+
+#if defined( FERAISEEXCEPT_NOSSE_INVALID_CHECK )
+# ifdef __SSE_MATH__
+  __asm__ __volatile__ ("divss %0, %0" : : "x" (__f));
+# else
+  __asm__ __volatile__ ("fdiv %%st, %%st(0); fwait"
+  			: "=t" (__f) : "0" (__f));
+# endif
+#endif  /* FERAISEEXCEPT_NOSSE_INVALID_CHECK */
+
+
+#if defined( FERAISEEXCEPT_NOSSE_DIVBYZERO_CHECK )
+# ifdef __SSE_MATH__
+  __asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g));
+# else
+  __asm__ __volatile__ ("fdivp %%st, %%st(1); fwait"
+  			: "=t" (__f) : "0" (__f), "u" (__g) : "st(1)");
+# endif
+#endif  /* FERAISEEXCEPT_NOSSE_DIVBYZERO_CHECK */