3.3.2/3.4 PATCH: Properly check for IA-32 cmov Sun syntax
Rainer Orth
ro@TechFak.Uni-Bielefeld.DE
Thu Sep 4 15:31:00 GMT 2003
This patch fixes PR target/12101: my Solaris 2 configuration rewrite caused
CMOV_SUN_AS_SYNTAX to be always defined, even with gas that doesn't support
this syntax. The problem shows up during a bootstrap for
i686-pc-solaris2.9 with BOOT_CFLAGS='-g -O2 -march=i686' using gas 2.14,
where e.g. gengtype-yacc.c produces invalid (Sun syntax) assembler output:
/var/tmp//cc5Xycwi.s: Assembler messages:
/var/tmp//cc5Xycwi.s:1644: Error: invalid character '.' in mnemonic
cmovl.l %edx, %eax
Instead of restoring the compile time definition, I decided to detect the
different syntaxes at configure time.
The following patch implements this. Bootstrapped as above without
regressions on i686-pc-solaris2.9 with both as and gas 2.14. A bootstrap
on the 3.3 branch (with configure.in slightly adapted) is currently in
progress: the cmov syntax was detected correctly in both cases. Since this
is a regression from 3.2, ok for the 3.3 branch as well if it passes?
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Wed Sep 3 01:32:03 2003 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* configure.in (gcc_cv_as_ix86_cmov_sun_syntax): Check if
assembler supports Sun syntax for cmov.
* configure: Regenerate.
* config.in: Likewise.
* config/i386/i386.c: Rename CMOV_SUN_AS_SYNTAX to
HAVE_AS_IX86_CMOV_SUN_SYNTAX.
* config/i386/sol2.h (CMOV_SUN_AS_SYNTAX): Remove.
Fixes PR target/12101.
Index: gcc/configure.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.in,v
retrieving revision 1.723
diff -u -p -r1.723 configure.in
--- gcc/configure.in 4 Sep 2003 00:12:14 -0000 1.723
+++ gcc/configure.in 4 Sep 2003 15:21:31 -0000
@@ -2263,6 +2263,12 @@ changequote([,])dnl
[AC_DEFINE(HAVE_GAS_FILDS_FISTS, 1,
[Define if your assembler uses the new HImode fild and fist notation.])])
+ gcc_GAS_CHECK_FEATURE([cmov syntax],
+ gcc_cv_as_ix86_cmov_sun_syntax,,,
+ [cmovl.l %edx, %eax],,
+ [AC_DEFINE(HAVE_AS_IX86_CMOV_SUN_SYNTAX, 1,
+ [Define if your assembler supports the Sun syntax for cmov.])])
+
# 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],
Index: gcc/config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.598
diff -u -p -r1.598 i386.c
--- gcc/config/i386/i386.c 4 Sep 2003 03:17:56 -0000 1.598
+++ gcc/config/i386/i386.c 4 Sep 2003 15:21:37 -0000
@@ -7020,8 +7020,8 @@ get_some_local_dynamic_name_1 (rtx *px,
C -- print opcode suffix for set/cmov insn.
c -- like C, but print reversed condition
F,f -- likewise, but for floating-point.
- O -- if CMOV_SUN_AS_SYNTAX, expand to "w.", "l." or "q.", otherwise
- nothing
+ O -- if HAVE_AS_IX86_CMOV_SUN_SYNTAX, expand to "w.", "l." or "q.",
+ otherwise nothing
R -- print the prefix for register names.
z -- print the opcode suffix for the size of the current operand.
* -- print a star (in certain assembler syntax)
@@ -7222,7 +7222,7 @@ print_operand (FILE *file, rtx x, int co
}
return;
case 'O':
-#ifdef CMOV_SUN_AS_SYNTAX
+#ifdef HAVE_AS_IX86_CMOV_SUN_SYNTAX
if (ASSEMBLER_DIALECT == ASM_ATT)
{
switch (GET_MODE (x))
@@ -7242,7 +7242,7 @@ print_operand (FILE *file, rtx x, int co
put_condition_code (GET_CODE (x), GET_MODE (XEXP (x, 0)), 0, 0, file);
return;
case 'F':
-#ifdef CMOV_SUN_AS_SYNTAX
+#ifdef HAVE_AS_IX86_CMOV_SUN_SYNTAX
if (ASSEMBLER_DIALECT == ASM_ATT)
putc ('.', file);
#endif
@@ -7261,7 +7261,7 @@ print_operand (FILE *file, rtx x, int co
put_condition_code (GET_CODE (x), GET_MODE (XEXP (x, 0)), 1, 0, file);
return;
case 'f':
-#ifdef CMOV_SUN_AS_SYNTAX
+#ifdef HAVE_AS_IX86_CMOV_SUN_SYNTAX
if (ASSEMBLER_DIALECT == ASM_ATT)
putc ('.', file);
#endif
Index: gcc/config/i386/sol2.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/sol2.h,v
retrieving revision 1.26
diff -u -p -r1.26 sol2.h
--- gcc/config/i386/sol2.h 20 Jun 2002 11:03:34 -0000 1.26
+++ gcc/config/i386/sol2.h 4 Sep 2003 15:21:37 -0000
@@ -1,5 +1,5 @@
/* Target definitions for GNU compiler for Intel 80386 running Solaris 2
- Copyright (C) 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright (C) 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Contributed by Fred Fish (fnf@cygnus.com).
@@ -19,8 +19,6 @@ You should have received a copy of the G
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-
-#define CMOV_SUN_AS_SYNTAX 1
/* The Solaris 2.0 x86 linker botches alignment of code sections.
It tries to align to a 16 byte boundary by padding with 0x00000090
3.3 patch (gcc/configure.in only, the rest is identical):
Index: gcc/configure.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.in,v
retrieving revision 1.627.2.14
diff -u -p -r1.627.2.14 configure.in
--- gcc/configure.in 10 Aug 2003 23:11:26 -0000 1.627.2.14
+++ gcc/configure.in 4 Sep 2003 15:27:19 -0000
@@ -2150,6 +2143,21 @@ changequote([,])dnl
fi
AC_MSG_RESULT($gcc_cv_as_instructions)
+ AC_MSG_CHECKING(cmov syntax)
+ gcc_cv_as_ix86_cmov_sun_syntax=no
+ if test x$gcc_cv_as != x; then
+ echo 'cmovl.l %edx, %eax' > conftest.s
+ if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
+ gcc_cv_as_ix86_cmov_sun_syntax=yes
+ fi
+ rm -f conftest.s conftest.o
+ fi
+ if test "x$gcc_cv_as_ix86_cmov_sun_syntax" = xyes; then
+ AC_DEFINE(HAVE_AS_IX86_CMOV_SUN_SYNTAX, 1,
+ [Define if your assembler supports the Sun syntax for cmov.])
+ fi
+ AC_MSG_RESULT($gcc_cv_as_ix86_cmov_sun_syntax)
+
AC_MSG_CHECKING(assembler GOTOFF in data directives)
gcc_cv_as_gotoff_in_data=no
if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x
More information about the Gcc-patches
mailing list