1 ;; Copyright (C) 2013 Free Software Foundation, Inc.
3 ;; micromips.md Machine Description for the microMIPS instruction set
4 ;; This file is part of GCC.
6 ;; GCC is free software; you can redistribute it and/or modify it
7 ;; under the terms of the GNU General Public License as published
8 ;; by the Free Software Foundation; either version 3, or (at your
9 ;; option) any later version.
11 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
12 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 ;; License for more details.
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GCC; see the file COPYING3. If not see
18 ;; <http://www.gnu.org/licenses/>.
20 (define_insn "*store_word_multiple"
22 [(set (match_operand:SI 1 "memory_operand")
23 (match_operand:SI 2 "register_operand"))])]
25 && umips_save_restore_pattern_p (true, operands[0])"
26 { return umips_output_save_restore (true, operands[0]); }
27 [(set_attr "type" "multimem")
28 (set_attr "mode" "SI")
29 (set_attr "can_delay" "no")])
31 (define_insn "*load_word_multiple"
33 [(set (match_operand:SI 1 "register_operand")
34 (match_operand:SI 2 "memory_operand"))])]
36 && umips_save_restore_pattern_p (false, operands[0])"
37 { return umips_output_save_restore (false, operands[0]); }
38 [(set_attr "type" "multimem")
39 (set_attr "mode" "SI")
40 (set_attr "can_delay" "no")])
44 [(set (match_operand:SI 0 "d_operand" "")
45 (match_operand:SI 1 "non_volatile_mem_operand" ""))
46 (set (match_operand:SI 2 "d_operand" "")
47 (match_operand:SI 3 "non_volatile_mem_operand" ""))]
49 && umips_load_store_pair_p (true, operands)"
50 [(parallel [(set (match_dup 0) (match_dup 1))
51 (set (match_dup 2) (match_dup 3))])])
53 ;; The behavior of the LWP insn is undefined if placed in a delay slot.
55 [(parallel [(set (match_operand:SI 0 "d_operand")
56 (match_operand:SI 1 "non_volatile_mem_operand"))
57 (set (match_operand:SI 2 "d_operand")
58 (match_operand:SI 3 "non_volatile_mem_operand"))])]
61 && umips_load_store_pair_p (true, operands)"
63 umips_output_load_store_pair (true, operands);
66 [(set_attr "type" "load")
67 (set_attr "mode" "SI")
68 (set_attr "can_delay" "no")])
72 [(set (match_operand:SI 0 "non_volatile_mem_operand" "")
73 (match_operand:SI 1 "d_operand" ""))
74 (set (match_operand:SI 2 "non_volatile_mem_operand" "")
75 (match_operand:SI 3 "d_operand" ""))]
77 && umips_load_store_pair_p (false, operands)"
78 [(parallel [(set (match_dup 0) (match_dup 1))
79 (set (match_dup 2) (match_dup 3))])])
81 ;; The behavior of the SWP insn is undefined if placed in a delay slot.
83 [(parallel [(set (match_operand:SI 0 "non_volatile_mem_operand")
84 (match_operand:SI 1 "d_operand"))
85 (set (match_operand:SI 2 "non_volatile_mem_operand")
86 (match_operand:SI 3 "d_operand"))])]
89 && umips_load_store_pair_p (false, operands)"
91 umips_output_load_store_pair (false, operands);
94 [(set_attr "type" "store")
95 (set_attr "mode" "SI")
96 (set_attr "can_delay" "no")])
99 (define_insn "jraddiusp"
104 (match_operand 0 "uw5_operand")))])]
107 [(set_attr "type" "trap")
108 (set_attr "can_delay" "no")
109 (set_attr "mode" "SI")])
113 [(set (match_operand:MOVEP1 0 "register_operand" "")
114 (match_operand:MOVEP1 1 "movep_src_operand" ""))
115 (set (match_operand:MOVEP2 2 "register_operand" "")
116 (match_operand:MOVEP2 3 "movep_src_operand" ""))]
118 && umips_movep_target_p (operands[0], operands[2])"
119 [(parallel [(set (match_dup 0) (match_dup 1))
120 (set (match_dup 2) (match_dup 3))])])
122 ;; The behavior of the MOVEP insn is undefined if placed in a delay slot.
123 (define_insn "*movep<MOVEP1:mode><MOVEP2:mode>"
124 [(parallel [(set (match_operand:MOVEP1 0 "register_operand")
125 (match_operand:MOVEP1 1 "movep_src_operand"))
126 (set (match_operand:MOVEP2 2 "register_operand")
127 (match_operand:MOVEP2 3 "movep_src_operand"))])]
129 && umips_movep_target_p (operands[0], operands[2])"
131 if (REGNO (operands[0]) < REGNO (operands[2]))
132 return "movep\t%0,%2,%z1,%z3";
134 return "movep\t%2,%0,%z3,%z1";
136 [(set_attr "type" "move")
137 (set_attr "mode" "<MODE>")
138 (set_attr "can_delay" "no")])