This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch for x86 cmov insn format


All,

This is a continuation of the previous patch (recently applied)
for dealing with the ATT syntax for cmov.

One thing I am unsure of. insns like 'cmovneq' would only be
valid if a 64-bit operand was used, and (at least in my version
of gas), extended registers like %rdx are only valid if you
use the ".code64" pseudo-op. But I don't see that being
emitted anywhere. Is this just becuase I configured gas and
gcc for a pure 32-bit target? However, for the updated USL
assembler this patch is correct.

Kean
2005-12-02  Kean Johnston  <jkj@sco.com>

	* config/i386/i386.c (put_att_operand_size): New function to put
	the size of an operand for insns like cmov.
	(print_operand): Use it for code 'O'. Added new operand code 'o'
	for insns where the operand code needs to be a suffix not a prefix,
	but only if HAVE_AS_IX86_CMOV_ATT_SYNTAX is defined.
	* config/i386/i386.md: Adjust cmov insn patterns to use new '%o'
	code so the operand size is printed as a suffix.

Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 107759)
+++ config/i386/i386.c	(working copy)
@@ -826,6 +826,7 @@
 static void output_pic_addr_const (FILE *, rtx, int);
 static void put_condition_code (enum rtx_code, enum machine_mode,
 				int, int, FILE *);
+static void put_att_operand_size (enum machine_mode, FILE *);
 static const char *get_some_local_dynamic_name (void);
 static int get_some_local_dynamic_name_1 (rtx *, void *);
 static rtx ix86_expand_int_compare (enum rtx_code, rtx, rtx);
@@ -6878,6 +6879,23 @@
   fputs (suffix, file);
 }
 
+/* Print the operand size suffix for cmov instructions when using
+   ATT (USL) syntax.  */
+
+static void
+put_att_operand_size (enum machine_mode mode, FILE * file)
+{
+  switch (mode)
+    {
+    case HImode: putc ('w', file); break;
+    case SImode:
+    case SFmode: putc ('l', file); break;
+    case DImode:
+    case DFmode: putc ('q', file); break;
+    default: abort ();
+    }
+}
+
 /* Print the name of register X to FILE based on its machine mode and number.
    If CODE is 'w', pretend the mode is HImode.
    If CODE is 'b', pretend the mode is QImode.
@@ -7013,10 +7031,12 @@
 /* Meaning of CODE:
    L,W,B,Q,S,T -- print the opcode suffix for specified size of operand.
    C -- print opcode suffix for set/cmov insn.
-   c -- like C, but print reversed condition
+   c -- like C, but print reversed condition.
    F,f -- likewise, but for floating-point.
    O -- if HAVE_AS_IX86_CMOV_SUN_SYNTAX, expand to "w.", "l." or "q.",
-        otherwise nothing
+        otherwise nothing.
+   o -- if HAS_AS_IX86_CMOV_ATT_SYNTAX, expand to "w", "l" or "q",
+        otherwise nothing. This is used as an insn suffix.
    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)
@@ -7035,7 +7055,7 @@
    P -- if PIC, print an @PLT suffix.
    X -- don't print any sort of PIC '@' suffix for a symbol.
    & -- print some in-use local-dynamic symbol name.
-   H -- print a memory address offset by 8; used for sse high-parts
+   H -- print a memory address offset by 8; used for sse high-parts.
  */
 
 void
@@ -7225,19 +7245,19 @@
 #ifdef HAVE_AS_IX86_CMOV_SUN_SYNTAX
 	  if (ASSEMBLER_DIALECT == ASM_ATT)
 	    {
-	      switch (GET_MODE (x))
-		{
-		case HImode: putc ('w', file); break;
-		case SImode:
-		case SFmode: putc ('l', file); break;
-		case DImode:
-		case DFmode: putc ('q', file); break;
-		default: gcc_unreachable ();
-		}
+	      put_att_operand_size (GET_MODE (x), file);
 	      putc ('.', file);
 	    }
 #endif
 	  return;
+	case 'o':
+#ifdef HAVE_AS_IX86_CMOV_ATT_SYNTAX
+	  if (ASSEMBLER_DIALECT == ASM_ATT)
+	    {
+	      put_att_operand_size (GET_MODE (x), file);
+	    }
+#endif
+	  return;
 	case 'C':
 	  put_condition_code (GET_CODE (x), GET_MODE (XEXP (x, 0)), 0, 0, file);
 	  return;
Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md	(revision 107758)
+++ config/i386/i386.md	(working copy)
@@ -18273,8 +18273,8 @@
   "TARGET_64BIT && TARGET_CMOVE
    && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
   "@
-   cmov%O2%C1\t{%2, %0|%0, %2}
-   cmov%O2%c1\t{%3, %0|%0, %3}"
+   cmov%O2%C1%o2\t{%2, %0|%0, %2}
+   cmov%O2%c1%o2\t{%3, %0|%0, %3}"
   [(set_attr "type" "icmov")
    (set_attr "mode" "DI")])
 
@@ -18316,8 +18316,8 @@
   "TARGET_CMOVE
    && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
   "@
-   cmov%O2%C1\t{%2, %0|%0, %2}
-   cmov%O2%c1\t{%3, %0|%0, %3}"
+   cmov%O2%C1%o2\t{%2, %0|%0, %2}
+   cmov%O2%c1%o2\t{%3, %0|%0, %3}"
   [(set_attr "type" "icmov")
    (set_attr "mode" "SI")])
 
@@ -18338,8 +18338,8 @@
   "TARGET_CMOVE
    && (GET_CODE (operands[2]) != MEM || GET_CODE (operands[3]) != MEM)"
   "@
-   cmov%O2%C1\t{%2, %0|%0, %2}
-   cmov%O2%c1\t{%3, %0|%0, %3}"
+   cmov%O2%C1%o2\t{%2, %0|%0, %2}
+   cmov%O2%c1%o2\t{%3, %0|%0, %3}"
   [(set_attr "type" "icmov")
    (set_attr "mode" "HI")])
 
@@ -18390,8 +18390,8 @@
   "@
    fcmov%F1\t{%2, %0|%0, %2}
    fcmov%f1\t{%3, %0|%0, %3}
-   cmov%O2%C1\t{%2, %0|%0, %2}
-   cmov%O2%c1\t{%3, %0|%0, %3}"
+   cmov%O2%C1%o2\t{%2, %0|%0, %2}
+   cmov%O2%c1%o2\t{%3, %0|%0, %3}"
   [(set_attr "type" "fcmov,fcmov,icmov,icmov")
    (set_attr "mode" "SF,SF,SI,SI")])
 
@@ -18430,8 +18430,8 @@
   "@
    fcmov%F1\t{%2, %0|%0, %2}
    fcmov%f1\t{%3, %0|%0, %3}
-   cmov%O2%C1\t{%2, %0|%0, %2}
-   cmov%O2%c1\t{%3, %0|%0, %3}"
+   cmov%O2%C1%o2\t{%2, %0|%0, %2}
+   cmov%O2%c1%o2\t{%3, %0|%0, %3}"
   [(set_attr "type" "fcmov,fcmov,icmov,icmov")
    (set_attr "mode" "DF")])
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]