This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
S/390: Add trap insn.
- From: "Hartmut Penner" <HPENNER at de dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 13 Sep 2002 11:34:11 +0200
- Subject: S/390: Add trap insn.
Hello,
this adds the trap patterns for s390
Traps are generated by jumping inside the (conditional) jump insn itself.
The 'branch relative on condition' has the opcode 'A7x4tttt' where x is the
condition
and tttt is the signed number of halfwords to jump relative to. By setting
tttt to 1,
the instructions jumps to the tttt field, the executing of '0001' delivers
a operation exception.
Bootstrapped/regtested on s390x-ibm-linux.
ChangeLog:
* config/s390/s390.md: Add trap insns.
Index: s390.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.md,v
retrieving revision 1.30
diff -c -p -r1.30 s390.md
*** s390.md 12 Sep 2002 12:37:17 -0000 1.30
--- s390.md 13 Sep 2002 09:20:26 -0000
***************
*** 5970,5975 ****
--- 5970,6009 ----
(const_string "RR") (const_string "RX")))
(set_attr "atype" "mem")])
+ ;;
+ ;;- Trap instructions.
+ ;;
+
+ (define_insn "trap"
+ [(trap_if (const_int 1) (const_int 0))]
+ ""
+ "j\\t.+2"
+ [(set_attr "op_type" "RX")])
+
+ (define_expand "conditional_trap"
+ [(set (match_dup 2) (match_dup 3))
+ (trap_if (match_operator 0 "comparison_operator"
+ [(match_dup 2) (const_int 0)])
+ (match_operand:SI 1 "general_operand" ""))]
+ ""
+ "
+ {
+ enum machine_mode ccmode;
+
+ if (operands[1] != const0_rtx) FAIL;
+
+ ccmode = s390_select_ccmode (GET_CODE (operands[0]),
+ s390_compare_op0,
s390_compare_op1);
+ operands[2] = gen_rtx_REG (ccmode, 33);
+ operands[3] = gen_rtx_COMPARE (ccmode, s390_compare_op0,
s390_compare_op1);
+ }")
+
+ (define_insn ""
+ [(trap_if (match_operator 0 "comparison_operator" [(reg 33) (const_int
0)])
+ (const_int 0))]
+ ""
+ "j%C0\\t.+2";
+ [(set_attr "op_type" "RX")])
;;
;;- Loop instructions.