inclhack.def (feraiseexcept_nosse_invalid): New.
authorAlexandre Oliva <aoliva@redhat.com>
Wed, 16 Jan 2013 04:07:20 +0000 (04:07 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Wed, 16 Jan 2013 04:07:20 +0000 (04:07 +0000)
* inclhack.def (feraiseexcept_nosse_invalid): New.
(feraiseexcept_nosse_divbyzero): Likewise.
* fixincl.x: Rebuilt.
* tests/base/bits/fenv.h: New.

From-SVN: r195226

fixincludes/ChangeLog
fixincludes/fixincl.x
fixincludes/inclhack.def
fixincludes/tests/base/bits/fenv.h [new file with mode: 0644]

index d518b4d315bd914c02b5c0262988d29991c240ee..88aa56368a9d3ca9bb408f20a75423162129d9ab 100644 (file)
@@ -1,3 +1,10 @@
+2013-01-16  Alexandre Oliva <aoliva@redhat.com>
+
+       * inclhack.def (feraiseexcept_nosse_invalid): New.
+       (feraiseexcept_nosse_divbyzero): Likewise.
+       * fixincl.x: Rebuilt.
+       * tests/base/bits/fenv.h: New.
+
 2013-01-14  Richard Biener  <rguenther@suse.de>
 
        * fixlib.h (verbose_level, fixinc_mode): Mark extern.
index 4115772acab5ceb7b312d92108c3cd2c66af9b3b..29fc52abf45785d3772baf505f2b4ed862c40ec7 100644 (file)
@@ -2,11 +2,11 @@
  * 
  * DO NOT EDIT THIS FILE   (fixincl.x)
  * 
- * It has been AutoGen-ed  October 28, 2012 at 02:53:25 PM by AutoGen 5.17.0pre5
+ * It has been AutoGen-ed  Saturday December 29, 2012 at 09:17:09 AM BRST
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT SVN-MERGE THIS FILE, EITHER Sun Oct 28 14:53:25 PDT 2012
+/* DO NOT SVN-MERGE THIS FILE, EITHER Sat Dec 29 09:17:10 BRST 2012
  *
  * You must regenerate it.  Use the ./genfixes script.
  *
@@ -15,7 +15,7 @@
  * certain ANSI-incompatible system header files which are fixed to work
  * correctly with ANSI C and placed in a directory that GNU C will search.
  *
- * This file contains 224 fixup descriptions.
+ * This file contains 226 fixup descriptions.
  *
  * See README for more information.
  *
@@ -9158,14 +9158,116 @@ static const char* apzX11_SprintfPatch[] = {
 #endif /* !defined __STDC__ */",
     (char*)NULL };
 
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ *  Description of Feraiseexcept_Nosse_Invalid fix
+ */
+tSCC zFeraiseexcept_Nosse_InvalidName[] =
+     "feraiseexcept_nosse_invalid";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zFeraiseexcept_Nosse_InvalidList[] =
+  "bits/fenv.h\0";
+/*
+ *  Machine/OS name selection pattern
+ */
+tSCC* apzFeraiseexcept_Nosse_InvalidMachs[] = {
+        "i[34567]86-*-linux*",
+        "x86*-linux*",
+        "amd64-*-linux*",
+        (const char*)NULL };
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zFeraiseexcept_Nosse_InvalidSelect0[] =
+       "^([\t ]*)__asm__ __volatile__ \\(\"divss %0, %0 *\" : : \"x\" \\(__f\\)\\);$";
+
+/*
+ *  content bypass pattern - skip fix if pattern found
+ */
+tSCC zFeraiseexcept_Nosse_InvalidBypass0[] =
+       "\"fdiv .*; fwait\"";
+
+#define    FERAISEEXCEPT_NOSSE_INVALID_TEST_CT  2
+static tTestDesc aFeraiseexcept_Nosse_InvalidTests[] = {
+  { TT_NEGREP,   zFeraiseexcept_Nosse_InvalidBypass0, (regex_t*)NULL },
+  { TT_EGREP,    zFeraiseexcept_Nosse_InvalidSelect0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Feraiseexcept_Nosse_Invalid
+ */
+static const char* apzFeraiseexcept_Nosse_InvalidPatch[] = {
+    "format",
+    "# ifdef __SSE_MATH__\n\
+%0\n\
+# else\n\
+%1__asm__ __volatile__ (\"fdiv %%%%st, %%%%st(0); fwait\"\n\
+%1\t\t\t: \"=t\" (__f) : \"0\" (__f));\n\
+# endif",
+    (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ *  Description of Feraiseexcept_Nosse_Divbyzero fix
+ */
+tSCC zFeraiseexcept_Nosse_DivbyzeroName[] =
+     "feraiseexcept_nosse_divbyzero";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zFeraiseexcept_Nosse_DivbyzeroList[] =
+  "bits/fenv.h\0";
+/*
+ *  Machine/OS name selection pattern
+ */
+tSCC* apzFeraiseexcept_Nosse_DivbyzeroMachs[] = {
+        "i[34567]86-*-linux*",
+        "x86*-linux*",
+        "amd64-*-linux*",
+        (const char*)NULL };
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zFeraiseexcept_Nosse_DivbyzeroSelect0[] =
+       "^([\t ]*)__asm__ __volatile__ \\(\"divss %1, %0 *\" : : \"x\" \\(__f\\), \"x\" \\(__g\\)\\);$";
+
+/*
+ *  content bypass pattern - skip fix if pattern found
+ */
+tSCC zFeraiseexcept_Nosse_DivbyzeroBypass0[] =
+       "\"fdivp .*; fwait\"";
+
+#define    FERAISEEXCEPT_NOSSE_DIVBYZERO_TEST_CT  2
+static tTestDesc aFeraiseexcept_Nosse_DivbyzeroTests[] = {
+  { TT_NEGREP,   zFeraiseexcept_Nosse_DivbyzeroBypass0, (regex_t*)NULL },
+  { TT_EGREP,    zFeraiseexcept_Nosse_DivbyzeroSelect0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Feraiseexcept_Nosse_Divbyzero
+ */
+static const char* apzFeraiseexcept_Nosse_DivbyzeroPatch[] = {
+    "format",
+    "# ifdef __SSE_MATH__\n\
+%0\n\
+# else\n\
+%1__asm__ __volatile__ (\"fdivp %%%%st, %%%%st(1); fwait\"\n\
+%1\t\t\t: \"=t\" (__f) : \"0\" (__f), \"u\" (__g) : \"st(1)\");\n\
+# endif",
+    (char*)NULL };
+
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
  *  List of all fixes
  */
-#define REGEX_COUNT          260
-#define MACH_LIST_SIZE_LIMIT 181
-#define FIX_COUNT            224
+#define REGEX_COUNT          264
+#define MACH_LIST_SIZE_LIMIT 187
+#define FIX_COUNT            226
 
 /*
  *  Enumerate the fixes
@@ -9394,7 +9496,9 @@ typedef enum {
     X11_CLASS_FIXIDX,
     X11_CLASS_USAGE_FIXIDX,
     X11_NEW_FIXIDX,
-    X11_SPRINTF_FIXIDX
+    X11_SPRINTF_FIXIDX,
+    FERAISEEXCEPT_NOSSE_INVALID_FIXIDX,
+    FERAISEEXCEPT_NOSSE_DIVBYZERO_FIXIDX
 } t_fixinc_idx;
 
 tFixDesc fixDescList[ FIX_COUNT ] = {
@@ -10516,5 +10620,15 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
   {  zX11_SprintfName,    zX11_SprintfList,
      apzX11_SprintfMachs,
      X11_SPRINTF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
-     aX11_SprintfTests,   apzX11_SprintfPatch, 0 }
+     aX11_SprintfTests,   apzX11_SprintfPatch, 0 },
+
+  {  zFeraiseexcept_Nosse_InvalidName,    zFeraiseexcept_Nosse_InvalidList,
+     apzFeraiseexcept_Nosse_InvalidMachs,
+     FERAISEEXCEPT_NOSSE_INVALID_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aFeraiseexcept_Nosse_InvalidTests,   apzFeraiseexcept_Nosse_InvalidPatch, 0 },
+
+  {  zFeraiseexcept_Nosse_DivbyzeroName,    zFeraiseexcept_Nosse_DivbyzeroList,
+     apzFeraiseexcept_Nosse_DivbyzeroMachs,
+     FERAISEEXCEPT_NOSSE_DIVBYZERO_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aFeraiseexcept_Nosse_DivbyzeroTests,   apzFeraiseexcept_Nosse_DivbyzeroPatch, 0 }
 };
index 09eac7c6254bb9856ab9d130a3df5b88fd71b702..24069201d12204157a531f8388131ef7ca82dd13 100644 (file)
@@ -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 (file)
index 0000000..a82ec25
--- /dev/null
@@ -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 */