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]

[mips patch' RFA] handle trap_if with DI-mode arguments.


OK, improved version.

Since i can't test non-zero traps, I took rsandifo's advice and FAILed
them, rather than writing new (untestable) insns to handle them.

tested w/ gcc testsuite (no g++, f77) from host x86-linux, target
mipsisa64-elf, with -mips32 and -mips64 multilibs w/ target
mips-sim-idt64.  only changes were gcc.c-torture/compile/20030605-1.c
FAIL -> PASS.


chris
--
2003-08-17  Chris Demetriou  <cgd@broadcom.com>

	* config/mips/mips.c (mips_gen_conditional_trap): Fix error
	in comment.
	* config/mips/mips.md: Modernize "trap_if" comments.
	Improve SI-mode "trap_if" instruction to use better
	predicates and constraints.  Define new instruction to
	handle "trap_if" with DI-mode arguments.
	(conditional_trap): FAIL if trap code is not 0.

Index: config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.299
diff -u -p -r1.299 mips.c
--- config/mips/mips.c	11 Aug 2003 15:28:19 -0000	1.299
+++ config/mips/mips.c	18 Aug 2003 05:11:12 -0000
@@ -3334,8 +3334,8 @@ gen_conditional_move (operands)
 						operands[2], operands[3])));
 }
 
-/* Emit the common code for conditional moves.  OPERANDS is the array
-   of operands passed to the conditional move defined_expand.  */
+/* Emit the common code for conditional traps.  OPERANDS is the array
+   of operands passed to the conditional trap defined_expand.  */
 
 void
 mips_gen_conditional_trap (operands)
Index: config/mips/mips.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.md,v
retrieving revision 1.187
diff -u -p -r1.187 mips.md
--- config/mips/mips.md	11 Aug 2003 15:28:20 -0000	1.187
+++ config/mips/mips.md	18 Aug 2003 05:11:12 -0000
@@ -657,20 +657,31 @@
   "ISA_HAS_COND_TRAP"
   "
 {
-  mips_gen_conditional_trap (operands);
-  DONE;
+  if (INTVAL (operands[1]) == 0)
+    {
+      mips_gen_conditional_trap (operands);
+      DONE;
+    }
+  else
+    FAIL;
 }")
 
-;; Match a TRAP_IF with 2nd arg of 0.  The div_trap_* insns match a
-;; 2nd arg of any CONST_INT, so this insn must appear first.
-;; gen_div_trap always generates TRAP_IF with 2nd arg of 6 or 7.
-
+;; Match a TRAP_IF with 2nd arg of 0.  (Note that there is currently no
+;; support  for generating traps with non-zero code.)
 (define_insn ""
   [(trap_if (match_operator 0 "trap_cmp_op"
-                            [(match_operand:SI 1 "reg_or_0_operand" "d")
-                             (match_operand:SI 2 "nonmemory_operand" "dI")])
+                            [(match_operand:SI 1 "reg_or_0_operand" "dJ")
+                             (match_operand:SI 2 "arith_operand" "dI")])
 	    (const_int 0))]
   "ISA_HAS_COND_TRAP"
+  "t%C0\\t%z1,%z2")
+
+(define_insn ""
+  [(trap_if (match_operator 0 "trap_cmp_op"
+                            [(match_operand:DI 1 "reg_or_0_operand" "dJ")
+                             (match_operand:DI 2 "arith_operand" "dI")])
+	    (const_int 0))]
+  "TARGET_64BIT && ISA_HAS_COND_TRAP"
   "t%C0\\t%z1,%z2")
 
 ;;



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