This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [mips patch' RFA] handle trap_if with DI-mode arguments.
At Mon, 18 Aug 2003 19:11:28 -0700, Eric Christopher wrote:
> As we spoke, should probably check if operands == const0_rtx instead. I
> think... :) I'm sure someone will correct me if I'm wrong.
looking at the docs, it looks like it should be fine, yes. (Well,
operands[0] ==... 8-)
patch below tested the same for mipsisa64-elf (-mips32 and -mips64
multilibs, against sim) as previous.
chris
--
2003-08-18 Chris Demetriou <cgd@broadcom.com>
* config/mips/mips.c (mips_gen_conditional_trap): Fix error
in comment.
* config/mips/mips.md: Adjust 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 19 Aug 2003 04:37:03 -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 19 Aug 2003 04:37:04 -0000
@@ -657,20 +657,31 @@
"ISA_HAS_COND_TRAP"
"
{
- mips_gen_conditional_trap (operands);
- DONE;
+ if (operands[1] == const0_rtx)
+ {
+ 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")
;;