]> gcc.gnu.org Git - gcc.git/blame - gcc/config/m32c/jump.md
Update Copyright years for files modified in 2008 and/or 2009.
[gcc.git] / gcc / config / m32c / jump.md
CommitLineData
38b2d076 1;; Machine Descriptions for R8C/M16C/M32C
66647d44 2;; Copyright (C) 2005, 2007, 2008
38b2d076
DD
3;; Free Software Foundation, Inc.
4;; Contributed by Red Hat.
5;;
6;; This file is part of GCC.
7;;
8;; GCC is free software; you can redistribute it and/or modify it
9;; under the terms of the GNU General Public License as published
2f83c7d6 10;; by the Free Software Foundation; either version 3, or (at your
38b2d076
DD
11;; option) any later version.
12;;
13;; GCC is distributed in the hope that it will be useful, but WITHOUT
14;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16;; License for more details.
17;;
18;; You should have received a copy of the GNU General Public License
2f83c7d6
NC
19;; along with GCC; see the file COPYING3. If not see
20;; <http://www.gnu.org/licenses/>.
38b2d076
DD
21
22;; jump, conditionals, calls, etc
23
24(define_insn "indirect_jump_16"
25 [(set (pc)
26 (match_operand:HI 0 "register_operand" "Rhi"))]
27 "TARGET_A16"
28; "jmpi.a\t%0"
85f65093 29 ; no 16-bit jmpi in r8c
38b2d076 30 "push.b #0 | push.w\t%0 | rts"
16659fcf 31 [(set_attr "flags" "x")]
38b2d076
DD
32 )
33
34(define_insn "indirect_jump_24"
35 [(set (pc)
36 (match_operand:PSI 0 "register_operand" "Rpi"))]
37 "TARGET_A24"
38 "jmpi.a\t%0"
16659fcf 39 [(set_attr "flags" "n")]
38b2d076
DD
40 )
41
42(define_expand "indirect_jump"
43 [(match_operand 0 "register_operand" "")]
44 ""
45 "if (TARGET_A16)
46 emit_jump_insn (gen_indirect_jump_16(operands[0]));
47 else
48 emit_jump_insn (gen_indirect_jump_24(operands[0]));
49 DONE;"
50 )
51
52; We can replace this with jmp.s when gas supports relaxing. m32c
53; opcodes are too complicated to try to compute their sizes here, it's
54; far easier (and more reliable) to let gas worry about it.
55(define_insn "jump"
56 [(set (pc)
57 (label_ref (match_operand 0 "" "")))]
58 ""
59 "jmp.a\t%l0"
16659fcf 60 [(set_attr "flags" "n")]
38b2d076
DD
61)
62
85f65093 63; No 16-bit indirect calls on r8c/m16c. */
38b2d076
DD
64(define_insn "call"
65 [(call (match_operand:QI 0 "memory_operand" "Si,SaSb,?Rmm")
66 (match_operand 1 "" ""))
67 (use (match_operand 2 "immediate_operand" ""))]
68 ""
69 "*
70switch (which_alternative) {
5abd2125
JS
71 case 0:
72 {
73 HOST_WIDE_INT func_vect_num =
74 current_function_special_page_vector(XEXP (operands[0], 0));
75 if (func_vect_num)
76 {
77 operands[3] = gen_rtx_CONST_INT (VOIDmode, func_vect_num);
78 return \"jsrs\t%3\";
79 }
80 else
81 return \"jsr.a\t%0\";
82 }
38b2d076
DD
83 case 1: return TARGET_A16 ? \"push.w %a0 | jsr.a\tm32c_jsri16\" : \"jsri.a\t%a0\";
84 case 2: return \"jsri.a\t%a0\";
85}"
16659fcf 86 [(set_attr "flags" "x")]
38b2d076
DD
87 )
88
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" ""))]
94 ""
95 "*
96switch (which_alternative) {
5abd2125
JS
97 case 0:
98 {
99 HOST_WIDE_INT func_vect_num =
100 current_function_special_page_vector(XEXP (operands[1], 0));
101 if (func_vect_num)
102 {
103 operands[4] = gen_rtx_CONST_INT (VOIDmode, func_vect_num);
104 return \"jsrs\t%4\";
105 }
106 else
107 return \"jsr.a\t%1\";
108 }
38b2d076
DD
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}"
16659fcf 112 [(set_attr "flags" "x,x,x")]
38b2d076 113 )
c9db440d
DD
114
115(define_expand "untyped_call"
116 [(parallel [(call (match_operand 0 "" "")
117 (const_int 0))
118 (match_operand 1 "" "")
119 (match_operand 2 "" "")])]
120 ""
121 "
122{
123 int i;
124
125 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
126
127 for (i = 0; i < XVECLEN (operands[2], 0); i++)
128 {
129 rtx set = XVECEXP (operands[2], 0, i);
130 emit_move_insn (SET_DEST (set), SET_SRC (set));
131 }
132 DONE;
133}")
This page took 0.787383 seconds and 5 git commands to generate.