Patchwork [i386] : Fix PR56656, Suffix or operands invalid for 'movq'

login
register
mail settings
Submitter Uros Bizjak
Date March 21, 2013, 9:35 a.m.
Message ID <CAFULd4YNEc9-kA3oJg9mMTLGJbNSAa0Rk-1o+NMGPaS_ViyFGg@mail.gmail.com>
Download mbox | patch
Permalink /patch/229608/
State New
Headers show

Comments

Uros Bizjak - March 21, 2013, 9:35 a.m.
Hello!

Attached patch detects assemblers that expects movd instead of movq
for interunit moves and adds fixup code only in case of broken
assembler.

2013-03-21  Uros Bizjak  <ubizjak@gmail.com>

	PR bootstrap/56656
	* configure.ac (HAVE_AS_IX86_INTERUNIT_MOVQ): New test.
	* configure: Regenerate.
	* config.in: Regenerate.
	* config/i386/i386.md (*movdf_internal): Use
	HAVE_AS_IX86_INTERUNIT_MOVQ to handle broken assemblers that require
	movd instead of movq mnemonic for interunit moves.
	(*movdi_internal): Ditto.

Tested on x86_64-pc-linux-gnu, committed to mainline SVN.

Uros.

Patch

Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md	(revision 196841)
+++ config/i386/i386.md	(working copy)
@@ -1878,9 +1878,11 @@ 
       return "pxor\t%0, %0";
 
     case TYPE_MMXMOV:
+#ifndef HAVE_AS_IX86_INTERUNIT_MOVQ
       /* Handle broken assemblers that require movd instead of movq.  */
       if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1]))
 	return "movd\t{%1, %0|%0, %1}";
+#endif
       return "movq\t{%1, %0|%0, %1}";
 
     case TYPE_SSELOG1:
@@ -1890,9 +1892,11 @@ 
       switch (get_attr_mode (insn))
 	{
 	case MODE_DI:
+#ifndef HAVE_AS_IX86_INTERUNIT_MOVQ
 	  /* Handle broken assemblers that require movd instead of movq.  */
 	  if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1]))
 	    return "%vmovd\t{%1, %0|%0, %1}";
+#endif
 	  return "%vmovq\t{%1, %0|%0, %1}";
 	case MODE_TI:
 	  return "%vmovdqa\t{%1, %0|%0, %1}";
@@ -2797,9 +2801,11 @@ 
 	  return "movlpd\t{%1, %0|%0, %1}";
 
 	case MODE_DI:
+#ifndef HAVE_AS_IX86_INTERUNIT_MOVQ
 	  /* Handle broken assemblers that require movd instead of movq.  */
 	  if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1]))
 	    return "%vmovd\t{%1, %0|%0, %1}";
+#endif
  	  return "%vmovq\t{%1, %0|%0, %1}";
 
 	default:
Index: configure.ac
===================================================================
--- configure.ac	(revision 196841)
+++ configure.ac	(working copy)
@@ -3723,6 +3723,14 @@ 
       [AC_DEFINE(HAVE_AS_IX86_SAHF, 1,
         [Define if your assembler supports the sahf mnemonic in 64bit mode.])])
 
+    gcc_GAS_CHECK_FEATURE([interunit movq mnemonic],
+      gcc_cv_as_ix86_interunit_movq,,,
+      [.code64
+       movq %mm0, %rax
+       movq %rax, %xmm0],,
+      [AC_DEFINE(HAVE_AS_IX86_INTERUNIT_MOVQ, 1,
+        [Define if your assembler supports interunit movq mnemonic.])])
+
     gcc_GAS_CHECK_FEATURE([hle prefixes],
       gcc_cv_as_ix86_hle,,,
       [lock xacquire cmpxchg %esi, (%ecx)],,