1 ;; Machine Descriptions for R8C/M16C/M32C
2 ;; Copyright (C) 2005-2015 Free Software Foundation, Inc.
3 ;; Contributed by Red Hat.
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify it
8 ;; under the terms of the GNU General Public License as published
9 ;; by the Free Software Foundation; either version 3, or (at your
10 ;; option) any later version.
12 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
13 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 ;; License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING3. If not see
19 ;; <http://www.gnu.org/licenses/>.
21 ;; jump, conditionals, calls, etc
23 (define_insn "indirect_jump_16"
25 (match_operand:HI 0 "register_operand" "Rhi"))]
28 ; no 16-bit jmpi in r8c
29 "push.b #0 | push.w\t%0 | rts"
30 [(set_attr "flags" "x")]
33 (define_insn "indirect_jump_24"
35 (match_operand:PSI 0 "register_operand" "Rpi"))]
38 [(set_attr "flags" "n")]
41 (define_expand "indirect_jump"
42 [(match_operand 0 "register_operand" "")]
45 emit_jump_insn (gen_indirect_jump_16(operands[0]));
47 emit_jump_insn (gen_indirect_jump_24(operands[0]));
51 ; We can replace this with jmp.s when gas supports relaxing. m32c
52 ; opcodes are too complicated to try to compute their sizes here, it's
53 ; far easier (and more reliable) to let gas worry about it.
56 (label_ref (match_operand 0 "" "")))]
59 [(set_attr "flags" "n")]
62 ; No 16-bit indirect calls on r8c/m16c. */
64 [(call (match_operand:QI 0 "memory_operand" "Si,SaSb,?Rmm")
65 (match_operand 1 "" ""))
66 (use (match_operand 2 "immediate_operand" ""))]
69 switch (which_alternative) {
72 HOST_WIDE_INT func_vect_num =
73 current_function_special_page_vector(XEXP (operands[0], 0));
76 operands[3] = gen_rtx_CONST_INT (VOIDmode, func_vect_num);
82 case 1: return TARGET_A16 ? \"push.w %a0 | jsr.a\tm32c_jsri16\" : \"jsri.a\t%a0\";
83 case 2: return \"jsri.a\t%a0\";
84 default: gcc_unreachable ();
86 [(set_attr "flags" "x")]
89 (define_insn "call_value"
90 [(set (match_operand 0 "m32c_return_operand" "=RdiRmmRpa,RdiRmmRpa,RdiRmmRpa")
91 (call (match_operand:QI 1 "memory_operand" "Si,SaSb,?Rmm")
92 (match_operand 2 "" "")))
93 (use (match_operand 3 "immediate_operand" ""))]
96 switch (which_alternative) {
99 HOST_WIDE_INT func_vect_num =
100 current_function_special_page_vector(XEXP (operands[1], 0));
103 operands[4] = gen_rtx_CONST_INT (VOIDmode, func_vect_num);
107 return \"jsr.a\t%1\";
109 case 1: return TARGET_A16 ? \"push.w %a1 | jsr.a\tm32c_jsri16\" : \"jsri.a\t%a1\";
110 case 2: return \"jsri.a\t%a1\";
111 default: gcc_unreachable ();
113 [(set_attr "flags" "x,x,x")]
116 (define_expand "untyped_call"
117 [(parallel [(call (match_operand 0 "" "")
119 (match_operand 1 "" "")
120 (match_operand 2 "" "")])]
126 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
128 for (i = 0; i < XVECLEN (operands[2], 0); i++)
130 rtx set = XVECEXP (operands[2], 0, i);
131 emit_move_insn (SET_DEST (set), SET_SRC (set));