rl78-virt.md revision 1.4 1 1.1 mrg ;; Machine Description for Renesas RL78 processors
2 1.3 mrg ;; Copyright (C) 2011-2015 Free Software Foundation, Inc.
3 1.1 mrg ;; Contributed by Red Hat.
4 1.1 mrg
5 1.1 mrg ;; This file is part of GCC.
6 1.1 mrg
7 1.1 mrg ;; GCC is free software; you can redistribute it and/or modify
8 1.1 mrg ;; it under the terms of the GNU General Public License as published by
9 1.1 mrg ;; the Free Software Foundation; either version 3, or (at your option)
10 1.1 mrg ;; any later version.
11 1.1 mrg
12 1.1 mrg ;; GCC is distributed in the hope that it will be useful,
13 1.1 mrg ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 1.1 mrg ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 1.1 mrg ;; GNU General Public License for more details.
16 1.1 mrg
17 1.1 mrg ;; You should have received a copy of the GNU General Public License
18 1.1 mrg ;; along with GCC; see the file COPYING3. If not see
19 1.1 mrg ;; <http://www.gnu.org/licenses/>.
20 1.1 mrg
22 1.1 mrg ;; In this MD file, we define those insn patterns that involve
23 1.1 mrg ;; registers, where such registers are virtual until allocated to a
24 1.1 mrg ;; physical register. All of these insns need to be conditional on
25 1.1 mrg ;; rl78_virt_insns_ok () being true.
26 1.1 mrg
27 1.1 mrg ;; This tells the physical register allocator what method to use to
28 1.1 mrg ;; allocate registers. Basically, this defines the template of the
29 1.1 mrg ;; instruction - op1 is of the form "a = op(b)", op2 is "a = b op c"
30 1.1 mrg ;; etc.
31 1.1 mrg
32 1.1 mrg (define_attr "valloc" "op1,op2,ro1,cmp,umul,macax"
33 1.1 mrg (const_string "op2"))
34 1.1 mrg
35 1.1 mrg ;;---------- Moving ------------------------
36 1.3 mrg
37 1.3 mrg (define_insn "*movqi_virt_mm"
38 1.3 mrg [(set (match_operand:QI 0 "rl78_near_mem_operand" "=Y")
39 1.3 mrg (match_operand 1 "rl78_near_mem_operand" "Y"))]
40 1.3 mrg "rl78_virt_insns_ok ()"
41 1.3 mrg "v.mov %0, %1"
42 1.3 mrg [(set_attr "valloc" "op1")]
43 1.3 mrg )
44 1.1 mrg
45 1.1 mrg (define_insn "*movqi_virt"
46 1.3 mrg [(set (match_operand:QI 0 "nonimmediate_operand" "=vY,v,Wfr")
47 1.1 mrg (match_operand 1 "general_operand" "vInt8J,YWfr,vInt8J"))]
48 1.1 mrg "rl78_virt_insns_ok ()"
49 1.1 mrg "v.mov %0, %1"
50 1.1 mrg [(set_attr "valloc" "op1")]
51 1.1 mrg )
52 1.3 mrg
53 1.3 mrg (define_insn "*movhi_virt_mm"
54 1.3 mrg [(set (match_operand:HI 0 "rl78_near_mem_operand" "=Y")
55 1.3 mrg (match_operand:HI 1 "rl78_near_mem_operand" "Y"))]
56 1.3 mrg "rl78_virt_insns_ok ()"
57 1.3 mrg "v.movw %0, %1"
58 1.3 mrg [(set_attr "valloc" "op1")]
59 1.3 mrg )
60 1.1 mrg
61 1.3 mrg (define_insn "*movhi_virt"
62 1.3 mrg [(set (match_operand:HI 0 "nonimmediate_operand" "=vS, Y, v, Wfr")
63 1.1 mrg (match_operand:HI 1 "general_operand" "viYS, viS, Wfr, vi"))]
64 1.1 mrg "rl78_virt_insns_ok ()"
65 1.1 mrg "v.movw %0, %1"
66 1.1 mrg [(set_attr "valloc" "op1")]
67 1.1 mrg )
68 1.1 mrg
69 1.1 mrg ;;---------- Conversions ------------------------
70 1.1 mrg
71 1.1 mrg (define_insn "*zero_extendqihi2_virt"
72 1.1 mrg [(set (match_operand:HI 0 "rl78_nonfar_nonimm_operand" "=vm")
73 1.1 mrg (zero_extend:HI (match_operand:QI 1 "general_operand" "vim")))]
74 1.1 mrg "rl78_virt_insns_ok ()"
75 1.1 mrg "v.zero_extend\t%0, %1"
76 1.1 mrg [(set_attr "valloc" "op1")]
77 1.1 mrg )
78 1.1 mrg
79 1.1 mrg (define_insn "*extendqihi2_virt"
80 1.1 mrg [(set (match_operand:HI 0 "rl78_nonfar_nonimm_operand" "=vm")
81 1.1 mrg (sign_extend:HI (match_operand:QI 1 "general_operand" "vim")))]
82 1.1 mrg "rl78_virt_insns_ok ()"
83 1.1 mrg "v.sign_extend\t%0, %1"
84 1.1 mrg [(set_attr "valloc" "op1")]
85 1.1 mrg )
86 1.1 mrg
87 1.1 mrg ;;---------- Arithmetic ------------------------
88 1.3 mrg
89 1.3 mrg (define_insn "*inc<mode>3_virt"
90 1.3 mrg [(set (match_operand:QHI 0 "rl78_incdec_memory_operand" "=vm")
91 1.3 mrg (plus:QHI (match_operand:QHI 1 "rl78_incdec_memory_operand" "0")
92 1.3 mrg (match_operand:QHI 2 "rl78_1_2_operand" "KLNO")))
93 1.3 mrg ]
94 1.3 mrg "rl78_virt_insns_ok ()"
95 1.3 mrg "v.inc\t%0, %1, %2"
96 1.3 mrg )
97 1.1 mrg
98 1.1 mrg (define_insn "*add<mode>3_virt"
99 1.1 mrg [(set (match_operand:QHI 0 "rl78_nonfar_nonimm_operand" "=vY,S")
100 1.3 mrg (plus:QHI (match_operand:QHI 1 "rl78_nonfar_operand" "viY,0")
101 1.1 mrg (match_operand:QHI 2 "rl78_general_operand" "vim,i")))
102 1.1 mrg ]
103 1.1 mrg "rl78_virt_insns_ok ()"
104 1.1 mrg "v.add\t%0, %1, %2"
105 1.1 mrg )
106 1.1 mrg
107 1.1 mrg (define_insn "*sub<mode>3_virt"
108 1.1 mrg [(set (match_operand:QHI 0 "rl78_nonfar_nonimm_operand" "=vm,S")
109 1.3 mrg (minus:QHI (match_operand:QHI 1 "rl78_nonfar_operand" "vim,0")
110 1.1 mrg (match_operand:QHI 2 "rl78_general_operand" "vim,i")))
111 1.1 mrg ]
112 1.1 mrg "rl78_virt_insns_ok ()"
113 1.1 mrg "v.sub\t%0, %1, %2"
114 1.1 mrg )
115 1.1 mrg
116 1.1 mrg (define_insn "*umulhi3_shift_virt"
117 1.1 mrg [(set (match_operand:HI 0 "register_operand" "=vm")
118 1.1 mrg (mult:HI (match_operand:HI 1 "rl78_nonfar_operand" "%vim")
119 1.4 mrg (match_operand:HI 2 "rl78_24_operand" "Ni")))]
120 1.1 mrg "rl78_virt_insns_ok ()"
121 1.1 mrg "v.mulu\t%0, %1, %2"
122 1.1 mrg [(set_attr "valloc" "umul")]
123 1.1 mrg )
124 1.1 mrg
125 1.1 mrg (define_insn "*umulqihi3_virt"
126 1.1 mrg [(set (match_operand:HI 0 "register_operand" "=vm")
127 1.1 mrg (mult:HI (zero_extend:HI (match_operand:QI 1 "rl78_nonfar_operand" "%vim"))
128 1.4 mrg (zero_extend:HI (match_operand:QI 2 "general_operand" "vim"))))]
129 1.1 mrg "rl78_virt_insns_ok ()"
130 1.1 mrg "v.mulu\t%0, %2"
131 1.1 mrg [(set_attr "valloc" "umul")]
132 1.1 mrg )
133 1.1 mrg
134 1.3 mrg (define_insn "*andqi3_virt"
135 1.3 mrg [(set (match_operand:QI 0 "rl78_nonimmediate_operand" "=vm")
136 1.3 mrg (and:QI (match_operand:QI 1 "rl78_general_operand" "vim")
137 1.1 mrg (match_operand:QI 2 "rl78_general_operand" "vim")))
138 1.1 mrg ]
139 1.1 mrg "rl78_virt_insns_ok ()"
140 1.1 mrg "v.and\t%0, %1, %2"
141 1.1 mrg )
142 1.1 mrg
143 1.3 mrg (define_insn "*iorqi3_virt"
144 1.3 mrg [(set (match_operand:QI 0 "rl78_nonimmediate_operand" "=vm")
145 1.3 mrg (ior:QI (match_operand:QI 1 "rl78_general_operand" "vim")
146 1.1 mrg (match_operand:QI 2 "rl78_general_operand" "vim")))
147 1.1 mrg ]
148 1.1 mrg "rl78_virt_insns_ok ()"
149 1.1 mrg "v.or\t%0, %1, %2"
150 1.1 mrg )
151 1.3 mrg
152 1.1 mrg (define_insn "*xorqi3_virt"
153 1.1 mrg [(set (match_operand:QI 0 "rl78_nonfar_nonimm_operand" "=v,vm,m")
154 1.3 mrg (xor:QI (match_operand:QI 1 "rl78_nonfar_operand" "%0,vm,vm")
155 1.1 mrg (match_operand 2 "rl78_general_operand" "i,vm,vim")))
156 1.1 mrg ]
157 1.1 mrg "rl78_virt_insns_ok ()"
158 1.1 mrg "v.xor\t%0, %1, %2"
159 1.1 mrg )
160 1.1 mrg
161 1.1 mrg ;;---------- Shifts ------------------------
162 1.1 mrg
163 1.1 mrg (define_insn "*ashl<mode>3_virt"
164 1.1 mrg [(set (match_operand:QHI 0 "rl78_nonfar_nonimm_operand" "=vm")
165 1.1 mrg (ashift:QHI (match_operand:QHI 1 "rl78_nonfar_operand" "vim")
166 1.1 mrg (match_operand:QI 2 "general_operand" "vim")))
167 1.1 mrg ]
168 1.1 mrg "rl78_virt_insns_ok ()"
169 1.1 mrg "v.shl\t%0, %1, %2"
170 1.1 mrg )
171 1.1 mrg
172 1.1 mrg (define_insn "*ashr<mode>3_virt"
173 1.1 mrg [(set (match_operand:QHI 0 "rl78_nonfar_nonimm_operand" "=vm")
174 1.1 mrg (ashiftrt:QHI (match_operand:QHI 1 "rl78_nonfar_operand" "vim")
175 1.1 mrg (match_operand:QI 2 "general_operand" "vim")))
176 1.1 mrg ]
177 1.1 mrg "rl78_virt_insns_ok ()"
178 1.1 mrg "v.sar\t%0, %1, %2"
179 1.1 mrg )
180 1.1 mrg
181 1.1 mrg (define_insn "*lshr<mode>3_virt"
182 1.1 mrg [(set (match_operand:QHI 0 "rl78_nonfar_nonimm_operand" "=vm")
183 1.1 mrg (lshiftrt:QHI (match_operand:QHI 1 "rl78_nonfar_operand" "vim")
184 1.1 mrg (match_operand:QI 2 "general_operand" "vim")))
185 1.1 mrg ]
186 1.1 mrg "rl78_virt_insns_ok ()"
187 1.1 mrg "v.shr\t%0, %1, %2"
188 1.1 mrg )
189 1.3 mrg
190 1.3 mrg ;; This is complex mostly because the RL78 has no SImode operations,
191 1.3 mrg ;; and very limited HImode operations, and no variable shifts. This
192 1.3 mrg ;; pattern is optimized for each constant shift count and operand
193 1.3 mrg ;; types, so as to use a hand-optimized pattern. For readability, the
194 1.3 mrg ;; usual \t\; syntax is not used here. Also, there's no easy way to
195 1.3 mrg ;; constrain to avoid partial overlaps, hence the duplication.
196 1.3 mrg (define_insn "ashrsi3_virt" ;; 0 1 2-7 8 9-15 16 17-23 24 25-31 var
197 1.3 mrg [(set (match_operand:SI 0 "nonimmediate_operand" "=v,vU,&vU,v, &vU, &vU, v, &vU, v, &vU, &vU, vU, v,&vU, vU, vU, vU")
198 1.3 mrg (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0, 0, vU,0, vWab, U, 0, vU, 0, vWab,U, vU, 0, vU, vU, vU, 0")
199 1.3 mrg (match_operand:SI 2 "nonmemory_operand" "M, K, K, Int3,Int3,Int3,Iv08,Iv08,Is09,Is09,Is09,Iv16,Is17,Is17,Iv24,Is25, iv")))
200 1.3 mrg (clobber (reg:HI X_REG))
201 1.3 mrg ]
202 1.3 mrg ""
203 1.3 mrg "@
204 1.3 mrg ; ashrsi %0, 0
205 1.3 mrg
206 1.3 mrg movw ax,%H1 \; sarw ax,1 \; movw %H0,ax \; mov a,%Q1 \; rorc a,1 \; mov %Q0,a \; mov a,%q1 \; rorc a,1 \; mov %q0,a
207 1.3 mrg movw ax,%H1 \; sarw ax,1 \; movw %H0,ax \; mov a,%Q1 \; rorc a,1 \; mov %Q0,a \; mov a,%q1 \; rorc a,1 \; mov %q0,a
208 1.3 mrg
209 1.3 mrg movw ax,%1 \; shlw ax,%r2 \; mov %0,a \; mov x,%Q1 \; mov a,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; sarw ax,%u2 \; movw %H0,ax
210 1.3 mrg movw ax,%1 \; shlw ax,%r2 \; mov %0,a \; mov x,%Q1 \; mov a,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; sarw ax,%u2 \; movw %H0,ax
211 1.3 mrg movw ax,%1 \; shlw ax,%r2 \; mov %0,a \; mov a,%Q1 \; mov x,a \; mov a,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; sarw ax,%u2 \; movw %H0,ax
212 1.3 mrg
213 1.3 mrg mov x,%Q1 \; mov a,%H1 \; movw %0,ax \; movw ax,%H1 \; sarw ax,8 \; movw %H0,ax
214 1.3 mrg mov a,%Q1 \; mov x, a \; mov a,%H1 \; movw %0,ax \; movw ax,%H1 \; sarw ax,8 \; movw %H0,ax
215 1.3 mrg
216 1.3 mrg mov x,%Q1 \; mov a,%H1 \; shlw ax,%r2 \; mov %0,a \; movw ax,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; sarw ax,%u2 \; movw %H0,ax
217 1.3 mrg mov x,%Q1 \; mov a,%H1 \; shlw ax,%r2 \; mov %0,a \; movw ax,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; sarw ax,%u2 \; movw %H0,ax
218 1.3 mrg mov a,%Q1 \; mov x,a \; mov a,%H1 \; shlw ax,%r2 \; mov %0,a \; movw ax,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; sarw ax,%u2 \; movw %H0,ax
219 1.3 mrg
220 1.3 mrg movw ax,%H1 \; movw %0,ax \; sarw ax,15 \; movw %H0,ax
221 1.3 mrg
222 1.3 mrg movw ax,%H1 \; sarw ax,%S2 \; movw %0,ax \; sarw ax,15 \; movw %H0,ax
223 1.3 mrg movw ax,%H1 \; sarw ax,%S2 \; movw %0,ax \; sarw ax,15 \; movw %H0,ax
224 1.3 mrg
225 1.3 mrg movw ax,%H1 \; mov %0,a \; sarw ax,15 \; movw %H0,ax \; mov %Q0,a
226 1.3 mrg
227 1.3 mrg movw ax,%H1 \; sar a,%s2 \; mov %0,a \; sarw ax,15 \; movw %H0,ax \; mov %Q0,a
228 1.3 mrg
229 1.3 mrg mov b,%2 \; cmp0 b \; bz $2f \; 1: \; movw ax,%H1 \; sarw ax,1 \; movw %H0,ax \; mov a,%Q1 \; rorc a,1 \; mov %Q0,a \; mov a,%q1 \; rorc a,1 \; mov %q0,a \; dec b \; bnz $1b \; 2:"
230 1.3 mrg [(set_attr "valloc" "macax")]
231 1.3 mrg )
232 1.3 mrg
233 1.3 mrg ;; Likewise.
234 1.3 mrg (define_insn "lshrsi3_virt" ;; 0 1 2-7 8 9-15 16 17-23 24 25-31 var
235 1.3 mrg [(set (match_operand:SI 0 "nonimmediate_operand" "=v,vU,&vU,v, &vU, &vU, v, &vU, v, &vU, &vU, vU, v,&vU, vU, vU, vU")
236 1.3 mrg (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0, 0, vU,0, vWab, U, 0, vU, 0, vWab,U, vU, 0, vU, vU, vU, 0")
237 1.3 mrg (match_operand:SI 2 "nonmemory_operand" "M, K, K, Int3,Int3,Int3,Iv08,Iv08,Is09,Is09,Is09,Iv16,Is17,Is17,Iv24,Is25, iv")))
238 1.1 mrg (clobber (reg:HI X_REG))
239 1.1 mrg ]
240 1.1 mrg ""
241 1.3 mrg "@
242 1.3 mrg ; lshrsi %0, 0
243 1.3 mrg
244 1.3 mrg movw ax,%H1 \; shrw ax,1 \; movw %H0,ax \; mov a,%Q1 \; rorc a,1 \; mov %Q0,a \; mov a,%q1 \; rorc a,1 \; mov %q0,a
245 1.3 mrg movw ax,%H1 \; shrw ax,1 \; movw %H0,ax \; mov a,%Q1 \; rorc a,1 \; mov %Q0,a \; mov a,%q1 \; rorc a,1 \; mov %q0,a
246 1.3 mrg
247 1.3 mrg movw ax,%1 \; shlw ax,%r2 \; mov %0,a \; mov x,%Q1 \; mov a,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; shrw ax,%u2 \; movw %H0,ax
248 1.3 mrg movw ax,%1 \; shlw ax,%r2 \; mov %0,a \; mov x,%Q1 \; mov a,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; shrw ax,%u2 \; movw %H0,ax
249 1.3 mrg movw ax,%1 \; shlw ax,%r2 \; mov %0,a \; mov a,%Q1 \; mov x,a \; mov a,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; shrw ax,%u2 \; movw %H0,ax
250 1.3 mrg
251 1.3 mrg mov x,%Q1 \; mov a,%H1 \; movw %0,ax \; movw ax,%H1 \; shrw ax,8 \; movw %H0,ax
252 1.3 mrg mov a,%Q1 \; mov x, a \; mov a,%H1 \; movw %0,ax \; movw ax,%H1 \; shrw ax,8 \; movw %H0,ax
253 1.3 mrg
254 1.3 mrg mov x,%Q1 \; mov a,%H1 \; shlw ax,%r2 \; mov %0,a \; movw ax,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; shrw ax,%u2 \; movw %H0,ax
255 1.3 mrg mov x,%Q1 \; mov a,%H1 \; shlw ax,%r2 \; mov %0,a \; movw ax,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; shrw ax,%u2 \; movw %H0,ax
256 1.3 mrg mov a,%Q1 \; mov x,a \; mov a,%H1 \; shlw ax,%r2 \; mov %0,a \; movw ax,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; shrw ax,%u2 \; movw %H0,ax
257 1.3 mrg
258 1.3 mrg movw ax,%H1 \; movw %0,ax \; movw ax,#0 \; movw %H0,ax
259 1.3 mrg
260 1.3 mrg movw ax,%H1 \; shrw ax,%S2 \; movw %0,ax \; movw ax,#0 \; movw %H0,ax
261 1.3 mrg movw ax,%H1 \; shrw ax,%S2 \; movw %0,ax \; movw ax,#0 \; movw %H0,ax
262 1.3 mrg
263 1.3 mrg movw ax,%H1 \; mov %0,a \; movw ax,#0 \; movw %H0,ax \; mov %Q0,a
264 1.3 mrg
265 1.3 mrg movw ax,%H1 \; shr a,%s2 \; mov %0,a \; movw ax,#0 \; movw %H0,ax \; mov %Q0,a
266 1.3 mrg
267 1.1 mrg mov b,%2 \; cmp0 b \; bz $2f \; 1: \; movw ax,%H1 \; shrw ax,1 \; movw %H0,ax \; mov a,%Q1 \; rorc a,1 \; mov %Q0,a \; mov a,%q1 \; rorc a,1 \; mov %q0,a \; dec b \; bnz $1b \; 2:"
268 1.1 mrg [(set_attr "valloc" "macax")]
269 1.1 mrg )
270 1.3 mrg
271 1.3 mrg ;; Likewise.
272 1.3 mrg (define_insn "ashlsi3_virt" ;; 0 1 2-7 8 9-15 16 17-23 24 25-31 var
273 1.3 mrg [(set (match_operand:SI 0 "nonimmediate_operand" "=v,vU,&vU,v, &vU, &vU, v, &vU, v, &vU, &vU, v, U, v,&vU, v, U, v, U, vWab,vU, vU")
274 1.3 mrg (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0, 0, vU,0, vWab, U, 0, vU, 0, vWab,U, vU, vU, 0, vU, vU, vU, vU, vU, 0, vWab,U")
275 1.3 mrg (match_operand:SI 2 "nonmemory_operand" "M, K, K, Int3,Int3,Int3,Iv08,Iv08,Is09,Is09,Is09,Iv16,Iv16,Is17,Is17,Iv24,Iv24,Is25,Is25,iv, iv, iv")))
276 1.3 mrg (clobber (reg:HI X_REG))
277 1.3 mrg ]
278 1.3 mrg ""
279 1.3 mrg "@
280 1.3 mrg ; lshrsi %0, 0
281 1.3 mrg
282 1.3 mrg movw ax,%1 \; shlw ax,1 \; movw %0,ax \; movw ax,%H1 \; rolwc ax,1 \; movw %H0,ax
283 1.3 mrg movw ax,%1 \; shlw ax,1 \; movw %0,ax \; movw ax,%H1 \; rolwc ax,1 \; movw %H0,ax
284 1.3 mrg
285 1.3 mrg movw ax,%H1 \; shlw ax,%u2 \; mov %E0,a \; mov x,%Q1 \; mov a, %H1 \; shlw ax,%S2 \; mov %H0,a \; movw ax,%1 \; shlw ax,%u2 \; movw %0,ax
286 1.3 mrg movw ax,%H1 \; shlw ax,%u2 \; mov %E0,a \; mov x,%Q1 \; mov a, %H1 \; shlw ax,%S2 \; mov %H0,a \; movw ax,%1 \; shlw ax,%u2 \; movw %0,ax
287 1.3 mrg movw ax,%H1 \; shlw ax,%u2 \; mov %E0,a \; mov a,%Q1 \; mov x,a \; mov a, %H1 \; shlw ax,%S2 \; mov %H0,a \; movw ax,%1 \; shlw ax,%u2 \; movw %0,ax
288 1.3 mrg
289 1.3 mrg mov x,%Q1 \; mov a,%H1 \; movw %H0,ax \; movw ax,%1 \; shlw ax,8 \; movw %0,ax
290 1.3 mrg mov a,%Q1 \; mov x,a \; mov a,%H1 \; movw %H0,ax \; movw ax,%1 \; shlw ax,8 \; movw %0,ax
291 1.3 mrg
292 1.3 mrg mov x,%Q1 \; mov a,%H1 \; shlw ax,%s2 \; movw %H0,ax \; movw ax,%1 \; shlw ax,%s2 \; mov %H0,a \; movw ax,%1 \; shlw ax,%u2 \; movw %0,ax
293 1.3 mrg mov x,%Q1 \; mov a,%H1 \; shlw ax,%s2 \; movw %H0,ax \; movw ax,%1 \; shlw ax,%s2 \; mov %H0,a \; movw ax,%1 \; shlw ax,%u2 \; movw %0,ax
294 1.3 mrg mov a,%Q1 \; mov x,a \; mov a,%H1 \; shlw ax,%s2 \; movw %H0,ax \; movw ax,%1 \; shlw ax,%s2 \; mov %H0,a \; movw ax,%1 \; shlw ax,%u2 \; movw %0,ax
295 1.3 mrg
296 1.3 mrg movw ax,%1 \; movw %H0,ax \; movw %0,#0
297 1.3 mrg movw ax,%1 \; movw %H0,ax \; movw ax,#0 \; movw %0,ax
298 1.3 mrg
299 1.3 mrg movw ax,%1 \; shlw ax,%S2 \; movw %H0,ax \; movw %0,#0
300 1.3 mrg movw ax,%1 \; shlw ax,%S2 \; movw %H0,ax \; movw ax,#0 \; movw %0,ax
301 1.3 mrg
302 1.3 mrg mov a,%1 \; movw %H0,ax \; mov %H0,#0 \; movw %0,#0
303 1.3 mrg mov a,%1 \; movw %H0,ax \; movw ax,#0 \; mov %H0,a \; movW %0,ax
304 1.3 mrg
305 1.3 mrg mov a,%1 \; shl a,%s2 \; movw %H0,ax \; mov %H0,#0 \; movw %0,#0
306 1.3 mrg mov a,%1 \; shl a,%s2 \; movw %H0,ax \; movw ax,#0 \; mov %H0,a \; movW %0,ax
307 1.3 mrg
308 1.3 mrg mov a,%2 \; cmp0 a \; bz $2f \; mov d,a \; movw ax,%H1 \; movw bc,%1 \; 1: \; shlw bc,1 \; rolwc ax,1 \; dec d \; bnz $1b \; movw %H0,ax \; movw ax,bc \; movw %0,ax \; 2:
309 1.3 mrg mov a,%2 \; mov d,a \; movw ax,%H1 \; movw bc,%1 \; cmp0 0xFFEFD \; bz $2f \; 1: \; shlw bc,1 \; rolwc ax,1 \; dec d \; bnz $1b \; 2: \; movw %H0,ax \; movw ax,bc \; movw %0,ax
310 1.3 mrg mov a,%2 \; mov d,a \; movw ax,%1 \; movw bc,ax \; movw ax,%H1 \; cmp0 0xFFEFD \; bz $2f \; 1: \; shlw bc,1 \; rolwc ax,1 \; dec d \; bnz $1b \; 2: \; movw %H0,ax \; movw ax,bc \; movw %0,ax"
311 1.3 mrg [(set_attr "valloc" "macax")]
312 1.3 mrg )
313 1.1 mrg
314 1.1 mrg ;;---------- Branching ------------------------
315 1.1 mrg
316 1.1 mrg (define_insn "*indirect_jump_virt"
317 1.1 mrg [(set (pc)
318 1.1 mrg (match_operand:HI 0 "nonimmediate_operand" "vm"))]
319 1.1 mrg "rl78_virt_insns_ok ()"
320 1.1 mrg "v.br\t%0"
321 1.1 mrg [(set_attr "valloc" "ro1")]
322 1.1 mrg )
323 1.1 mrg
324 1.1 mrg (define_insn "*call_virt"
325 1.1 mrg [(call (match_operand:HI 0 "memory_operand" "Wab,Wcv")
326 1.1 mrg (match_operand 1 "" ""))]
327 1.1 mrg "rl78_virt_insns_ok ()"
328 1.1 mrg "v.call\t%0"
329 1.1 mrg [(set_attr "valloc" "ro1")]
330 1.1 mrg )
331 1.1 mrg
332 1.1 mrg (define_insn "*call_value_virt"
333 1.1 mrg [(set (match_operand 0 "register_operand" "=v,v")
334 1.1 mrg (call (match_operand:HI 1 "memory_operand" "Wab,Wcv")
335 1.1 mrg (match_operand 2 "" "")))]
336 1.1 mrg "rl78_virt_insns_ok ()"
337 1.1 mrg "v.call\t%1"
338 1.1 mrg [(set_attr "valloc" "op1")]
339 1.1 mrg )
340 1.3 mrg
341 1.3 mrg (define_insn "*cbranchqi4_virt_signed"
342 1.3 mrg [(set (pc) (if_then_else
343 1.3 mrg (match_operator 0 "rl78_cmp_operator_signed"
344 1.3 mrg [(match_operand:QI 1 "general_operand" "vim")
345 1.3 mrg (match_operand:QI 2 "nonmemory_operand" "vi")])
346 1.3 mrg (label_ref (match_operand 3 "" ""))
347 1.3 mrg (pc)))]
348 1.3 mrg "rl78_virt_insns_ok ()"
349 1.3 mrg "v.cmp\t%1, %2\\n\tv.b%C0\t%3"
350 1.3 mrg [(set_attr "valloc" "cmp")]
351 1.3 mrg )
352 1.1 mrg
353 1.1 mrg (define_insn "*cbranchqi4_virt"
354 1.1 mrg [(set (pc) (if_then_else
355 1.3 mrg (match_operator 0 "rl78_cmp_operator_real"
356 1.3 mrg [(match_operand:QI 1 "rl78_general_operand" "vim")
357 1.3 mrg (match_operand:QI 2 "rl78_general_operand" "vim")])
358 1.3 mrg (label_ref (match_operand 3 "" ""))
359 1.3 mrg (pc)))]
360 1.3 mrg "rl78_virt_insns_ok ()"
361 1.3 mrg "v.cmp\t%1, %2\\n\tv.b%C0\t%3"
362 1.3 mrg [(set_attr "valloc" "cmp")]
363 1.3 mrg )
364 1.3 mrg
365 1.3 mrg (define_insn "*cbranchhi4_virt_signed"
366 1.3 mrg [(set (pc) (if_then_else
367 1.3 mrg (match_operator 0 "rl78_cmp_operator_signed"
368 1.3 mrg [(match_operand:HI 1 "general_operand" "vim")
369 1.1 mrg (match_operand:HI 2 "nonmemory_operand" "vi")])
370 1.1 mrg (label_ref (match_operand 3 "" ""))
371 1.1 mrg (pc)))]
372 1.3 mrg "rl78_virt_insns_ok ()"
373 1.1 mrg "v.cmpw\t%1, %2\\n\tv.b%C0\t%3"
374 1.1 mrg [(set_attr "valloc" "cmp")]
375 1.1 mrg )
376 1.1 mrg
377 1.1 mrg (define_insn "*cbranchhi4_virt"
378 1.1 mrg [(set (pc) (if_then_else
379 1.3 mrg (match_operator 0 "rl78_cmp_operator_real"
380 1.3 mrg [(match_operand:HI 1 "rl78_general_operand" "vim")
381 1.1 mrg (match_operand:HI 2 "rl78_general_operand" "vim")])
382 1.1 mrg (label_ref (match_operand 3 "" ""))
383 1.1 mrg (pc)))]
384 1.3 mrg "rl78_virt_insns_ok ()"
385 1.1 mrg "v.cmpw\t%1, %2\\n\tv.b%C0\t%3"
386 1.1 mrg [(set_attr "valloc" "cmp")]
387 1.1 mrg )
388 1.3 mrg
389 1.3 mrg (define_insn "*cbranchsi4_virt"
390 1.3 mrg [(set (pc) (if_then_else
391 1.3 mrg (match_operator 0 "rl78_cmp_operator"
392 1.3 mrg [(match_operand:SI 1 "general_operand" "vim")
393 1.3 mrg (match_operand:SI 2 "nonmemory_operand" "vi")])
394 1.3 mrg (label_ref (match_operand 3 "" ""))
395 1.3 mrg (pc)))
396 1.3 mrg (clobber (reg:HI AX_REG))
397 1.3 mrg ]
398 1.3 mrg "rl78_virt_insns_ok ()"
399 1.3 mrg "v.cmpd\t%1, %2\\n\tv.b%C0\t%3"
400 1.3 mrg [(set_attr "valloc" "macax")]
401 1.3 mrg )
402 1.1 mrg
403 1.1 mrg ;;---------- Peepholes ------------------------
404 1.1 mrg
405 1.1 mrg (define_peephole2
406 1.1 mrg [(set (match_operand:QI 0 "" "")
407 1.1 mrg (match_operand:QI 1 "" ""))
408 1.1 mrg (set (match_operand:QI 2 "" "")
409 1.1 mrg (match_operand:QI 3 "" ""))]
410 1.1 mrg "rl78_peep_movhi_p (operands)"
411 1.1 mrg [(set (match_dup 4)
412 1.1 mrg (match_dup 5))]
413 1.1 mrg "rl78_setup_peep_movhi (operands);"
414 1.1 mrg )
415 1.1 mrg
416 1.1 mrg (define_peephole2
417 1.1 mrg [(set (reg:QI A_REG)
418 1.1 mrg (match_operand:QI 1 "" ""))
419 1.1 mrg (set (match_operand:QI 0 "" "")
420 1.1 mrg (reg:QI A_REG))
421 1.1 mrg (set (reg:QI A_REG)
422 1.1 mrg (match_operand:QI 3 "" ""))
423 1.1 mrg (set (match_operand:QI 2 "" "")
424 1.1 mrg (reg:QI A_REG))
425 1.1 mrg ]
426 1.1 mrg "rl78_peep_movhi_p (operands)"
427 1.1 mrg [(set (reg:HI AX_REG)
428 1.1 mrg (match_dup 5))
429 1.1 mrg (set (match_dup 4)
430 1.1 mrg (reg:HI AX_REG))
431 1.1 mrg ]
432 1.1 mrg "rl78_setup_peep_movhi (operands);"
433 1.3 mrg )
434 1.3 mrg
435 1.3 mrg (define_insn "*negandhi3_virt"
436 1.3 mrg [(set (match_operand:HI 0 "register_operand" "=v")
437 1.3 mrg (and:HI (neg:HI (match_operand:HI 1 "register_operand" "0"))
438 1.3 mrg (match_operand:HI 2 "immediate_operand" "n")))
439 1.3 mrg ]
440 1.3 mrg "rl78_virt_insns_ok ()"
441 1.3 mrg "v.nand\t%0, %1, %2"
442 )
443