Patchwork [i386] : Change HAVE_AS_IX86_INTERUNIT_MOVQ to runtime test ...

login
register
mail settings
Submitter Uros Bizjak
Date Nov. 1, 2013, 8:44 a.m.
Message ID <CAFULd4YXucJaHXcZSOTHLVfPH03+EJxAFhkt_oFd6P_33OkG5Q@mail.gmail.com>
Download mbox | patch
Permalink /patch/287740/
State New
Headers show

Comments

Uros Bizjak - Nov. 1, 2013, 8:44 a.m.
Hello!

... so it can be used in insn output templates.

2013-11-01  Uros Bizjak  <ubizjak@gmail.com>

    * configure.ac (HAVE_AS_IX86_INTERUNIT_MOVQ): Always define as 0/1.
    * configure: Regenerate.
    * config/i386/i386.md (*movdi_internal): Change
    HAVE_AS_IX86_INTERUNIT_MOVQ to runtime check.
    (*movdf_internal): Ditto.
    * config/i386/mmx.md (*mov<mode>_internal): Ditto.
    * config/i386/sse.md (vec_concatv2di): Output interunit movq
    for HAVE_AS_IX86_INTERUNIT_MOVQ targets.

Tested on x86_64-pc-linux-gnu {,-m32} and committed to mainline SVN.

Uros.

Patch

Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md	(revision 204286)
+++ config/i386/i386.md	(working copy)
@@ -2007,11 +2007,10 @@ 
       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]))
+      if (!HAVE_AS_IX86_INTERUNIT_MOVQ
+	  && (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:
@@ -2024,11 +2023,10 @@ 
       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]))
+	  if (!HAVE_AS_IX86_INTERUNIT_MOVQ
+	      && (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}";
@@ -2944,12 +2942,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]))
+	  if (!HAVE_AS_IX86_INTERUNIT_MOVQ
+	      && (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}";
+	  return "%vmovq\t{%1, %0|%0, %1}";
 
 	default:
 	  gcc_unreachable ();
Index: config/i386/mmx.md
===================================================================
--- config/i386/mmx.md	(revision 204286)
+++ config/i386/mmx.md	(working copy)
@@ -99,11 +99,10 @@ 
       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]))
+      if (!HAVE_AS_IX86_INTERUNIT_MOVQ
+	  && (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_SSECVT:
@@ -119,15 +118,13 @@ 
       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]))
+	  if (!HAVE_AS_IX86_INTERUNIT_MOVQ
+	      && (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}";
-
 	case MODE_XI:
 	  return "vmovdqa64\t{%g1, %g0|%g0, %g1}";
 
Index: config/i386/sse.md
===================================================================
--- config/i386/sse.md	(revision 204286)
+++ config/i386/sse.md	(working copy)
@@ -9489,7 +9489,7 @@ 
   "@
    pinsrq\t{$1, %2, %0|%0, %2, 1}
    vpinsrq\t{$1, %2, %1, %0|%0, %1, %2, 1}
-   %vmovd\t{%1, %0|%0, %1}
+   * return HAVE_AS_IX86_INTERUNIT_MOVQ ? \"%vmovq\t{%1, %0|%0, %1}\" : \"%vmovd\t{%1, %0|%0, %1}\";
    %vmovq\t{%1, %0|%0, %1}
    movq2dq\t{%1, %0|%0, %1}
    punpcklqdq\t{%2, %0|%0, %2}
Index: configure.ac
===================================================================
--- configure.ac	(revision 204286)
+++ configure.ac	(working copy)
@@ -3754,9 +3754,10 @@ 
       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.])])
+       movq %rax, %xmm0])
+    AC_DEFINE_UNQUOTED(HAVE_AS_IX86_INTERUNIT_MOVQ,
+      [`if test $gcc_cv_as_ix86_interunit_movq = yes; then echo 1; else echo 0; fi`],
+      [Define if your assembler supports interunit movq mnemonic.])
 
     gcc_GAS_CHECK_FEATURE([hle prefixes],
       gcc_cv_as_ix86_hle,,,