1 ;; Machine description for Sunplus S+CORE
3 ;; Free Software Foundation, Inc.
4 ;; Contributed by Sunnorth.
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; GCC is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING. If not, write to
20 ;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
21 ;; Boston, MA 02110-1301, USA.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
25 (define_insn "smaxsi3"
26 [(set (match_operand:SI 0 "register_operand" "=d")
27 (smax:SI (match_operand:SI 1 "register_operand" "d")
28 (match_operand:SI 2 "register_operand" "d")))]
31 [(set_attr "type" "arith")
32 (set_attr "mode" "SI")])
34 (define_insn "sminsi3"
35 [(set (match_operand:SI 0 "register_operand" "=d")
36 (smin:SI (match_operand:SI 1 "register_operand" "d")
37 (match_operand:SI 2 "register_operand" "d")))]
40 [(set_attr "type" "arith")
41 (set_attr "mode" "SI")])
44 [(set (match_operand:SI 0 "register_operand" "=d")
45 (abs:SI (match_operand:SI 1 "register_operand" "d")))]
48 [(set_attr "type" "arith")
49 (set_attr "mode" "SI")])
52 [(set (match_operand:SI 0 "register_operand" "=d")
53 (clz:SI (match_operand:SI 1 "register_operand" "d")))]
56 [(set_attr "type" "arith")
57 (set_attr "mode" "SI")])
60 [(set (match_operand:SI 0 "register_operand" "=d")
61 (unspec:SI [(match_operand:SI 1 "register_operand" "d")] SFFS))]
63 "bitrev %0, %1, r0\;clz %0, %0\;addi %0, 0x1"
64 [(set_attr "type" "arith")
65 (set_attr "mode" "SI")])
67 (define_expand "ffssi2"
68 [(set (match_operand:SI 0 "register_operand")
69 (ffs:SI (match_operand:SI 1 "register_operand")))]
72 emit_insn (gen_sffs (operands[0], operands[1]));
73 emit_insn (gen_rtx_SET (VOIDmode, gen_rtx_REG (CC_NZmode, CC_REGNUM),
74 gen_rtx_COMPARE (CC_NZmode, operands[0],
76 emit_insn (gen_movsicc_internal (operands[0],
77 gen_rtx_fmt_ee (EQ, VOIDmode, operands[0], GEN_INT (33)),
84 [(set (match_operand:SI 0 "loreg_operand" "")
85 (match_operand:SI 1 "register_operand" ""))
86 (set (match_operand:SI 2 "hireg_operand" "")
87 (match_operand:SI 3 "register_operand" ""))]
90 [(set (match_dup 0) (match_dup 1))
91 (set (match_dup 2) (match_dup 3))])])
94 [(set (match_operand:SI 0 "hireg_operand" "")
95 (match_operand:SI 1 "register_operand" ""))
96 (set (match_operand:SI 2 "loreg_operand" "")
97 (match_operand:SI 3 "register_operand" ""))]
100 [(set (match_dup 2) (match_dup 3))
101 (set (match_dup 0) (match_dup 1))])])
103 (define_insn "movtohilo"
105 [(set (match_operand:SI 0 "loreg_operand" "=l")
106 (match_operand:SI 1 "register_operand" "d"))
107 (set (match_operand:SI 2 "hireg_operand" "=h")
108 (match_operand:SI 3 "register_operand" "d"))])]
111 [(set_attr "type" "fce")
112 (set_attr "mode" "SI")])
114 (define_insn "mulsi3addsi"
115 [(set (match_operand:SI 0 "register_operand" "=l,l,d")
116 (plus:SI (mult:SI (match_operand:SI 2 "register_operand" "d,d,d")
117 (match_operand:SI 3 "register_operand" "d,d,d"))
118 (match_operand:SI 1 "register_operand" "0,d,l")))
119 (clobber (reg:SI HI_REGNUM))]
123 mtcel%S1 %1\;mad %2, %3
124 mad %2, %3\;mfcel%S0 %0"
125 [(set_attr "mode" "SI")])
127 (define_insn "mulsi3subsi"
128 [(set (match_operand:SI 0 "register_operand" "=l,l,d")
129 (minus:SI (match_operand:SI 1 "register_operand" "0,d,l")
130 (mult:SI (match_operand:SI 2 "register_operand" "d,d,d")
131 (match_operand:SI 3 "register_operand" "d,d,d"))))
132 (clobber (reg:SI HI_REGNUM))]
136 mtcel%S1 %1\;msb %2, %3
137 msb %2, %3\;mfcel%S0 %0"
138 [(set_attr "mode" "SI")])
140 (define_insn "mulsidi3adddi"
141 [(set (match_operand:DI 0 "register_operand" "=x")
143 (sign_extend:DI (match_operand:SI 2 "register_operand" "%d"))
144 (sign_extend:DI (match_operand:SI 3 "register_operand" "d")))
145 (match_operand:DI 1 "register_operand" "0")))]
148 [(set_attr "mode" "DI")])
150 (define_insn "umulsidi3adddi"
151 [(set (match_operand:DI 0 "register_operand" "=x")
153 (zero_extend:DI (match_operand:SI 2 "register_operand" "%d"))
154 (zero_extend:DI (match_operand:SI 3 "register_operand" "d")))
155 (match_operand:DI 1 "register_operand" "0")))]
158 [(set_attr "mode" "DI")])
160 (define_insn "mulsidi3subdi"
161 [(set (match_operand:DI 0 "register_operand" "=x")
163 (match_operand:DI 1 "register_operand" "0")
165 (sign_extend:DI (match_operand:SI 2 "register_operand" "%d"))
166 (sign_extend:DI (match_operand:SI 3 "register_operand" "d")))))]
169 [(set_attr "mode" "DI")])
171 (define_insn "umulsidi3subdi"
172 [(set (match_operand:DI 0 "register_operand" "=x")
174 (match_operand:DI 1 "register_operand" "0")
175 (mult:DI (zero_extend:DI
176 (match_operand:SI 2 "register_operand" "%d"))
178 (match_operand:SI 3 "register_operand" "d")))))]
181 [(set_attr "mode" "DI")])