]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/27968 (gcc emits (undefined) ffreep opcode which is not understood by...
authorRoger Sayle <sayle@gcc.gnu.org>
Fri, 7 Jul 2006 00:13:14 +0000 (00:13 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Fri, 7 Jul 2006 00:13:14 +0000 (00:13 +0000)
PR target/27968
* configure.ac (HAVE_AS_IX86_FFREEP): On x86 targets check whether
the configured assembler supports the x87's ffreep mnemonic.
* configure: Regenerate.
* config.in: Regenerate.

* config/i386/i386.c (output_387_ffreep): New function.
(output_fp_compare): Use output_387_ffreep to emit ffreep insns.
(output_387_reg_move): Likewise.

From-SVN: r115237

gcc/ChangeLog
gcc/config.in
gcc/config/i386/i386.c
gcc/configure
gcc/configure.ac

index 94f768f6a204b4f25ece98077f8fa68b7e1497f5..58763d81195c682adb6559934ec2e45fec184d4d 100644 (file)
@@ -1,3 +1,15 @@
+2006-07-06  Roger Sayle  <roger@eyesopen.com>
+
+       PR target/27968
+       * configure.ac (HAVE_AS_IX86_FFREEP): On x86 targets check whether 
+       the configured assembler supports the x87's ffreep mnemonic.
+       * configure: Regenerate.
+       * config.in: Regenerate.
+
+       * config/i386/i386.c (output_387_ffreep): New function.
+       (output_fp_compare): Use output_387_ffreep to emit ffreep insns.
+       (output_387_reg_move): Likewise.
+
 2006-07-06  Paul Eggert  <eggert@cs.ucla.edu>
 
        Port to hosts whose 'sort' and 'tail' implementations
@@ -10,7 +22,8 @@
 
 2006-07-06  Zdenek Dvorak <dvorakz@suse.cz>
 
-       * tree-ssa-loop-niter.c (scev_probably_wraps_p): Fix typo in argument name.
+       * tree-ssa-loop-niter.c (scev_probably_wraps_p): Fix typo in
+       argument name.
 
 2006-07-06  David Edelsohn  <edelsohn@gnu.org>
 
index d5f854ef95999cf022290dd7eb0d9cd983e612ee..47ba85080c2b5ae5b21b71cd15a96c30781ec751 100644 (file)
 #endif
 
 
+/* Define if your assembler supports the ffreep mnemonic. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_IX86_FFREEP
+#endif
+
+
 /* Define if your assembler supports the lituse_jsrdirect relocation. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_AS_JSRDIRECT_RELOCS
index 958bd613aa8081df096f88ab21439b32a3fa06b0..fe0d516c05ee0bfd87703d0573b96dd5c6fa5ca0 100644 (file)
@@ -8641,6 +8641,34 @@ output_fix_trunc (rtx insn, rtx *operands, int fisttp)
   return "";
 }
 
+/* Output code for x87 ffreep insn.  The OPNO argument, which may only
+   have the values zero or one, indicates the ffreep insn's operand
+   from the OPERANDS array.  */
+
+static const char *
+output_387_ffreep (rtx *operands ATTRIBUTE_UNUSED, int opno)
+{
+  if (TARGET_USE_FFREEP)
+#if HAVE_AS_IX86_FFREEP
+    return opno ? "ffreep\t%y1" : "ffreep\t%y0";
+#else
+    switch (REGNO (operands[opno]))
+      {
+      case FIRST_STACK_REG + 0: return ".word\t0xc0df";
+      case FIRST_STACK_REG + 1: return ".word\t0xc1df";
+      case FIRST_STACK_REG + 2: return ".word\t0xc2df";
+      case FIRST_STACK_REG + 3: return ".word\t0xc3df";
+      case FIRST_STACK_REG + 4: return ".word\t0xc4df";
+      case FIRST_STACK_REG + 5: return ".word\t0xc5df";
+      case FIRST_STACK_REG + 6: return ".word\t0xc6df";
+      case FIRST_STACK_REG + 7: return ".word\t0xc7df";
+      }
+#endif
+
+  return opno ? "fstp\t%y1" : "fstp\t%y0";
+}
+
+
 /* Output code for INSN to compare OPERANDS.  EFLAGS_P is 1 when fcomi
    should be used.  UNORDERED_P is true when fucom should be used.  */
 
@@ -8685,7 +8713,7 @@ output_fp_compare (rtx insn, rtx *operands, int eflags_p, int unordered_p)
       if (stack_top_dies)
        {
          output_asm_insn ("ftst\n\tfnstsw\t%0", operands);
-         return TARGET_USE_FFREEP ? "ffreep\t%y1" : "fstp\t%y1";
+         return output_387_ffreep (operands, 1);
        }
       else
        return "ftst\n\tfnstsw\t%0";
@@ -8708,7 +8736,7 @@ output_fp_compare (rtx insn, rtx *operands, int eflags_p, int unordered_p)
            output_asm_insn ("fucomip\t{%y1, %0|%0, %y1}", operands);
          else
            output_asm_insn ("fcomip\t{%y1, %0|%0, %y1}", operands);
-         return TARGET_USE_FFREEP ? "ffreep\t%y0" : "fstp\t%y0";
+         return output_387_ffreep (operands, 0);
        }
       else
        {
@@ -18807,9 +18835,8 @@ output_387_reg_move (rtx insn, rtx *operands)
   if (REG_P (operands[1])
       && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
     {
-      if (REGNO (operands[0]) == FIRST_STACK_REG
-         && TARGET_USE_FFREEP)
-       return "ffreep\t%y0";
+      if (REGNO (operands[0]) == FIRST_STACK_REG)
+       return output_387_ffreep (operands, 0);
       return "fstp\t%y0";
     }
   if (STACK_TOP_P (operands[0]))
index 4ec18630eb79f04f26847459eda0d1e50e76345c..507b4c3ecbe16af6eba0df0805a8cdd520c2c991 100755 (executable)
@@ -15046,6 +15046,39 @@ cat >>confdefs.h <<\_ACEOF
 #define HAVE_AS_IX86_CMOV_SUN_SYNTAX 1
 _ACEOF
 
+fi
+
+    echo "$as_me:$LINENO: checking assembler for ffreep mnemonic" >&5
+echo $ECHO_N "checking assembler for ffreep mnemonic... $ECHO_C" >&6
+if test "${gcc_cv_as_ix86_ffreep+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  gcc_cv_as_ix86_ffreep=no
+  if test x$gcc_cv_as != x; then
+    echo 'ffreep %st(1)' > conftest.s
+    if { ac_try='$gcc_cv_as  -o conftest.o conftest.s >&5'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }
+    then
+       gcc_cv_as_ix86_ffreep=yes
+    else
+      echo "configure: failed program was" >&5
+      cat conftest.s >&5
+    fi
+    rm -f conftest.o conftest.s
+  fi
+fi
+echo "$as_me:$LINENO: result: $gcc_cv_as_ix86_ffreep" >&5
+echo "${ECHO_T}$gcc_cv_as_ix86_ffreep" >&6
+if test $gcc_cv_as_ix86_ffreep = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_AS_IX86_FFREEP 1
+_ACEOF
+
 fi
 
     # This one is used unconditionally by i386.[ch]; it is to be defined
index 7b3a5d10e1876184e28f2f4e9cf2e6b8f1a74598..5841da9bc87893711e365d0210fc521d8bff70c3 100644 (file)
@@ -1,7 +1,7 @@
 # configure.ac for GCC
 # Process this file with autoconf to generate a configuration script.
 
-# Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
 # Free Software Foundation, Inc.
 
 #This file is part of GCC.
@@ -2815,6 +2815,12 @@ foo:     nop
       [AC_DEFINE(HAVE_AS_IX86_CMOV_SUN_SYNTAX, 1,
         [Define if your assembler supports the Sun syntax for cmov.])])
 
+    gcc_GAS_CHECK_FEATURE([ffreep mnemonic],
+      gcc_cv_as_ix86_ffreep,,,
+      [ffreep %st(1)],,
+      [AC_DEFINE(HAVE_AS_IX86_FFREEP, 1,
+        [Define if your assembler supports the ffreep mnemonic.])])
+
     # This one is used unconditionally by i386.[ch]; it is to be defined
     # to 1 if the feature is present, 0 otherwise.
     gcc_GAS_CHECK_FEATURE([GOTOFF in data],