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] i386: Implement REVERSE_CONDITION using a function.


Hi,

Attached is a patch to Implement REVERSE_CONDITION using a function.

Ths patch makes it easier to hookize the macro later.

Bootstrapped on i686-pc-linux-gnu.  OK to apply?

Kazu Hirata

2004-03-15  Kazu Hirata  <kazu@cs.umass.edu>

	* config/i386/i386-protos.h: Add a prototype for
	ix86_reverse_condition.
	* config/i386/i386.c (ix86_reverse_condition): New.
	* config/i386/i386.h (REVERSE_CONDITION): Use
	ix86_reverse_condition.
	* config/i386/i386.md: Use ix86_reverse_condition instead of
	REVERSE_CONDITION.

Index: config/i386/i386-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386-protos.h,v
retrieving revision 1.107
diff -u -r1.107 i386-protos.h
--- config/i386/i386-protos.h	31 Jan 2004 18:42:54 -0000	1.107
+++ config/i386/i386-protos.h	15 Mar 2004 20:03:45 -0000
@@ -182,6 +182,7 @@
 extern void x86_function_profiler (FILE *, int);
 extern void x86_emit_floatuns (rtx [2]);
 
+extern enum rtx_code ix86_reverse_condition (enum rtx_code, enum machine_mode);
 
 #ifdef TREE_CODE
 extern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree);
Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.658
diff -u -r1.658 i386.c
--- config/i386/i386.c	12 Mar 2004 17:21:32 -0000	1.658
+++ config/i386/i386.c	15 Mar 2004 20:03:51 -0000
@@ -15811,4 +15811,14 @@
   return clobbers;
 }
 
+/* Worker function for REVERSE_CONDITION.  */
+
+enum rtx_code
+ix86_reverse_condition (enum rtx_code code, enum machine_mode mode)
+{
+  return (mode != CCFPmode && mode != CCFPUmode
+	  ? reverse_condition (code)
+	  : reverse_condition_maybe_unordered (code));
+}
+
 #include "gt-i386.h"
Index: config/i386/i386.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.h,v
retrieving revision 1.381
diff -u -r1.381 i386.h
--- config/i386/i386.h	4 Mar 2004 16:41:26 -0000	1.381
+++ config/i386/i386.h	15 Mar 2004 20:03:53 -0000
@@ -2660,9 +2660,7 @@
 
 /* A C expression whose value is reversed condition code of the CODE for
    comparison done in CC_MODE mode.  */
-#define REVERSE_CONDITION(CODE, MODE) \
-  ((MODE) != CCFPmode && (MODE) != CCFPUmode ? reverse_condition (CODE) \
-   : reverse_condition_maybe_unordered (CODE))
+#define REVERSE_CONDITION(CODE, MODE) ix86_reverse_condition ((CODE), (MODE))
 
 
 /* Control the assembler format that we output, to the extent
Index: config/i386/i386.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
retrieving revision 1.519
diff -u -r1.519 i386.md
--- config/i386/i386.md	10 Mar 2004 22:36:13 -0000	1.519
+++ config/i386/i386.md	15 Mar 2004 20:03:58 -0000
@@ -12813,8 +12813,8 @@
   rtx new_op1 = copy_rtx (operands[1]);
   operands[1] = new_op1;
   PUT_MODE (new_op1, QImode);
-  PUT_CODE (new_op1, REVERSE_CONDITION (GET_CODE (new_op1),
-					GET_MODE (XEXP (new_op1, 0))));
+  PUT_CODE (new_op1, ix86_reverse_condition (GET_CODE (new_op1),
+					     GET_MODE (XEXP (new_op1, 0))));
 
   /* Make sure that (a) the CCmode we have for the flags is strong
      enough for the reversed compare or (b) we have a valid FP compare.  */
@@ -12833,8 +12833,8 @@
   rtx new_op1 = copy_rtx (operands[1]);
   operands[1] = new_op1;
   PUT_MODE (new_op1, QImode);
-  PUT_CODE (new_op1, REVERSE_CONDITION (GET_CODE (new_op1),
-					GET_MODE (XEXP (new_op1, 0))));
+  PUT_CODE (new_op1, ix86_reverse_condition (GET_CODE (new_op1),
+					     GET_MODE (XEXP (new_op1, 0))));
 
   /* Make sure that (a) the CCmode we have for the flags is strong
      enough for the reversed compare or (b) we have a valid FP compare.  */
@@ -13096,8 +13096,8 @@
   rtx new_op0 = copy_rtx (operands[0]);
   operands[0] = new_op0;
   PUT_MODE (new_op0, VOIDmode);
-  PUT_CODE (new_op0, REVERSE_CONDITION (GET_CODE (new_op0),
-					GET_MODE (XEXP (new_op0, 0))));
+  PUT_CODE (new_op0, ix86_reverse_condition (GET_CODE (new_op0),
+					     GET_MODE (XEXP (new_op0, 0))));
 
   /* Make sure that (a) the CCmode we have for the flags is strong
      enough for the reversed compare or (b) we have a valid FP compare.  */


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