Commit | Line | Data |
---|---|---|
190659a2 | 1 | /* Simulator instruction semantics for m32rb. |
646c6f2b | 2 | |
190659a2 | 3 | THIS FILE IS MACHINE GENERATED WITH CGEN. |
b8a9943d | 4 | |
9d70630e | 5 | Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. |
646c6f2b | 6 | |
9d70630e | 7 | This file is part of the GNU Simulators. |
646c6f2b DE |
8 | |
9 | This program is free software; you can redistribute it and/or modify | |
10 | it under the terms of the GNU General Public License as published by | |
11 | the Free Software Foundation; either version 2, or (at your option) | |
12 | any later version. | |
13 | ||
14 | This program is distributed in the hope that it will be useful, | |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU General Public License along | |
20 | with this program; if not, write to the Free Software Foundation, Inc., | |
21 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
22 | ||
23 | */ | |
24 | ||
9d70630e | 25 | #define WANT_CPU |
190659a2 | 26 | #define WANT_CPU_M32RB |
9d70630e | 27 | |
646c6f2b | 28 | #include "sim-main.h" |
9d70630e DE |
29 | #include "cgen-mem.h" |
30 | #include "cgen-ops.h" | |
646c6f2b DE |
31 | #include "cpu-sim.h" |
32 | ||
a8981d67 | 33 | #if WITH_SCACHE |
9d70630e DE |
34 | |
35 | #undef GET_ATTR | |
a8981d67 DE |
36 | #define GET_ATTR(cpu, num, attr) CGEN_INSN_ATTR (abuf->idesc->opcode, CGEN_INSN_##attr) |
37 | ||
38 | /* add: add $dr,$sr. */ | |
9d70630e | 39 | |
646c6f2b | 40 | CIA |
190659a2 | 41 | SEM_FN_NAME (m32rb,add) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 42 | { |
970a8fd6 | 43 | #define FLD(f) abuf->fields.fmt_add.f |
646c6f2b | 44 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 45 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 46 | |
190659a2 DE |
47 | { |
48 | SI opval = ADDSI (* FLD (f_r1), * FLD (f_r2)); | |
49 | * FLD (f_r1) = opval; | |
50 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
51 | } | |
b8a9943d | 52 | |
a8981d67 DE |
53 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
54 | ||
646c6f2b DE |
55 | #if WITH_PROFILE_MODEL_P |
56 | if (PROFILE_MODEL_P (current_cpu)) | |
57 | { | |
190659a2 DE |
58 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
59 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
60 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
61 | } |
62 | #endif | |
b8a9943d | 63 | |
646c6f2b DE |
64 | return new_pc; |
65 | #undef FLD | |
66 | } | |
67 | ||
a8981d67 DE |
68 | /* add3: add3 $dr,$sr,$hash$slo16. */ |
69 | ||
646c6f2b | 70 | CIA |
190659a2 | 71 | SEM_FN_NAME (m32rb,add3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 72 | { |
970a8fd6 | 73 | #define FLD(f) abuf->fields.fmt_add3.f |
646c6f2b | 74 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 75 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 76 | |
190659a2 DE |
77 | { |
78 | SI opval = ADDSI (* FLD (f_r2), FLD (f_simm16)); | |
79 | * FLD (f_r1) = opval; | |
80 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
81 | } | |
b8a9943d | 82 | |
a8981d67 DE |
83 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
84 | ||
646c6f2b DE |
85 | #if WITH_PROFILE_MODEL_P |
86 | if (PROFILE_MODEL_P (current_cpu)) | |
87 | { | |
190659a2 DE |
88 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
89 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
90 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
91 | } |
92 | #endif | |
b8a9943d | 93 | |
646c6f2b DE |
94 | return new_pc; |
95 | #undef FLD | |
96 | } | |
97 | ||
a8981d67 DE |
98 | /* and: and $dr,$sr. */ |
99 | ||
646c6f2b | 100 | CIA |
190659a2 | 101 | SEM_FN_NAME (m32rb,and) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 102 | { |
970a8fd6 | 103 | #define FLD(f) abuf->fields.fmt_add.f |
646c6f2b | 104 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 105 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 106 | |
190659a2 DE |
107 | { |
108 | SI opval = ANDSI (* FLD (f_r1), * FLD (f_r2)); | |
109 | * FLD (f_r1) = opval; | |
110 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
111 | } | |
b8a9943d | 112 | |
a8981d67 DE |
113 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
114 | ||
646c6f2b DE |
115 | #if WITH_PROFILE_MODEL_P |
116 | if (PROFILE_MODEL_P (current_cpu)) | |
117 | { | |
190659a2 DE |
118 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
119 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
120 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
121 | } |
122 | #endif | |
b8a9943d | 123 | |
646c6f2b DE |
124 | return new_pc; |
125 | #undef FLD | |
126 | } | |
127 | ||
a8981d67 DE |
128 | /* and3: and3 $dr,$sr,$uimm16. */ |
129 | ||
646c6f2b | 130 | CIA |
190659a2 | 131 | SEM_FN_NAME (m32rb,and3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 132 | { |
970a8fd6 | 133 | #define FLD(f) abuf->fields.fmt_and3.f |
646c6f2b | 134 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 135 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 136 | |
190659a2 DE |
137 | { |
138 | SI opval = ANDSI (* FLD (f_r2), FLD (f_uimm16)); | |
139 | * FLD (f_r1) = opval; | |
140 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
141 | } | |
b8a9943d | 142 | |
a8981d67 DE |
143 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
144 | ||
646c6f2b DE |
145 | #if WITH_PROFILE_MODEL_P |
146 | if (PROFILE_MODEL_P (current_cpu)) | |
147 | { | |
190659a2 DE |
148 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
149 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
150 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
151 | } |
152 | #endif | |
b8a9943d | 153 | |
646c6f2b DE |
154 | return new_pc; |
155 | #undef FLD | |
156 | } | |
157 | ||
a8981d67 DE |
158 | /* or: or $dr,$sr. */ |
159 | ||
646c6f2b | 160 | CIA |
190659a2 | 161 | SEM_FN_NAME (m32rb,or) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 162 | { |
970a8fd6 | 163 | #define FLD(f) abuf->fields.fmt_add.f |
646c6f2b | 164 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 165 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 166 | |
190659a2 DE |
167 | { |
168 | SI opval = ORSI (* FLD (f_r1), * FLD (f_r2)); | |
169 | * FLD (f_r1) = opval; | |
170 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
171 | } | |
b8a9943d | 172 | |
a8981d67 DE |
173 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
174 | ||
646c6f2b DE |
175 | #if WITH_PROFILE_MODEL_P |
176 | if (PROFILE_MODEL_P (current_cpu)) | |
177 | { | |
190659a2 DE |
178 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
179 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
180 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
181 | } |
182 | #endif | |
b8a9943d | 183 | |
646c6f2b DE |
184 | return new_pc; |
185 | #undef FLD | |
186 | } | |
187 | ||
a8981d67 DE |
188 | /* or3: or3 $dr,$sr,$hash$ulo16. */ |
189 | ||
646c6f2b | 190 | CIA |
190659a2 | 191 | SEM_FN_NAME (m32rb,or3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 192 | { |
970a8fd6 | 193 | #define FLD(f) abuf->fields.fmt_or3.f |
646c6f2b | 194 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 195 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 196 | |
190659a2 DE |
197 | { |
198 | SI opval = ORSI (* FLD (f_r2), FLD (f_uimm16)); | |
199 | * FLD (f_r1) = opval; | |
200 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
201 | } | |
b8a9943d | 202 | |
a8981d67 DE |
203 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
204 | ||
646c6f2b DE |
205 | #if WITH_PROFILE_MODEL_P |
206 | if (PROFILE_MODEL_P (current_cpu)) | |
207 | { | |
190659a2 DE |
208 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
209 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
210 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
211 | } |
212 | #endif | |
b8a9943d | 213 | |
646c6f2b DE |
214 | return new_pc; |
215 | #undef FLD | |
216 | } | |
217 | ||
a8981d67 DE |
218 | /* xor: xor $dr,$sr. */ |
219 | ||
646c6f2b | 220 | CIA |
190659a2 | 221 | SEM_FN_NAME (m32rb,xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 222 | { |
970a8fd6 | 223 | #define FLD(f) abuf->fields.fmt_add.f |
646c6f2b | 224 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 225 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 226 | |
190659a2 DE |
227 | { |
228 | SI opval = XORSI (* FLD (f_r1), * FLD (f_r2)); | |
229 | * FLD (f_r1) = opval; | |
230 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
231 | } | |
b8a9943d | 232 | |
a8981d67 DE |
233 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
234 | ||
646c6f2b DE |
235 | #if WITH_PROFILE_MODEL_P |
236 | if (PROFILE_MODEL_P (current_cpu)) | |
237 | { | |
190659a2 DE |
238 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
239 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
240 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
241 | } |
242 | #endif | |
b8a9943d | 243 | |
646c6f2b DE |
244 | return new_pc; |
245 | #undef FLD | |
246 | } | |
247 | ||
a8981d67 DE |
248 | /* xor3: xor3 $dr,$sr,$uimm16. */ |
249 | ||
646c6f2b | 250 | CIA |
190659a2 | 251 | SEM_FN_NAME (m32rb,xor3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 252 | { |
970a8fd6 | 253 | #define FLD(f) abuf->fields.fmt_and3.f |
646c6f2b | 254 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 255 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 256 | |
190659a2 DE |
257 | { |
258 | SI opval = XORSI (* FLD (f_r2), FLD (f_uimm16)); | |
259 | * FLD (f_r1) = opval; | |
260 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
261 | } | |
b8a9943d | 262 | |
a8981d67 DE |
263 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
264 | ||
646c6f2b DE |
265 | #if WITH_PROFILE_MODEL_P |
266 | if (PROFILE_MODEL_P (current_cpu)) | |
267 | { | |
190659a2 DE |
268 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
269 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
270 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
271 | } |
272 | #endif | |
b8a9943d | 273 | |
646c6f2b DE |
274 | return new_pc; |
275 | #undef FLD | |
276 | } | |
277 | ||
a8981d67 DE |
278 | /* addi: addi $dr,$simm8. */ |
279 | ||
646c6f2b | 280 | CIA |
190659a2 | 281 | SEM_FN_NAME (m32rb,addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 282 | { |
970a8fd6 | 283 | #define FLD(f) abuf->fields.fmt_addi.f |
646c6f2b | 284 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 285 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 286 | |
190659a2 DE |
287 | { |
288 | SI opval = ADDSI (* FLD (f_r1), FLD (f_simm8)); | |
289 | * FLD (f_r1) = opval; | |
290 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
291 | } | |
b8a9943d | 292 | |
a8981d67 DE |
293 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
294 | ||
646c6f2b DE |
295 | #if WITH_PROFILE_MODEL_P |
296 | if (PROFILE_MODEL_P (current_cpu)) | |
297 | { | |
190659a2 DE |
298 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
299 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
300 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
301 | } |
302 | #endif | |
b8a9943d | 303 | |
646c6f2b DE |
304 | return new_pc; |
305 | #undef FLD | |
306 | } | |
307 | ||
a8981d67 DE |
308 | /* addv: addv $dr,$sr. */ |
309 | ||
646c6f2b | 310 | CIA |
190659a2 | 311 | SEM_FN_NAME (m32rb,addv) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 312 | { |
970a8fd6 | 313 | #define FLD(f) abuf->fields.fmt_addv.f |
646c6f2b | 314 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 315 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 316 | |
646c6f2b | 317 | do { |
a040908c | 318 | UBI temp1;SI temp0; |
9d70630e DE |
319 | temp0 = ADDSI (* FLD (f_r1), * FLD (f_r2)); |
320 | temp1 = ADDOFSI (* FLD (f_r1), * FLD (f_r2), 0); | |
190659a2 DE |
321 | { |
322 | SI opval = temp0; | |
323 | * FLD (f_r1) = opval; | |
324 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
325 | } | |
326 | { | |
327 | UBI opval = temp1; | |
328 | CPU (h_cond) = opval; | |
329 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
330 | } | |
646c6f2b | 331 | } while (0); |
b8a9943d | 332 | |
a8981d67 DE |
333 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
334 | ||
646c6f2b DE |
335 | #if WITH_PROFILE_MODEL_P |
336 | if (PROFILE_MODEL_P (current_cpu)) | |
337 | { | |
190659a2 DE |
338 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
339 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
340 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
341 | } |
342 | #endif | |
b8a9943d | 343 | |
646c6f2b DE |
344 | return new_pc; |
345 | #undef FLD | |
346 | } | |
347 | ||
a8981d67 DE |
348 | /* addv3: addv3 $dr,$sr,$simm16. */ |
349 | ||
646c6f2b | 350 | CIA |
190659a2 | 351 | SEM_FN_NAME (m32rb,addv3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 352 | { |
970a8fd6 | 353 | #define FLD(f) abuf->fields.fmt_addv3.f |
646c6f2b | 354 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 355 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 356 | |
646c6f2b | 357 | do { |
a040908c | 358 | UBI temp1;SI temp0; |
9d70630e DE |
359 | temp0 = ADDSI (* FLD (f_r2), FLD (f_simm16)); |
360 | temp1 = ADDOFSI (* FLD (f_r2), FLD (f_simm16), 0); | |
190659a2 DE |
361 | { |
362 | SI opval = temp0; | |
363 | * FLD (f_r1) = opval; | |
364 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
365 | } | |
366 | { | |
367 | UBI opval = temp1; | |
368 | CPU (h_cond) = opval; | |
369 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
370 | } | |
646c6f2b | 371 | } while (0); |
b8a9943d | 372 | |
a8981d67 DE |
373 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
374 | ||
646c6f2b DE |
375 | #if WITH_PROFILE_MODEL_P |
376 | if (PROFILE_MODEL_P (current_cpu)) | |
377 | { | |
190659a2 DE |
378 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
379 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
380 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
381 | } |
382 | #endif | |
b8a9943d | 383 | |
646c6f2b DE |
384 | return new_pc; |
385 | #undef FLD | |
386 | } | |
387 | ||
a8981d67 DE |
388 | /* addx: addx $dr,$sr. */ |
389 | ||
646c6f2b | 390 | CIA |
190659a2 | 391 | SEM_FN_NAME (m32rb,addx) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 392 | { |
970a8fd6 | 393 | #define FLD(f) abuf->fields.fmt_addx.f |
646c6f2b | 394 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 395 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 396 | |
646c6f2b | 397 | do { |
a040908c | 398 | UBI temp1;SI temp0; |
9d70630e DE |
399 | temp0 = ADDCSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond)); |
400 | temp1 = ADDCFSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond)); | |
190659a2 DE |
401 | { |
402 | SI opval = temp0; | |
403 | * FLD (f_r1) = opval; | |
404 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
405 | } | |
406 | { | |
407 | UBI opval = temp1; | |
408 | CPU (h_cond) = opval; | |
409 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
410 | } | |
646c6f2b | 411 | } while (0); |
b8a9943d | 412 | |
a8981d67 DE |
413 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
414 | ||
646c6f2b DE |
415 | #if WITH_PROFILE_MODEL_P |
416 | if (PROFILE_MODEL_P (current_cpu)) | |
417 | { | |
190659a2 DE |
418 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
419 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
420 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
421 | } |
422 | #endif | |
b8a9943d | 423 | |
646c6f2b DE |
424 | return new_pc; |
425 | #undef FLD | |
426 | } | |
427 | ||
a8981d67 DE |
428 | /* bc8: bc.s $disp8. */ |
429 | ||
646c6f2b | 430 | CIA |
190659a2 | 431 | SEM_FN_NAME (m32rb,bc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 432 | { |
970a8fd6 | 433 | #define FLD(f) abuf->fields.fmt_bc8.f |
646c6f2b | 434 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 435 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
646c6f2b | 436 | int taken_p = 0; |
b8a9943d | 437 | |
9d70630e | 438 | if (CPU (h_cond)) { |
190659a2 DE |
439 | { |
440 | USI opval = FLD (f_disp8); | |
441 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval)); | |
442 | taken_p = 1; | |
443 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
444 | } | |
646c6f2b | 445 | } |
b8a9943d | 446 | |
a8981d67 DE |
447 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
448 | ||
646c6f2b DE |
449 | #if WITH_PROFILE_MODEL_P |
450 | if (PROFILE_MODEL_P (current_cpu)) | |
451 | { | |
190659a2 | 452 | m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
453 | } |
454 | #endif | |
b8a9943d | 455 | |
646c6f2b DE |
456 | return new_pc; |
457 | #undef FLD | |
458 | } | |
459 | ||
a8981d67 DE |
460 | /* bc24: bc.l $disp24. */ |
461 | ||
646c6f2b | 462 | CIA |
190659a2 | 463 | SEM_FN_NAME (m32rb,bc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 464 | { |
970a8fd6 | 465 | #define FLD(f) abuf->fields.fmt_bc24.f |
646c6f2b | 466 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 467 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 468 | int taken_p = 0; |
b8a9943d | 469 | |
9d70630e | 470 | if (CPU (h_cond)) { |
190659a2 DE |
471 | { |
472 | USI opval = FLD (f_disp24); | |
473 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval)); | |
474 | taken_p = 1; | |
475 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
476 | } | |
646c6f2b | 477 | } |
b8a9943d | 478 | |
a8981d67 DE |
479 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
480 | ||
646c6f2b DE |
481 | #if WITH_PROFILE_MODEL_P |
482 | if (PROFILE_MODEL_P (current_cpu)) | |
483 | { | |
190659a2 | 484 | m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
485 | } |
486 | #endif | |
b8a9943d | 487 | |
646c6f2b DE |
488 | return new_pc; |
489 | #undef FLD | |
490 | } | |
491 | ||
a8981d67 DE |
492 | /* beq: beq $src1,$src2,$disp16. */ |
493 | ||
646c6f2b | 494 | CIA |
190659a2 | 495 | SEM_FN_NAME (m32rb,beq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 496 | { |
970a8fd6 | 497 | #define FLD(f) abuf->fields.fmt_beq.f |
646c6f2b | 498 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 499 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 500 | int taken_p = 0; |
b8a9943d | 501 | |
9d70630e | 502 | if (EQSI (* FLD (f_r1), * FLD (f_r2))) { |
190659a2 DE |
503 | { |
504 | USI opval = FLD (f_disp16); | |
505 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval)); | |
506 | taken_p = 1; | |
507 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
508 | } | |
646c6f2b | 509 | } |
b8a9943d | 510 | |
a8981d67 DE |
511 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
512 | ||
646c6f2b DE |
513 | #if WITH_PROFILE_MODEL_P |
514 | if (PROFILE_MODEL_P (current_cpu)) | |
515 | { | |
190659a2 DE |
516 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
517 | m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
646c6f2b DE |
518 | } |
519 | #endif | |
b8a9943d | 520 | |
646c6f2b DE |
521 | return new_pc; |
522 | #undef FLD | |
523 | } | |
524 | ||
a8981d67 DE |
525 | /* beqz: beqz $src2,$disp16. */ |
526 | ||
646c6f2b | 527 | CIA |
190659a2 | 528 | SEM_FN_NAME (m32rb,beqz) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 529 | { |
970a8fd6 | 530 | #define FLD(f) abuf->fields.fmt_beqz.f |
646c6f2b | 531 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 532 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 533 | int taken_p = 0; |
b8a9943d | 534 | |
9d70630e | 535 | if (EQSI (* FLD (f_r2), 0)) { |
190659a2 DE |
536 | { |
537 | USI opval = FLD (f_disp16); | |
538 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval)); | |
539 | taken_p = 1; | |
540 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
541 | } | |
646c6f2b | 542 | } |
b8a9943d | 543 | |
a8981d67 DE |
544 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
545 | ||
646c6f2b DE |
546 | #if WITH_PROFILE_MODEL_P |
547 | if (PROFILE_MODEL_P (current_cpu)) | |
548 | { | |
190659a2 DE |
549 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
550 | m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
646c6f2b DE |
551 | } |
552 | #endif | |
b8a9943d | 553 | |
646c6f2b DE |
554 | return new_pc; |
555 | #undef FLD | |
556 | } | |
557 | ||
a8981d67 DE |
558 | /* bgez: bgez $src2,$disp16. */ |
559 | ||
646c6f2b | 560 | CIA |
190659a2 | 561 | SEM_FN_NAME (m32rb,bgez) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 562 | { |
970a8fd6 | 563 | #define FLD(f) abuf->fields.fmt_beqz.f |
646c6f2b | 564 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 565 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 566 | int taken_p = 0; |
b8a9943d | 567 | |
9d70630e | 568 | if (GESI (* FLD (f_r2), 0)) { |
190659a2 DE |
569 | { |
570 | USI opval = FLD (f_disp16); | |
571 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval)); | |
572 | taken_p = 1; | |
573 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
574 | } | |
646c6f2b | 575 | } |
b8a9943d | 576 | |
a8981d67 DE |
577 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
578 | ||
646c6f2b DE |
579 | #if WITH_PROFILE_MODEL_P |
580 | if (PROFILE_MODEL_P (current_cpu)) | |
581 | { | |
190659a2 DE |
582 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
583 | m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
646c6f2b DE |
584 | } |
585 | #endif | |
b8a9943d | 586 | |
646c6f2b DE |
587 | return new_pc; |
588 | #undef FLD | |
589 | } | |
590 | ||
a8981d67 DE |
591 | /* bgtz: bgtz $src2,$disp16. */ |
592 | ||
646c6f2b | 593 | CIA |
190659a2 | 594 | SEM_FN_NAME (m32rb,bgtz) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 595 | { |
970a8fd6 | 596 | #define FLD(f) abuf->fields.fmt_beqz.f |
646c6f2b | 597 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 598 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 599 | int taken_p = 0; |
b8a9943d | 600 | |
9d70630e | 601 | if (GTSI (* FLD (f_r2), 0)) { |
190659a2 DE |
602 | { |
603 | USI opval = FLD (f_disp16); | |
604 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval)); | |
605 | taken_p = 1; | |
606 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
607 | } | |
646c6f2b | 608 | } |
b8a9943d | 609 | |
a8981d67 DE |
610 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
611 | ||
646c6f2b DE |
612 | #if WITH_PROFILE_MODEL_P |
613 | if (PROFILE_MODEL_P (current_cpu)) | |
614 | { | |
190659a2 DE |
615 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
616 | m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
646c6f2b DE |
617 | } |
618 | #endif | |
b8a9943d | 619 | |
646c6f2b DE |
620 | return new_pc; |
621 | #undef FLD | |
622 | } | |
623 | ||
a8981d67 DE |
624 | /* blez: blez $src2,$disp16. */ |
625 | ||
646c6f2b | 626 | CIA |
190659a2 | 627 | SEM_FN_NAME (m32rb,blez) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 628 | { |
970a8fd6 | 629 | #define FLD(f) abuf->fields.fmt_beqz.f |
646c6f2b | 630 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 631 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 632 | int taken_p = 0; |
b8a9943d | 633 | |
9d70630e | 634 | if (LESI (* FLD (f_r2), 0)) { |
190659a2 DE |
635 | { |
636 | USI opval = FLD (f_disp16); | |
637 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval)); | |
638 | taken_p = 1; | |
639 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
640 | } | |
646c6f2b | 641 | } |
b8a9943d | 642 | |
a8981d67 DE |
643 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
644 | ||
646c6f2b DE |
645 | #if WITH_PROFILE_MODEL_P |
646 | if (PROFILE_MODEL_P (current_cpu)) | |
647 | { | |
190659a2 DE |
648 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
649 | m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
646c6f2b DE |
650 | } |
651 | #endif | |
b8a9943d | 652 | |
646c6f2b DE |
653 | return new_pc; |
654 | #undef FLD | |
655 | } | |
656 | ||
a8981d67 DE |
657 | /* bltz: bltz $src2,$disp16. */ |
658 | ||
646c6f2b | 659 | CIA |
190659a2 | 660 | SEM_FN_NAME (m32rb,bltz) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 661 | { |
970a8fd6 | 662 | #define FLD(f) abuf->fields.fmt_beqz.f |
646c6f2b | 663 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 664 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 665 | int taken_p = 0; |
b8a9943d | 666 | |
9d70630e | 667 | if (LTSI (* FLD (f_r2), 0)) { |
190659a2 DE |
668 | { |
669 | USI opval = FLD (f_disp16); | |
670 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval)); | |
671 | taken_p = 1; | |
672 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
673 | } | |
646c6f2b | 674 | } |
b8a9943d | 675 | |
a8981d67 DE |
676 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
677 | ||
646c6f2b DE |
678 | #if WITH_PROFILE_MODEL_P |
679 | if (PROFILE_MODEL_P (current_cpu)) | |
680 | { | |
190659a2 DE |
681 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
682 | m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
646c6f2b DE |
683 | } |
684 | #endif | |
b8a9943d | 685 | |
646c6f2b DE |
686 | return new_pc; |
687 | #undef FLD | |
688 | } | |
689 | ||
a8981d67 DE |
690 | /* bnez: bnez $src2,$disp16. */ |
691 | ||
646c6f2b | 692 | CIA |
190659a2 | 693 | SEM_FN_NAME (m32rb,bnez) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 694 | { |
970a8fd6 | 695 | #define FLD(f) abuf->fields.fmt_beqz.f |
646c6f2b | 696 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 697 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 698 | int taken_p = 0; |
b8a9943d | 699 | |
9d70630e | 700 | if (NESI (* FLD (f_r2), 0)) { |
190659a2 DE |
701 | { |
702 | USI opval = FLD (f_disp16); | |
703 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval)); | |
704 | taken_p = 1; | |
705 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
706 | } | |
646c6f2b | 707 | } |
b8a9943d | 708 | |
a8981d67 DE |
709 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
710 | ||
646c6f2b DE |
711 | #if WITH_PROFILE_MODEL_P |
712 | if (PROFILE_MODEL_P (current_cpu)) | |
713 | { | |
190659a2 DE |
714 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
715 | m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
646c6f2b DE |
716 | } |
717 | #endif | |
b8a9943d | 718 | |
646c6f2b DE |
719 | return new_pc; |
720 | #undef FLD | |
721 | } | |
722 | ||
a8981d67 DE |
723 | /* bl8: bl.s $disp8. */ |
724 | ||
646c6f2b | 725 | CIA |
190659a2 | 726 | SEM_FN_NAME (m32rb,bl8) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 727 | { |
970a8fd6 | 728 | #define FLD(f) abuf->fields.fmt_bl8.f |
646c6f2b | 729 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 730 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
646c6f2b | 731 | int taken_p = 0; |
b8a9943d | 732 | |
9d70630e | 733 | do { |
190659a2 DE |
734 | { |
735 | SI opval = ADDSI (ANDSI (CPU (h_pc), -4), 4); | |
736 | CPU (h_gr[((HOSTUINT) 14)]) = opval; | |
737 | TRACE_RESULT (current_cpu, "gr-14", 'x', opval); | |
738 | } | |
739 | { | |
740 | USI opval = FLD (f_disp8); | |
741 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval)); | |
742 | taken_p = 1; | |
743 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
744 | } | |
9d70630e | 745 | } while (0); |
b8a9943d | 746 | |
a8981d67 DE |
747 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
748 | ||
646c6f2b DE |
749 | #if WITH_PROFILE_MODEL_P |
750 | if (PROFILE_MODEL_P (current_cpu)) | |
751 | { | |
190659a2 DE |
752 | m32rb_model_mark_set_h_gr (current_cpu, abuf); |
753 | m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
646c6f2b DE |
754 | } |
755 | #endif | |
b8a9943d | 756 | |
646c6f2b DE |
757 | return new_pc; |
758 | #undef FLD | |
759 | } | |
760 | ||
a8981d67 DE |
761 | /* bl24: bl.l $disp24. */ |
762 | ||
646c6f2b | 763 | CIA |
190659a2 | 764 | SEM_FN_NAME (m32rb,bl24) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 765 | { |
970a8fd6 | 766 | #define FLD(f) abuf->fields.fmt_bl24.f |
646c6f2b | 767 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 768 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 769 | int taken_p = 0; |
b8a9943d | 770 | |
9d70630e | 771 | do { |
190659a2 DE |
772 | { |
773 | SI opval = ADDSI (CPU (h_pc), 4); | |
774 | CPU (h_gr[((HOSTUINT) 14)]) = opval; | |
775 | TRACE_RESULT (current_cpu, "gr-14", 'x', opval); | |
776 | } | |
777 | { | |
778 | USI opval = FLD (f_disp24); | |
779 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval)); | |
780 | taken_p = 1; | |
781 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
782 | } | |
9d70630e | 783 | } while (0); |
b8a9943d | 784 | |
a8981d67 DE |
785 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
786 | ||
646c6f2b DE |
787 | #if WITH_PROFILE_MODEL_P |
788 | if (PROFILE_MODEL_P (current_cpu)) | |
789 | { | |
190659a2 DE |
790 | m32rb_model_mark_set_h_gr (current_cpu, abuf); |
791 | m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
646c6f2b DE |
792 | } |
793 | #endif | |
b8a9943d | 794 | |
646c6f2b DE |
795 | return new_pc; |
796 | #undef FLD | |
797 | } | |
798 | ||
a8981d67 DE |
799 | /* bnc8: bnc.s $disp8. */ |
800 | ||
646c6f2b | 801 | CIA |
190659a2 | 802 | SEM_FN_NAME (m32rb,bnc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 803 | { |
970a8fd6 | 804 | #define FLD(f) abuf->fields.fmt_bc8.f |
646c6f2b | 805 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 806 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
646c6f2b | 807 | int taken_p = 0; |
b8a9943d | 808 | |
9d70630e | 809 | if (NOTBI (CPU (h_cond))) { |
190659a2 DE |
810 | { |
811 | USI opval = FLD (f_disp8); | |
812 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval)); | |
813 | taken_p = 1; | |
814 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
815 | } | |
646c6f2b | 816 | } |
b8a9943d | 817 | |
a8981d67 DE |
818 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
819 | ||
646c6f2b DE |
820 | #if WITH_PROFILE_MODEL_P |
821 | if (PROFILE_MODEL_P (current_cpu)) | |
822 | { | |
190659a2 | 823 | m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
824 | } |
825 | #endif | |
b8a9943d | 826 | |
646c6f2b DE |
827 | return new_pc; |
828 | #undef FLD | |
829 | } | |
830 | ||
a8981d67 DE |
831 | /* bnc24: bnc.l $disp24. */ |
832 | ||
646c6f2b | 833 | CIA |
190659a2 | 834 | SEM_FN_NAME (m32rb,bnc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 835 | { |
970a8fd6 | 836 | #define FLD(f) abuf->fields.fmt_bc24.f |
646c6f2b | 837 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 838 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 839 | int taken_p = 0; |
b8a9943d | 840 | |
9d70630e | 841 | if (NOTBI (CPU (h_cond))) { |
190659a2 DE |
842 | { |
843 | USI opval = FLD (f_disp24); | |
844 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval)); | |
845 | taken_p = 1; | |
846 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
847 | } | |
646c6f2b | 848 | } |
b8a9943d | 849 | |
a8981d67 DE |
850 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
851 | ||
646c6f2b DE |
852 | #if WITH_PROFILE_MODEL_P |
853 | if (PROFILE_MODEL_P (current_cpu)) | |
854 | { | |
190659a2 | 855 | m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
856 | } |
857 | #endif | |
b8a9943d | 858 | |
646c6f2b DE |
859 | return new_pc; |
860 | #undef FLD | |
861 | } | |
862 | ||
a8981d67 DE |
863 | /* bne: bne $src1,$src2,$disp16. */ |
864 | ||
646c6f2b | 865 | CIA |
190659a2 | 866 | SEM_FN_NAME (m32rb,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 867 | { |
970a8fd6 | 868 | #define FLD(f) abuf->fields.fmt_beq.f |
646c6f2b | 869 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 870 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 871 | int taken_p = 0; |
b8a9943d | 872 | |
9d70630e | 873 | if (NESI (* FLD (f_r1), * FLD (f_r2))) { |
190659a2 DE |
874 | { |
875 | USI opval = FLD (f_disp16); | |
876 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval)); | |
877 | taken_p = 1; | |
878 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
879 | } | |
646c6f2b | 880 | } |
b8a9943d | 881 | |
a8981d67 DE |
882 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
883 | ||
646c6f2b DE |
884 | #if WITH_PROFILE_MODEL_P |
885 | if (PROFILE_MODEL_P (current_cpu)) | |
886 | { | |
190659a2 DE |
887 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
888 | m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
646c6f2b DE |
889 | } |
890 | #endif | |
b8a9943d | 891 | |
646c6f2b DE |
892 | return new_pc; |
893 | #undef FLD | |
894 | } | |
895 | ||
a8981d67 DE |
896 | /* bra8: bra.s $disp8. */ |
897 | ||
646c6f2b | 898 | CIA |
190659a2 | 899 | SEM_FN_NAME (m32rb,bra8) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 900 | { |
970a8fd6 | 901 | #define FLD(f) abuf->fields.fmt_bra8.f |
646c6f2b | 902 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 903 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
646c6f2b | 904 | int taken_p = 0; |
b8a9943d | 905 | |
190659a2 DE |
906 | { |
907 | USI opval = FLD (f_disp8); | |
908 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval)); | |
909 | taken_p = 1; | |
910 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
911 | } | |
a8981d67 DE |
912 | |
913 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); | |
b8a9943d | 914 | |
646c6f2b DE |
915 | #if WITH_PROFILE_MODEL_P |
916 | if (PROFILE_MODEL_P (current_cpu)) | |
917 | { | |
190659a2 | 918 | m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
919 | } |
920 | #endif | |
b8a9943d | 921 | |
646c6f2b DE |
922 | return new_pc; |
923 | #undef FLD | |
924 | } | |
925 | ||
a8981d67 DE |
926 | /* bra24: bra.l $disp24. */ |
927 | ||
646c6f2b | 928 | CIA |
190659a2 | 929 | SEM_FN_NAME (m32rb,bra24) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 930 | { |
970a8fd6 | 931 | #define FLD(f) abuf->fields.fmt_bra24.f |
646c6f2b | 932 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 933 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 934 | int taken_p = 0; |
b8a9943d | 935 | |
190659a2 DE |
936 | { |
937 | USI opval = FLD (f_disp24); | |
938 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval)); | |
939 | taken_p = 1; | |
940 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
941 | } | |
a8981d67 DE |
942 | |
943 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); | |
b8a9943d | 944 | |
646c6f2b DE |
945 | #if WITH_PROFILE_MODEL_P |
946 | if (PROFILE_MODEL_P (current_cpu)) | |
947 | { | |
190659a2 | 948 | m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
949 | } |
950 | #endif | |
b8a9943d | 951 | |
646c6f2b DE |
952 | return new_pc; |
953 | #undef FLD | |
954 | } | |
955 | ||
a8981d67 DE |
956 | /* cmp: cmp $src1,$src2. */ |
957 | ||
646c6f2b | 958 | CIA |
190659a2 | 959 | SEM_FN_NAME (m32rb,cmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 960 | { |
970a8fd6 | 961 | #define FLD(f) abuf->fields.fmt_cmp.f |
646c6f2b | 962 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 963 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 964 | |
190659a2 DE |
965 | { |
966 | UBI opval = LTSI (* FLD (f_r1), * FLD (f_r2)); | |
967 | CPU (h_cond) = opval; | |
968 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
969 | } | |
b8a9943d | 970 | |
a8981d67 DE |
971 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
972 | ||
646c6f2b DE |
973 | #if WITH_PROFILE_MODEL_P |
974 | if (PROFILE_MODEL_P (current_cpu)) | |
975 | { | |
190659a2 DE |
976 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
977 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
978 | } |
979 | #endif | |
b8a9943d | 980 | |
646c6f2b DE |
981 | return new_pc; |
982 | #undef FLD | |
983 | } | |
984 | ||
a8981d67 DE |
985 | /* cmpi: cmpi $src2,$simm16. */ |
986 | ||
646c6f2b | 987 | CIA |
190659a2 | 988 | SEM_FN_NAME (m32rb,cmpi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 989 | { |
970a8fd6 | 990 | #define FLD(f) abuf->fields.fmt_cmpi.f |
646c6f2b | 991 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 992 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 993 | |
190659a2 DE |
994 | { |
995 | UBI opval = LTSI (* FLD (f_r2), FLD (f_simm16)); | |
996 | CPU (h_cond) = opval; | |
997 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
998 | } | |
b8a9943d | 999 | |
a8981d67 DE |
1000 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1001 | ||
646c6f2b DE |
1002 | #if WITH_PROFILE_MODEL_P |
1003 | if (PROFILE_MODEL_P (current_cpu)) | |
1004 | { | |
190659a2 DE |
1005 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1006 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1007 | } |
1008 | #endif | |
b8a9943d | 1009 | |
646c6f2b DE |
1010 | return new_pc; |
1011 | #undef FLD | |
1012 | } | |
1013 | ||
a8981d67 DE |
1014 | /* cmpu: cmpu $src1,$src2. */ |
1015 | ||
646c6f2b | 1016 | CIA |
190659a2 | 1017 | SEM_FN_NAME (m32rb,cmpu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1018 | { |
970a8fd6 | 1019 | #define FLD(f) abuf->fields.fmt_cmp.f |
646c6f2b | 1020 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1021 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1022 | |
190659a2 DE |
1023 | { |
1024 | UBI opval = LTUSI (* FLD (f_r1), * FLD (f_r2)); | |
1025 | CPU (h_cond) = opval; | |
1026 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
1027 | } | |
b8a9943d | 1028 | |
a8981d67 DE |
1029 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1030 | ||
646c6f2b DE |
1031 | #if WITH_PROFILE_MODEL_P |
1032 | if (PROFILE_MODEL_P (current_cpu)) | |
1033 | { | |
190659a2 DE |
1034 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1035 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1036 | } |
1037 | #endif | |
b8a9943d | 1038 | |
646c6f2b DE |
1039 | return new_pc; |
1040 | #undef FLD | |
1041 | } | |
1042 | ||
a8981d67 DE |
1043 | /* cmpui: cmpui $src2,$simm16. */ |
1044 | ||
646c6f2b | 1045 | CIA |
190659a2 | 1046 | SEM_FN_NAME (m32rb,cmpui) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1047 | { |
970a8fd6 | 1048 | #define FLD(f) abuf->fields.fmt_cmpi.f |
646c6f2b | 1049 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1050 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 1051 | |
190659a2 DE |
1052 | { |
1053 | UBI opval = LTUSI (* FLD (f_r2), FLD (f_simm16)); | |
1054 | CPU (h_cond) = opval; | |
1055 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
1056 | } | |
b8a9943d | 1057 | |
a8981d67 DE |
1058 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1059 | ||
646c6f2b DE |
1060 | #if WITH_PROFILE_MODEL_P |
1061 | if (PROFILE_MODEL_P (current_cpu)) | |
1062 | { | |
190659a2 DE |
1063 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1064 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1065 | } |
1066 | #endif | |
b8a9943d | 1067 | |
646c6f2b DE |
1068 | return new_pc; |
1069 | #undef FLD | |
1070 | } | |
1071 | ||
a8981d67 DE |
1072 | /* div: div $dr,$sr. */ |
1073 | ||
646c6f2b | 1074 | CIA |
190659a2 | 1075 | SEM_FN_NAME (m32rb,div) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1076 | { |
970a8fd6 | 1077 | #define FLD(f) abuf->fields.fmt_div.f |
646c6f2b | 1078 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1079 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 1080 | |
9d70630e | 1081 | if (NESI (* FLD (f_r2), 0)) { |
190659a2 DE |
1082 | { |
1083 | SI opval = DIVSI (* FLD (f_r1), * FLD (f_r2)); | |
1084 | * FLD (f_r1) = opval; | |
1085 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1086 | } | |
646c6f2b | 1087 | } |
b8a9943d | 1088 | |
a8981d67 DE |
1089 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1090 | ||
646c6f2b DE |
1091 | #if WITH_PROFILE_MODEL_P |
1092 | if (PROFILE_MODEL_P (current_cpu)) | |
1093 | { | |
190659a2 DE |
1094 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1095 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
1096 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1097 | } |
1098 | #endif | |
b8a9943d | 1099 | |
646c6f2b DE |
1100 | return new_pc; |
1101 | #undef FLD | |
1102 | } | |
1103 | ||
a8981d67 DE |
1104 | /* divu: divu $dr,$sr. */ |
1105 | ||
646c6f2b | 1106 | CIA |
190659a2 | 1107 | SEM_FN_NAME (m32rb,divu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1108 | { |
970a8fd6 | 1109 | #define FLD(f) abuf->fields.fmt_div.f |
646c6f2b | 1110 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1111 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 1112 | |
9d70630e | 1113 | if (NESI (* FLD (f_r2), 0)) { |
190659a2 DE |
1114 | { |
1115 | SI opval = UDIVSI (* FLD (f_r1), * FLD (f_r2)); | |
1116 | * FLD (f_r1) = opval; | |
1117 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1118 | } | |
646c6f2b | 1119 | } |
b8a9943d | 1120 | |
a8981d67 DE |
1121 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1122 | ||
646c6f2b DE |
1123 | #if WITH_PROFILE_MODEL_P |
1124 | if (PROFILE_MODEL_P (current_cpu)) | |
1125 | { | |
190659a2 DE |
1126 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1127 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
1128 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1129 | } |
1130 | #endif | |
b8a9943d | 1131 | |
646c6f2b DE |
1132 | return new_pc; |
1133 | #undef FLD | |
1134 | } | |
1135 | ||
a8981d67 DE |
1136 | /* rem: rem $dr,$sr. */ |
1137 | ||
646c6f2b | 1138 | CIA |
190659a2 | 1139 | SEM_FN_NAME (m32rb,rem) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1140 | { |
970a8fd6 | 1141 | #define FLD(f) abuf->fields.fmt_div.f |
646c6f2b | 1142 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1143 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 1144 | |
9d70630e | 1145 | if (NESI (* FLD (f_r2), 0)) { |
190659a2 DE |
1146 | { |
1147 | SI opval = MODSI (* FLD (f_r1), * FLD (f_r2)); | |
1148 | * FLD (f_r1) = opval; | |
1149 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1150 | } | |
646c6f2b | 1151 | } |
b8a9943d | 1152 | |
a8981d67 DE |
1153 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1154 | ||
646c6f2b DE |
1155 | #if WITH_PROFILE_MODEL_P |
1156 | if (PROFILE_MODEL_P (current_cpu)) | |
1157 | { | |
190659a2 DE |
1158 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1159 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
1160 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1161 | } |
1162 | #endif | |
b8a9943d | 1163 | |
646c6f2b DE |
1164 | return new_pc; |
1165 | #undef FLD | |
1166 | } | |
1167 | ||
a8981d67 DE |
1168 | /* remu: remu $dr,$sr. */ |
1169 | ||
646c6f2b | 1170 | CIA |
190659a2 | 1171 | SEM_FN_NAME (m32rb,remu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1172 | { |
970a8fd6 | 1173 | #define FLD(f) abuf->fields.fmt_div.f |
646c6f2b | 1174 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1175 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 1176 | |
9d70630e | 1177 | if (NESI (* FLD (f_r2), 0)) { |
190659a2 DE |
1178 | { |
1179 | SI opval = UMODSI (* FLD (f_r1), * FLD (f_r2)); | |
1180 | * FLD (f_r1) = opval; | |
1181 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1182 | } | |
646c6f2b | 1183 | } |
b8a9943d | 1184 | |
a8981d67 DE |
1185 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1186 | ||
646c6f2b DE |
1187 | #if WITH_PROFILE_MODEL_P |
1188 | if (PROFILE_MODEL_P (current_cpu)) | |
1189 | { | |
190659a2 DE |
1190 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1191 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
1192 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1193 | } |
1194 | #endif | |
b8a9943d | 1195 | |
646c6f2b DE |
1196 | return new_pc; |
1197 | #undef FLD | |
1198 | } | |
1199 | ||
a8981d67 DE |
1200 | /* jl: jl $sr. */ |
1201 | ||
646c6f2b | 1202 | CIA |
190659a2 | 1203 | SEM_FN_NAME (m32rb,jl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1204 | { |
970a8fd6 | 1205 | #define FLD(f) abuf->fields.fmt_jl.f |
646c6f2b | 1206 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1207 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
646c6f2b | 1208 | int taken_p = 0; |
b8a9943d | 1209 | |
646c6f2b | 1210 | do { |
a040908c | 1211 | USI temp1;SI temp0; |
9d70630e | 1212 | temp0 = ADDSI (ANDSI (CPU (h_pc), -4), 4); |
a040908c | 1213 | temp1 = ANDSI (* FLD (f_r2), -4); |
190659a2 DE |
1214 | { |
1215 | SI opval = temp0; | |
1216 | CPU (h_gr[((HOSTUINT) 14)]) = opval; | |
1217 | TRACE_RESULT (current_cpu, "gr-14", 'x', opval); | |
1218 | } | |
1219 | { | |
1220 | USI opval = temp1; | |
1221 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
1222 | taken_p = 1; | |
1223 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
1224 | } | |
646c6f2b | 1225 | } while (0); |
b8a9943d | 1226 | |
a8981d67 DE |
1227 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1228 | ||
646c6f2b DE |
1229 | #if WITH_PROFILE_MODEL_P |
1230 | if (PROFILE_MODEL_P (current_cpu)) | |
1231 | { | |
190659a2 DE |
1232 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1233 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
1234 | m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
646c6f2b DE |
1235 | } |
1236 | #endif | |
b8a9943d | 1237 | |
646c6f2b DE |
1238 | return new_pc; |
1239 | #undef FLD | |
1240 | } | |
1241 | ||
a8981d67 DE |
1242 | /* jmp: jmp $sr. */ |
1243 | ||
646c6f2b | 1244 | CIA |
190659a2 | 1245 | SEM_FN_NAME (m32rb,jmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1246 | { |
970a8fd6 | 1247 | #define FLD(f) abuf->fields.fmt_jmp.f |
646c6f2b | 1248 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1249 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
646c6f2b | 1250 | int taken_p = 0; |
b8a9943d | 1251 | |
190659a2 DE |
1252 | { |
1253 | USI opval = ANDSI (* FLD (f_r2), -4); | |
1254 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
1255 | taken_p = 1; | |
1256 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
1257 | } | |
a8981d67 DE |
1258 | |
1259 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); | |
b8a9943d | 1260 | |
646c6f2b DE |
1261 | #if WITH_PROFILE_MODEL_P |
1262 | if (PROFILE_MODEL_P (current_cpu)) | |
1263 | { | |
190659a2 DE |
1264 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1265 | m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
646c6f2b DE |
1266 | } |
1267 | #endif | |
b8a9943d | 1268 | |
646c6f2b DE |
1269 | return new_pc; |
1270 | #undef FLD | |
1271 | } | |
1272 | ||
a8981d67 DE |
1273 | /* ld: ld $dr,@$sr. */ |
1274 | ||
646c6f2b | 1275 | CIA |
190659a2 | 1276 | SEM_FN_NAME (m32rb,ld) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1277 | { |
970a8fd6 | 1278 | #define FLD(f) abuf->fields.fmt_ld.f |
646c6f2b | 1279 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1280 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1281 | |
190659a2 DE |
1282 | { |
1283 | SI opval = GETMEMSI (current_cpu, * FLD (f_r2)); | |
1284 | * FLD (f_r1) = opval; | |
1285 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1286 | } | |
b8a9943d | 1287 | |
a8981d67 DE |
1288 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1289 | ||
646c6f2b DE |
1290 | #if WITH_PROFILE_MODEL_P |
1291 | if (PROFILE_MODEL_P (current_cpu)) | |
1292 | { | |
190659a2 DE |
1293 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1294 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
1295 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1296 | } |
1297 | #endif | |
b8a9943d | 1298 | |
646c6f2b DE |
1299 | return new_pc; |
1300 | #undef FLD | |
1301 | } | |
1302 | ||
a8981d67 DE |
1303 | /* ld-d: ld $dr,@($slo16,$sr). */ |
1304 | ||
646c6f2b | 1305 | CIA |
190659a2 | 1306 | SEM_FN_NAME (m32rb,ld_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1307 | { |
970a8fd6 | 1308 | #define FLD(f) abuf->fields.fmt_ld_d.f |
646c6f2b | 1309 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1310 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 1311 | |
190659a2 DE |
1312 | { |
1313 | SI opval = GETMEMSI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))); | |
1314 | * FLD (f_r1) = opval; | |
1315 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1316 | } | |
b8a9943d | 1317 | |
a8981d67 DE |
1318 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1319 | ||
646c6f2b DE |
1320 | #if WITH_PROFILE_MODEL_P |
1321 | if (PROFILE_MODEL_P (current_cpu)) | |
1322 | { | |
190659a2 DE |
1323 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1324 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
1325 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1326 | } |
1327 | #endif | |
b8a9943d | 1328 | |
646c6f2b DE |
1329 | return new_pc; |
1330 | #undef FLD | |
1331 | } | |
1332 | ||
a8981d67 DE |
1333 | /* ldb: ldb $dr,@$sr. */ |
1334 | ||
646c6f2b | 1335 | CIA |
190659a2 | 1336 | SEM_FN_NAME (m32rb,ldb) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1337 | { |
970a8fd6 | 1338 | #define FLD(f) abuf->fields.fmt_ldb.f |
646c6f2b | 1339 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1340 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1341 | |
190659a2 DE |
1342 | { |
1343 | SI opval = EXTQISI (GETMEMQI (current_cpu, * FLD (f_r2))); | |
1344 | * FLD (f_r1) = opval; | |
1345 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1346 | } | |
b8a9943d | 1347 | |
a8981d67 DE |
1348 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1349 | ||
646c6f2b DE |
1350 | #if WITH_PROFILE_MODEL_P |
1351 | if (PROFILE_MODEL_P (current_cpu)) | |
1352 | { | |
190659a2 DE |
1353 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1354 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
1355 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1356 | } |
1357 | #endif | |
b8a9943d | 1358 | |
646c6f2b DE |
1359 | return new_pc; |
1360 | #undef FLD | |
1361 | } | |
1362 | ||
a8981d67 DE |
1363 | /* ldb-d: ldb $dr,@($slo16,$sr). */ |
1364 | ||
646c6f2b | 1365 | CIA |
190659a2 | 1366 | SEM_FN_NAME (m32rb,ldb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1367 | { |
970a8fd6 | 1368 | #define FLD(f) abuf->fields.fmt_ldb_d.f |
646c6f2b | 1369 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1370 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 1371 | |
190659a2 DE |
1372 | { |
1373 | SI opval = EXTQISI (GETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); | |
1374 | * FLD (f_r1) = opval; | |
1375 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1376 | } | |
b8a9943d | 1377 | |
a8981d67 DE |
1378 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1379 | ||
646c6f2b DE |
1380 | #if WITH_PROFILE_MODEL_P |
1381 | if (PROFILE_MODEL_P (current_cpu)) | |
1382 | { | |
190659a2 DE |
1383 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1384 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
1385 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1386 | } |
1387 | #endif | |
b8a9943d | 1388 | |
646c6f2b DE |
1389 | return new_pc; |
1390 | #undef FLD | |
1391 | } | |
1392 | ||
a8981d67 DE |
1393 | /* ldh: ldh $dr,@$sr. */ |
1394 | ||
646c6f2b | 1395 | CIA |
190659a2 | 1396 | SEM_FN_NAME (m32rb,ldh) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1397 | { |
970a8fd6 | 1398 | #define FLD(f) abuf->fields.fmt_ldh.f |
646c6f2b | 1399 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1400 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1401 | |
190659a2 DE |
1402 | { |
1403 | SI opval = EXTHISI (GETMEMHI (current_cpu, * FLD (f_r2))); | |
1404 | * FLD (f_r1) = opval; | |
1405 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1406 | } | |
b8a9943d | 1407 | |
a8981d67 DE |
1408 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1409 | ||
646c6f2b DE |
1410 | #if WITH_PROFILE_MODEL_P |
1411 | if (PROFILE_MODEL_P (current_cpu)) | |
1412 | { | |
190659a2 DE |
1413 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1414 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
1415 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1416 | } |
1417 | #endif | |
b8a9943d | 1418 | |
646c6f2b DE |
1419 | return new_pc; |
1420 | #undef FLD | |
1421 | } | |
1422 | ||
a8981d67 DE |
1423 | /* ldh-d: ldh $dr,@($slo16,$sr). */ |
1424 | ||
646c6f2b | 1425 | CIA |
190659a2 | 1426 | SEM_FN_NAME (m32rb,ldh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1427 | { |
970a8fd6 | 1428 | #define FLD(f) abuf->fields.fmt_ldh_d.f |
646c6f2b | 1429 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1430 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 1431 | |
190659a2 DE |
1432 | { |
1433 | SI opval = EXTHISI (GETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); | |
1434 | * FLD (f_r1) = opval; | |
1435 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1436 | } | |
b8a9943d | 1437 | |
a8981d67 DE |
1438 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1439 | ||
646c6f2b DE |
1440 | #if WITH_PROFILE_MODEL_P |
1441 | if (PROFILE_MODEL_P (current_cpu)) | |
1442 | { | |
190659a2 DE |
1443 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1444 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
1445 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1446 | } |
1447 | #endif | |
b8a9943d | 1448 | |
646c6f2b DE |
1449 | return new_pc; |
1450 | #undef FLD | |
1451 | } | |
1452 | ||
a8981d67 DE |
1453 | /* ldub: ldub $dr,@$sr. */ |
1454 | ||
646c6f2b | 1455 | CIA |
190659a2 | 1456 | SEM_FN_NAME (m32rb,ldub) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1457 | { |
970a8fd6 | 1458 | #define FLD(f) abuf->fields.fmt_ldb.f |
646c6f2b | 1459 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1460 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1461 | |
190659a2 DE |
1462 | { |
1463 | SI opval = ZEXTQISI (GETMEMQI (current_cpu, * FLD (f_r2))); | |
1464 | * FLD (f_r1) = opval; | |
1465 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1466 | } | |
b8a9943d | 1467 | |
a8981d67 DE |
1468 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1469 | ||
646c6f2b DE |
1470 | #if WITH_PROFILE_MODEL_P |
1471 | if (PROFILE_MODEL_P (current_cpu)) | |
1472 | { | |
190659a2 DE |
1473 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1474 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
1475 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1476 | } |
1477 | #endif | |
b8a9943d | 1478 | |
646c6f2b DE |
1479 | return new_pc; |
1480 | #undef FLD | |
1481 | } | |
1482 | ||
a8981d67 DE |
1483 | /* ldub-d: ldub $dr,@($slo16,$sr). */ |
1484 | ||
646c6f2b | 1485 | CIA |
190659a2 | 1486 | SEM_FN_NAME (m32rb,ldub_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1487 | { |
970a8fd6 | 1488 | #define FLD(f) abuf->fields.fmt_ldb_d.f |
646c6f2b | 1489 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1490 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 1491 | |
190659a2 DE |
1492 | { |
1493 | SI opval = ZEXTQISI (GETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); | |
1494 | * FLD (f_r1) = opval; | |
1495 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1496 | } | |
b8a9943d | 1497 | |
a8981d67 DE |
1498 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1499 | ||
646c6f2b DE |
1500 | #if WITH_PROFILE_MODEL_P |
1501 | if (PROFILE_MODEL_P (current_cpu)) | |
1502 | { | |
190659a2 DE |
1503 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1504 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
1505 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1506 | } |
1507 | #endif | |
b8a9943d | 1508 | |
646c6f2b DE |
1509 | return new_pc; |
1510 | #undef FLD | |
1511 | } | |
1512 | ||
a8981d67 DE |
1513 | /* lduh: lduh $dr,@$sr. */ |
1514 | ||
646c6f2b | 1515 | CIA |
190659a2 | 1516 | SEM_FN_NAME (m32rb,lduh) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1517 | { |
970a8fd6 | 1518 | #define FLD(f) abuf->fields.fmt_ldh.f |
646c6f2b | 1519 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1520 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1521 | |
190659a2 DE |
1522 | { |
1523 | SI opval = ZEXTHISI (GETMEMHI (current_cpu, * FLD (f_r2))); | |
1524 | * FLD (f_r1) = opval; | |
1525 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1526 | } | |
b8a9943d | 1527 | |
a8981d67 DE |
1528 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1529 | ||
646c6f2b DE |
1530 | #if WITH_PROFILE_MODEL_P |
1531 | if (PROFILE_MODEL_P (current_cpu)) | |
1532 | { | |
190659a2 DE |
1533 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1534 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
1535 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1536 | } |
1537 | #endif | |
b8a9943d | 1538 | |
646c6f2b DE |
1539 | return new_pc; |
1540 | #undef FLD | |
1541 | } | |
1542 | ||
a8981d67 DE |
1543 | /* lduh-d: lduh $dr,@($slo16,$sr). */ |
1544 | ||
646c6f2b | 1545 | CIA |
190659a2 | 1546 | SEM_FN_NAME (m32rb,lduh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1547 | { |
970a8fd6 | 1548 | #define FLD(f) abuf->fields.fmt_ldh_d.f |
646c6f2b | 1549 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1550 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 1551 | |
190659a2 DE |
1552 | { |
1553 | SI opval = ZEXTHISI (GETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); | |
1554 | * FLD (f_r1) = opval; | |
1555 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1556 | } | |
b8a9943d | 1557 | |
a8981d67 DE |
1558 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1559 | ||
646c6f2b DE |
1560 | #if WITH_PROFILE_MODEL_P |
1561 | if (PROFILE_MODEL_P (current_cpu)) | |
1562 | { | |
190659a2 DE |
1563 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1564 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
1565 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1566 | } |
1567 | #endif | |
b8a9943d | 1568 | |
646c6f2b DE |
1569 | return new_pc; |
1570 | #undef FLD | |
1571 | } | |
1572 | ||
a8981d67 DE |
1573 | /* ld-plus: ld $dr,@$sr+. */ |
1574 | ||
646c6f2b | 1575 | CIA |
190659a2 | 1576 | SEM_FN_NAME (m32rb,ld_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1577 | { |
970a8fd6 | 1578 | #define FLD(f) abuf->fields.fmt_ld_plus.f |
646c6f2b | 1579 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1580 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1581 | |
646c6f2b DE |
1582 | do { |
1583 | SI temp1;SI temp0; | |
9d70630e DE |
1584 | temp0 = GETMEMSI (current_cpu, * FLD (f_r2)); |
1585 | temp1 = ADDSI (* FLD (f_r2), 4); | |
190659a2 DE |
1586 | { |
1587 | SI opval = temp0; | |
1588 | * FLD (f_r1) = opval; | |
1589 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1590 | } | |
1591 | { | |
1592 | SI opval = temp1; | |
1593 | * FLD (f_r2) = opval; | |
1594 | TRACE_RESULT (current_cpu, "sr", 'x', opval); | |
1595 | } | |
646c6f2b | 1596 | } while (0); |
b8a9943d | 1597 | |
a8981d67 DE |
1598 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1599 | ||
646c6f2b DE |
1600 | #if WITH_PROFILE_MODEL_P |
1601 | if (PROFILE_MODEL_P (current_cpu)) | |
1602 | { | |
190659a2 DE |
1603 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1604 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
1605 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1606 | } |
1607 | #endif | |
b8a9943d | 1608 | |
646c6f2b DE |
1609 | return new_pc; |
1610 | #undef FLD | |
1611 | } | |
1612 | ||
a8981d67 DE |
1613 | /* ld24: ld24 $dr,$uimm24. */ |
1614 | ||
646c6f2b | 1615 | CIA |
190659a2 | 1616 | SEM_FN_NAME (m32rb,ld24) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1617 | { |
970a8fd6 | 1618 | #define FLD(f) abuf->fields.fmt_ld24.f |
646c6f2b | 1619 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1620 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 1621 | |
190659a2 DE |
1622 | { |
1623 | SI opval = FLD (f_uimm24); | |
1624 | * FLD (f_r1) = opval; | |
1625 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1626 | } | |
b8a9943d | 1627 | |
a8981d67 DE |
1628 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1629 | ||
646c6f2b DE |
1630 | #if WITH_PROFILE_MODEL_P |
1631 | if (PROFILE_MODEL_P (current_cpu)) | |
1632 | { | |
190659a2 DE |
1633 | m32rb_model_mark_set_h_gr (current_cpu, abuf); |
1634 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1635 | } |
1636 | #endif | |
b8a9943d | 1637 | |
646c6f2b DE |
1638 | return new_pc; |
1639 | #undef FLD | |
1640 | } | |
1641 | ||
a8981d67 DE |
1642 | /* ldi8: ldi8 $dr,$simm8. */ |
1643 | ||
646c6f2b | 1644 | CIA |
190659a2 | 1645 | SEM_FN_NAME (m32rb,ldi8) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1646 | { |
970a8fd6 | 1647 | #define FLD(f) abuf->fields.fmt_ldi8.f |
646c6f2b | 1648 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1649 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1650 | |
190659a2 DE |
1651 | { |
1652 | SI opval = FLD (f_simm8); | |
1653 | * FLD (f_r1) = opval; | |
1654 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1655 | } | |
b8a9943d | 1656 | |
a8981d67 DE |
1657 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1658 | ||
646c6f2b DE |
1659 | #if WITH_PROFILE_MODEL_P |
1660 | if (PROFILE_MODEL_P (current_cpu)) | |
1661 | { | |
190659a2 DE |
1662 | m32rb_model_mark_set_h_gr (current_cpu, abuf); |
1663 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1664 | } |
1665 | #endif | |
b8a9943d | 1666 | |
646c6f2b DE |
1667 | return new_pc; |
1668 | #undef FLD | |
1669 | } | |
1670 | ||
a8981d67 DE |
1671 | /* ldi16: ldi16 $dr,$hash$slo16. */ |
1672 | ||
646c6f2b | 1673 | CIA |
190659a2 | 1674 | SEM_FN_NAME (m32rb,ldi16) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1675 | { |
970a8fd6 | 1676 | #define FLD(f) abuf->fields.fmt_ldi16.f |
646c6f2b | 1677 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1678 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 1679 | |
190659a2 DE |
1680 | { |
1681 | SI opval = FLD (f_simm16); | |
1682 | * FLD (f_r1) = opval; | |
1683 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1684 | } | |
b8a9943d | 1685 | |
a8981d67 DE |
1686 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1687 | ||
646c6f2b DE |
1688 | #if WITH_PROFILE_MODEL_P |
1689 | if (PROFILE_MODEL_P (current_cpu)) | |
1690 | { | |
190659a2 DE |
1691 | m32rb_model_mark_set_h_gr (current_cpu, abuf); |
1692 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1693 | } |
1694 | #endif | |
b8a9943d | 1695 | |
646c6f2b DE |
1696 | return new_pc; |
1697 | #undef FLD | |
1698 | } | |
1699 | ||
a8981d67 DE |
1700 | /* lock: lock $dr,@$sr. */ |
1701 | ||
646c6f2b | 1702 | CIA |
190659a2 | 1703 | SEM_FN_NAME (m32rb,lock) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1704 | { |
970a8fd6 | 1705 | #define FLD(f) abuf->fields.fmt_lock.f |
646c6f2b | 1706 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1707 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1708 | |
cab58155 | 1709 | do { |
190659a2 DE |
1710 | { |
1711 | UBI opval = 1; | |
1712 | CPU (h_lock) = opval; | |
1713 | TRACE_RESULT (current_cpu, "lock-0", 'x', opval); | |
1714 | } | |
1715 | { | |
1716 | SI opval = GETMEMSI (current_cpu, * FLD (f_r2)); | |
1717 | * FLD (f_r1) = opval; | |
1718 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1719 | } | |
cab58155 | 1720 | } while (0); |
b8a9943d | 1721 | |
a8981d67 DE |
1722 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1723 | ||
646c6f2b DE |
1724 | #if WITH_PROFILE_MODEL_P |
1725 | if (PROFILE_MODEL_P (current_cpu)) | |
1726 | { | |
190659a2 DE |
1727 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1728 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
1729 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1730 | } |
1731 | #endif | |
b8a9943d | 1732 | |
646c6f2b DE |
1733 | return new_pc; |
1734 | #undef FLD | |
1735 | } | |
1736 | ||
a8981d67 DE |
1737 | /* machi: machi $src1,$src2. */ |
1738 | ||
646c6f2b | 1739 | CIA |
190659a2 | 1740 | SEM_FN_NAME (m32rb,machi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1741 | { |
970a8fd6 | 1742 | #define FLD(f) abuf->fields.fmt_machi.f |
646c6f2b | 1743 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1744 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1745 | |
190659a2 DE |
1746 | { |
1747 | DI opval = SRADI (SLLDI (ADDDI (m32rb_h_accum_get (current_cpu), MULDI (EXTSIDI (ANDSI (* FLD (f_r1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16))))), 8), 8); | |
1748 | m32rb_h_accum_set (current_cpu, opval); | |
1749 | TRACE_RESULT (current_cpu, "accum", 'D', opval); | |
1750 | } | |
b8a9943d | 1751 | |
a8981d67 DE |
1752 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1753 | ||
646c6f2b DE |
1754 | #if WITH_PROFILE_MODEL_P |
1755 | if (PROFILE_MODEL_P (current_cpu)) | |
1756 | { | |
190659a2 DE |
1757 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1758 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1759 | } |
1760 | #endif | |
b8a9943d | 1761 | |
646c6f2b DE |
1762 | return new_pc; |
1763 | #undef FLD | |
1764 | } | |
1765 | ||
a8981d67 DE |
1766 | /* maclo: maclo $src1,$src2. */ |
1767 | ||
646c6f2b | 1768 | CIA |
190659a2 | 1769 | SEM_FN_NAME (m32rb,maclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1770 | { |
970a8fd6 | 1771 | #define FLD(f) abuf->fields.fmt_machi.f |
646c6f2b | 1772 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1773 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1774 | |
190659a2 DE |
1775 | { |
1776 | DI opval = SRADI (SLLDI (ADDDI (m32rb_h_accum_get (current_cpu), MULDI (EXTSIDI (SLLSI (* FLD (f_r1), 16)), EXTHIDI (TRUNCSIHI (* FLD (f_r2))))), 8), 8); | |
1777 | m32rb_h_accum_set (current_cpu, opval); | |
1778 | TRACE_RESULT (current_cpu, "accum", 'D', opval); | |
1779 | } | |
b8a9943d | 1780 | |
a8981d67 DE |
1781 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1782 | ||
646c6f2b DE |
1783 | #if WITH_PROFILE_MODEL_P |
1784 | if (PROFILE_MODEL_P (current_cpu)) | |
1785 | { | |
190659a2 DE |
1786 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1787 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1788 | } |
1789 | #endif | |
b8a9943d | 1790 | |
646c6f2b DE |
1791 | return new_pc; |
1792 | #undef FLD | |
1793 | } | |
1794 | ||
a8981d67 DE |
1795 | /* macwhi: macwhi $src1,$src2. */ |
1796 | ||
646c6f2b | 1797 | CIA |
190659a2 | 1798 | SEM_FN_NAME (m32rb,macwhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1799 | { |
970a8fd6 | 1800 | #define FLD(f) abuf->fields.fmt_machi.f |
646c6f2b | 1801 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1802 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1803 | |
190659a2 DE |
1804 | { |
1805 | DI opval = SRADI (SLLDI (ADDDI (m32rb_h_accum_get (current_cpu), MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16))))), 8), 8); | |
1806 | m32rb_h_accum_set (current_cpu, opval); | |
1807 | TRACE_RESULT (current_cpu, "accum", 'D', opval); | |
1808 | } | |
b8a9943d | 1809 | |
a8981d67 DE |
1810 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1811 | ||
646c6f2b DE |
1812 | #if WITH_PROFILE_MODEL_P |
1813 | if (PROFILE_MODEL_P (current_cpu)) | |
1814 | { | |
190659a2 DE |
1815 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1816 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1817 | } |
1818 | #endif | |
b8a9943d | 1819 | |
646c6f2b DE |
1820 | return new_pc; |
1821 | #undef FLD | |
1822 | } | |
1823 | ||
a8981d67 DE |
1824 | /* macwlo: macwlo $src1,$src2. */ |
1825 | ||
646c6f2b | 1826 | CIA |
190659a2 | 1827 | SEM_FN_NAME (m32rb,macwlo) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1828 | { |
970a8fd6 | 1829 | #define FLD(f) abuf->fields.fmt_machi.f |
646c6f2b | 1830 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1831 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1832 | |
190659a2 DE |
1833 | { |
1834 | DI opval = SRADI (SLLDI (ADDDI (m32rb_h_accum_get (current_cpu), MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (* FLD (f_r2))))), 8), 8); | |
1835 | m32rb_h_accum_set (current_cpu, opval); | |
1836 | TRACE_RESULT (current_cpu, "accum", 'D', opval); | |
1837 | } | |
b8a9943d | 1838 | |
a8981d67 DE |
1839 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1840 | ||
646c6f2b DE |
1841 | #if WITH_PROFILE_MODEL_P |
1842 | if (PROFILE_MODEL_P (current_cpu)) | |
1843 | { | |
190659a2 DE |
1844 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1845 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1846 | } |
1847 | #endif | |
b8a9943d | 1848 | |
646c6f2b DE |
1849 | return new_pc; |
1850 | #undef FLD | |
1851 | } | |
1852 | ||
a8981d67 DE |
1853 | /* mul: mul $dr,$sr. */ |
1854 | ||
646c6f2b | 1855 | CIA |
190659a2 | 1856 | SEM_FN_NAME (m32rb,mul) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1857 | { |
970a8fd6 | 1858 | #define FLD(f) abuf->fields.fmt_add.f |
646c6f2b | 1859 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1860 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1861 | |
190659a2 DE |
1862 | { |
1863 | SI opval = MULSI (* FLD (f_r1), * FLD (f_r2)); | |
1864 | * FLD (f_r1) = opval; | |
1865 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
1866 | } | |
b8a9943d | 1867 | |
a8981d67 DE |
1868 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1869 | ||
646c6f2b DE |
1870 | #if WITH_PROFILE_MODEL_P |
1871 | if (PROFILE_MODEL_P (current_cpu)) | |
1872 | { | |
190659a2 DE |
1873 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1874 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
1875 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1876 | } |
1877 | #endif | |
b8a9943d | 1878 | |
646c6f2b DE |
1879 | return new_pc; |
1880 | #undef FLD | |
1881 | } | |
1882 | ||
a8981d67 DE |
1883 | /* mulhi: mulhi $src1,$src2. */ |
1884 | ||
646c6f2b | 1885 | CIA |
190659a2 | 1886 | SEM_FN_NAME (m32rb,mulhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1887 | { |
970a8fd6 | 1888 | #define FLD(f) abuf->fields.fmt_mulhi.f |
646c6f2b | 1889 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1890 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1891 | |
190659a2 DE |
1892 | { |
1893 | DI opval = SRADI (SLLDI (MULDI (EXTSIDI (ANDSI (* FLD (f_r1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16)))), 16), 16); | |
1894 | m32rb_h_accum_set (current_cpu, opval); | |
1895 | TRACE_RESULT (current_cpu, "accum", 'D', opval); | |
1896 | } | |
b8a9943d | 1897 | |
a8981d67 DE |
1898 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1899 | ||
646c6f2b DE |
1900 | #if WITH_PROFILE_MODEL_P |
1901 | if (PROFILE_MODEL_P (current_cpu)) | |
1902 | { | |
190659a2 DE |
1903 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1904 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1905 | } |
1906 | #endif | |
b8a9943d | 1907 | |
646c6f2b DE |
1908 | return new_pc; |
1909 | #undef FLD | |
1910 | } | |
1911 | ||
a8981d67 DE |
1912 | /* mullo: mullo $src1,$src2. */ |
1913 | ||
646c6f2b | 1914 | CIA |
190659a2 | 1915 | SEM_FN_NAME (m32rb,mullo) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1916 | { |
970a8fd6 | 1917 | #define FLD(f) abuf->fields.fmt_mulhi.f |
646c6f2b | 1918 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1919 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1920 | |
190659a2 DE |
1921 | { |
1922 | DI opval = SRADI (SLLDI (MULDI (EXTSIDI (SLLSI (* FLD (f_r1), 16)), EXTHIDI (TRUNCSIHI (* FLD (f_r2)))), 16), 16); | |
1923 | m32rb_h_accum_set (current_cpu, opval); | |
1924 | TRACE_RESULT (current_cpu, "accum", 'D', opval); | |
1925 | } | |
b8a9943d | 1926 | |
a8981d67 DE |
1927 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1928 | ||
646c6f2b DE |
1929 | #if WITH_PROFILE_MODEL_P |
1930 | if (PROFILE_MODEL_P (current_cpu)) | |
1931 | { | |
190659a2 DE |
1932 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1933 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1934 | } |
1935 | #endif | |
b8a9943d | 1936 | |
646c6f2b DE |
1937 | return new_pc; |
1938 | #undef FLD | |
1939 | } | |
1940 | ||
a8981d67 DE |
1941 | /* mulwhi: mulwhi $src1,$src2. */ |
1942 | ||
646c6f2b | 1943 | CIA |
190659a2 | 1944 | SEM_FN_NAME (m32rb,mulwhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1945 | { |
970a8fd6 | 1946 | #define FLD(f) abuf->fields.fmt_mulhi.f |
646c6f2b | 1947 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1948 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1949 | |
190659a2 DE |
1950 | { |
1951 | DI opval = SRADI (SLLDI (MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16)))), 8), 8); | |
1952 | m32rb_h_accum_set (current_cpu, opval); | |
1953 | TRACE_RESULT (current_cpu, "accum", 'D', opval); | |
1954 | } | |
b8a9943d | 1955 | |
a8981d67 DE |
1956 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1957 | ||
646c6f2b DE |
1958 | #if WITH_PROFILE_MODEL_P |
1959 | if (PROFILE_MODEL_P (current_cpu)) | |
1960 | { | |
190659a2 DE |
1961 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1962 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1963 | } |
1964 | #endif | |
b8a9943d | 1965 | |
646c6f2b DE |
1966 | return new_pc; |
1967 | #undef FLD | |
1968 | } | |
1969 | ||
a8981d67 DE |
1970 | /* mulwlo: mulwlo $src1,$src2. */ |
1971 | ||
646c6f2b | 1972 | CIA |
190659a2 | 1973 | SEM_FN_NAME (m32rb,mulwlo) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1974 | { |
970a8fd6 | 1975 | #define FLD(f) abuf->fields.fmt_mulhi.f |
646c6f2b | 1976 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1977 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1978 | |
190659a2 DE |
1979 | { |
1980 | DI opval = SRADI (SLLDI (MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (* FLD (f_r2)))), 8), 8); | |
1981 | m32rb_h_accum_set (current_cpu, opval); | |
1982 | TRACE_RESULT (current_cpu, "accum", 'D', opval); | |
1983 | } | |
b8a9943d | 1984 | |
a8981d67 DE |
1985 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
1986 | ||
646c6f2b DE |
1987 | #if WITH_PROFILE_MODEL_P |
1988 | if (PROFILE_MODEL_P (current_cpu)) | |
1989 | { | |
190659a2 DE |
1990 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
1991 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
1992 | } |
1993 | #endif | |
b8a9943d | 1994 | |
646c6f2b DE |
1995 | return new_pc; |
1996 | #undef FLD | |
1997 | } | |
1998 | ||
a8981d67 DE |
1999 | /* mv: mv $dr,$sr. */ |
2000 | ||
646c6f2b | 2001 | CIA |
190659a2 | 2002 | SEM_FN_NAME (m32rb,mv) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2003 | { |
970a8fd6 | 2004 | #define FLD(f) abuf->fields.fmt_mv.f |
646c6f2b | 2005 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2006 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2007 | |
190659a2 DE |
2008 | { |
2009 | SI opval = * FLD (f_r2); | |
2010 | * FLD (f_r1) = opval; | |
2011 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2012 | } | |
b8a9943d | 2013 | |
a8981d67 DE |
2014 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2015 | ||
646c6f2b DE |
2016 | #if WITH_PROFILE_MODEL_P |
2017 | if (PROFILE_MODEL_P (current_cpu)) | |
2018 | { | |
190659a2 DE |
2019 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2020 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
2021 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2022 | } |
2023 | #endif | |
b8a9943d | 2024 | |
646c6f2b DE |
2025 | return new_pc; |
2026 | #undef FLD | |
2027 | } | |
2028 | ||
a8981d67 DE |
2029 | /* mvfachi: mvfachi $dr. */ |
2030 | ||
646c6f2b | 2031 | CIA |
190659a2 | 2032 | SEM_FN_NAME (m32rb,mvfachi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2033 | { |
970a8fd6 | 2034 | #define FLD(f) abuf->fields.fmt_mvfachi.f |
646c6f2b | 2035 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2036 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2037 | |
190659a2 DE |
2038 | { |
2039 | SI opval = TRUNCDISI (SRADI (m32rb_h_accum_get (current_cpu), 32)); | |
2040 | * FLD (f_r1) = opval; | |
2041 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2042 | } | |
b8a9943d | 2043 | |
a8981d67 DE |
2044 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2045 | ||
646c6f2b DE |
2046 | #if WITH_PROFILE_MODEL_P |
2047 | if (PROFILE_MODEL_P (current_cpu)) | |
2048 | { | |
190659a2 DE |
2049 | m32rb_model_mark_set_h_gr (current_cpu, abuf); |
2050 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2051 | } |
2052 | #endif | |
b8a9943d | 2053 | |
646c6f2b DE |
2054 | return new_pc; |
2055 | #undef FLD | |
2056 | } | |
2057 | ||
a8981d67 DE |
2058 | /* mvfaclo: mvfaclo $dr. */ |
2059 | ||
646c6f2b | 2060 | CIA |
190659a2 | 2061 | SEM_FN_NAME (m32rb,mvfaclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2062 | { |
970a8fd6 | 2063 | #define FLD(f) abuf->fields.fmt_mvfachi.f |
646c6f2b | 2064 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2065 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2066 | |
190659a2 DE |
2067 | { |
2068 | SI opval = TRUNCDISI (m32rb_h_accum_get (current_cpu)); | |
2069 | * FLD (f_r1) = opval; | |
2070 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2071 | } | |
b8a9943d | 2072 | |
a8981d67 DE |
2073 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2074 | ||
646c6f2b DE |
2075 | #if WITH_PROFILE_MODEL_P |
2076 | if (PROFILE_MODEL_P (current_cpu)) | |
2077 | { | |
190659a2 DE |
2078 | m32rb_model_mark_set_h_gr (current_cpu, abuf); |
2079 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2080 | } |
2081 | #endif | |
b8a9943d | 2082 | |
646c6f2b DE |
2083 | return new_pc; |
2084 | #undef FLD | |
2085 | } | |
2086 | ||
a8981d67 DE |
2087 | /* mvfacmi: mvfacmi $dr. */ |
2088 | ||
646c6f2b | 2089 | CIA |
190659a2 | 2090 | SEM_FN_NAME (m32rb,mvfacmi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2091 | { |
970a8fd6 | 2092 | #define FLD(f) abuf->fields.fmt_mvfachi.f |
646c6f2b | 2093 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2094 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2095 | |
190659a2 DE |
2096 | { |
2097 | SI opval = TRUNCDISI (SRADI (m32rb_h_accum_get (current_cpu), 16)); | |
2098 | * FLD (f_r1) = opval; | |
2099 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2100 | } | |
b8a9943d | 2101 | |
a8981d67 DE |
2102 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2103 | ||
646c6f2b DE |
2104 | #if WITH_PROFILE_MODEL_P |
2105 | if (PROFILE_MODEL_P (current_cpu)) | |
2106 | { | |
190659a2 DE |
2107 | m32rb_model_mark_set_h_gr (current_cpu, abuf); |
2108 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2109 | } |
2110 | #endif | |
b8a9943d | 2111 | |
646c6f2b DE |
2112 | return new_pc; |
2113 | #undef FLD | |
2114 | } | |
2115 | ||
a8981d67 DE |
2116 | /* mvfc: mvfc $dr,$scr. */ |
2117 | ||
646c6f2b | 2118 | CIA |
190659a2 | 2119 | SEM_FN_NAME (m32rb,mvfc) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2120 | { |
970a8fd6 | 2121 | #define FLD(f) abuf->fields.fmt_mvfc.f |
646c6f2b | 2122 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2123 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2124 | |
190659a2 DE |
2125 | { |
2126 | SI opval = m32rb_h_cr_get (current_cpu, FLD (f_r2)); | |
2127 | * FLD (f_r1) = opval; | |
2128 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2129 | } | |
b8a9943d | 2130 | |
a8981d67 DE |
2131 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2132 | ||
646c6f2b DE |
2133 | #if WITH_PROFILE_MODEL_P |
2134 | if (PROFILE_MODEL_P (current_cpu)) | |
2135 | { | |
190659a2 DE |
2136 | m32rb_model_mark_set_h_gr (current_cpu, abuf); |
2137 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2138 | } |
2139 | #endif | |
b8a9943d | 2140 | |
646c6f2b DE |
2141 | return new_pc; |
2142 | #undef FLD | |
2143 | } | |
2144 | ||
a8981d67 DE |
2145 | /* mvtachi: mvtachi $src1. */ |
2146 | ||
646c6f2b | 2147 | CIA |
190659a2 | 2148 | SEM_FN_NAME (m32rb,mvtachi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2149 | { |
970a8fd6 | 2150 | #define FLD(f) abuf->fields.fmt_mvtachi.f |
646c6f2b | 2151 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2152 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2153 | |
190659a2 DE |
2154 | { |
2155 | DI opval = ORDI (ANDDI (m32rb_h_accum_get (current_cpu), MAKEDI (0, 0xffffffff)), SLLDI (EXTSIDI (* FLD (f_r1)), 32)); | |
2156 | m32rb_h_accum_set (current_cpu, opval); | |
2157 | TRACE_RESULT (current_cpu, "accum", 'D', opval); | |
2158 | } | |
b8a9943d | 2159 | |
a8981d67 DE |
2160 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2161 | ||
646c6f2b DE |
2162 | #if WITH_PROFILE_MODEL_P |
2163 | if (PROFILE_MODEL_P (current_cpu)) | |
2164 | { | |
190659a2 DE |
2165 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2166 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2167 | } |
2168 | #endif | |
b8a9943d | 2169 | |
646c6f2b DE |
2170 | return new_pc; |
2171 | #undef FLD | |
2172 | } | |
2173 | ||
a8981d67 DE |
2174 | /* mvtaclo: mvtaclo $src1. */ |
2175 | ||
646c6f2b | 2176 | CIA |
190659a2 | 2177 | SEM_FN_NAME (m32rb,mvtaclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2178 | { |
970a8fd6 | 2179 | #define FLD(f) abuf->fields.fmt_mvtachi.f |
646c6f2b | 2180 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2181 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2182 | |
190659a2 DE |
2183 | { |
2184 | DI opval = ORDI (ANDDI (m32rb_h_accum_get (current_cpu), MAKEDI (0xffffffff, 0)), ZEXTSIDI (* FLD (f_r1))); | |
2185 | m32rb_h_accum_set (current_cpu, opval); | |
2186 | TRACE_RESULT (current_cpu, "accum", 'D', opval); | |
2187 | } | |
b8a9943d | 2188 | |
a8981d67 DE |
2189 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2190 | ||
646c6f2b DE |
2191 | #if WITH_PROFILE_MODEL_P |
2192 | if (PROFILE_MODEL_P (current_cpu)) | |
2193 | { | |
190659a2 DE |
2194 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2195 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2196 | } |
2197 | #endif | |
b8a9943d | 2198 | |
646c6f2b DE |
2199 | return new_pc; |
2200 | #undef FLD | |
2201 | } | |
2202 | ||
a8981d67 DE |
2203 | /* mvtc: mvtc $sr,$dcr. */ |
2204 | ||
646c6f2b | 2205 | CIA |
190659a2 | 2206 | SEM_FN_NAME (m32rb,mvtc) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2207 | { |
970a8fd6 | 2208 | #define FLD(f) abuf->fields.fmt_mvtc.f |
646c6f2b | 2209 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2210 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2211 | |
190659a2 DE |
2212 | { |
2213 | USI opval = * FLD (f_r2); | |
2214 | m32rb_h_cr_set (current_cpu, FLD (f_r1), opval); | |
2215 | TRACE_RESULT (current_cpu, "dcr", 'x', opval); | |
2216 | } | |
b8a9943d | 2217 | |
a8981d67 DE |
2218 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2219 | ||
646c6f2b DE |
2220 | #if WITH_PROFILE_MODEL_P |
2221 | if (PROFILE_MODEL_P (current_cpu)) | |
2222 | { | |
190659a2 DE |
2223 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2224 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2225 | } |
2226 | #endif | |
b8a9943d | 2227 | |
646c6f2b DE |
2228 | return new_pc; |
2229 | #undef FLD | |
2230 | } | |
2231 | ||
a8981d67 DE |
2232 | /* neg: neg $dr,$sr. */ |
2233 | ||
646c6f2b | 2234 | CIA |
190659a2 | 2235 | SEM_FN_NAME (m32rb,neg) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2236 | { |
970a8fd6 | 2237 | #define FLD(f) abuf->fields.fmt_mv.f |
646c6f2b | 2238 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2239 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2240 | |
190659a2 DE |
2241 | { |
2242 | SI opval = NEGSI (* FLD (f_r2)); | |
2243 | * FLD (f_r1) = opval; | |
2244 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2245 | } | |
b8a9943d | 2246 | |
a8981d67 DE |
2247 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2248 | ||
646c6f2b DE |
2249 | #if WITH_PROFILE_MODEL_P |
2250 | if (PROFILE_MODEL_P (current_cpu)) | |
2251 | { | |
190659a2 DE |
2252 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2253 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
2254 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2255 | } |
2256 | #endif | |
b8a9943d | 2257 | |
646c6f2b DE |
2258 | return new_pc; |
2259 | #undef FLD | |
2260 | } | |
2261 | ||
a8981d67 DE |
2262 | /* nop: nop. */ |
2263 | ||
646c6f2b | 2264 | CIA |
190659a2 | 2265 | SEM_FN_NAME (m32rb,nop) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2266 | { |
970a8fd6 | 2267 | #define FLD(f) abuf->fields.fmt_nop.f |
646c6f2b | 2268 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2269 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2270 | |
646c6f2b | 2271 | PROFILE_COUNT_FILLNOPS (current_cpu, abuf->addr); |
b8a9943d | 2272 | |
a8981d67 DE |
2273 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2274 | ||
646c6f2b DE |
2275 | #if WITH_PROFILE_MODEL_P |
2276 | if (PROFILE_MODEL_P (current_cpu)) | |
2277 | { | |
190659a2 | 2278 | m32rb_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2279 | } |
2280 | #endif | |
b8a9943d | 2281 | |
646c6f2b DE |
2282 | return new_pc; |
2283 | #undef FLD | |
2284 | } | |
2285 | ||
a8981d67 DE |
2286 | /* not: not $dr,$sr. */ |
2287 | ||
646c6f2b | 2288 | CIA |
190659a2 | 2289 | SEM_FN_NAME (m32rb,not) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2290 | { |
970a8fd6 | 2291 | #define FLD(f) abuf->fields.fmt_mv.f |
646c6f2b | 2292 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2293 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2294 | |
190659a2 DE |
2295 | { |
2296 | SI opval = INVSI (* FLD (f_r2)); | |
2297 | * FLD (f_r1) = opval; | |
2298 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2299 | } | |
b8a9943d | 2300 | |
a8981d67 DE |
2301 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2302 | ||
646c6f2b DE |
2303 | #if WITH_PROFILE_MODEL_P |
2304 | if (PROFILE_MODEL_P (current_cpu)) | |
2305 | { | |
190659a2 DE |
2306 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2307 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
2308 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2309 | } |
2310 | #endif | |
b8a9943d | 2311 | |
646c6f2b DE |
2312 | return new_pc; |
2313 | #undef FLD | |
2314 | } | |
2315 | ||
a8981d67 DE |
2316 | /* rac: rac. */ |
2317 | ||
646c6f2b | 2318 | CIA |
190659a2 | 2319 | SEM_FN_NAME (m32rb,rac) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2320 | { |
970a8fd6 | 2321 | #define FLD(f) abuf->fields.fmt_rac.f |
646c6f2b | 2322 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2323 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2324 | |
9d70630e | 2325 | do { |
646c6f2b | 2326 | DI tmp_tmp1; |
190659a2 | 2327 | tmp_tmp1 = SLLDI (m32rb_h_accum_get (current_cpu), 1); |
e0bd6e18 | 2328 | tmp_tmp1 = ADDDI (tmp_tmp1, MAKEDI (0, 32768)); |
190659a2 DE |
2329 | { |
2330 | DI opval = (GTDI (tmp_tmp1, MAKEDI (32767, 0xffff0000))) ? (MAKEDI (32767, 0xffff0000)) : (LTDI (tmp_tmp1, MAKEDI (0xffff8000, 0))) ? (MAKEDI (0xffff8000, 0)) : (ANDDI (tmp_tmp1, MAKEDI (0xffffffff, 0xffff0000))); | |
2331 | m32rb_h_accum_set (current_cpu, opval); | |
2332 | TRACE_RESULT (current_cpu, "accum", 'D', opval); | |
2333 | } | |
9d70630e | 2334 | } while (0); |
b8a9943d | 2335 | |
a8981d67 DE |
2336 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2337 | ||
646c6f2b DE |
2338 | #if WITH_PROFILE_MODEL_P |
2339 | if (PROFILE_MODEL_P (current_cpu)) | |
2340 | { | |
190659a2 | 2341 | m32rb_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2342 | } |
2343 | #endif | |
b8a9943d | 2344 | |
646c6f2b DE |
2345 | return new_pc; |
2346 | #undef FLD | |
2347 | } | |
2348 | ||
a8981d67 DE |
2349 | /* rach: rach. */ |
2350 | ||
646c6f2b | 2351 | CIA |
190659a2 | 2352 | SEM_FN_NAME (m32rb,rach) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2353 | { |
970a8fd6 | 2354 | #define FLD(f) abuf->fields.fmt_rac.f |
646c6f2b | 2355 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2356 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2357 | |
9d70630e | 2358 | do { |
646c6f2b | 2359 | DI tmp_tmp1; |
190659a2 | 2360 | tmp_tmp1 = ANDDI (m32rb_h_accum_get (current_cpu), MAKEDI (16777215, 0xffffffff)); |
a040908c | 2361 | if (ANDIF (GEDI (tmp_tmp1, MAKEDI (16383, 0x80000000)), LEDI (tmp_tmp1, MAKEDI (8388607, 0xffffffff)))) { |
646c6f2b DE |
2362 | tmp_tmp1 = MAKEDI (16383, 0x80000000); |
2363 | } else { | |
a040908c | 2364 | if (ANDIF (GEDI (tmp_tmp1, MAKEDI (8388608, 0)), LEDI (tmp_tmp1, MAKEDI (16760832, 0)))) { |
646c6f2b DE |
2365 | tmp_tmp1 = MAKEDI (16760832, 0); |
2366 | } else { | |
190659a2 | 2367 | tmp_tmp1 = ANDDI (ADDDI (m32rb_h_accum_get (current_cpu), MAKEDI (0, 1073741824)), MAKEDI (0xffffffff, 0x80000000)); |
646c6f2b DE |
2368 | } |
2369 | } | |
9d70630e | 2370 | tmp_tmp1 = SLLDI (tmp_tmp1, 1); |
190659a2 DE |
2371 | { |
2372 | DI opval = SRADI (SLLDI (tmp_tmp1, 7), 7); | |
2373 | m32rb_h_accum_set (current_cpu, opval); | |
2374 | TRACE_RESULT (current_cpu, "accum", 'D', opval); | |
2375 | } | |
9d70630e | 2376 | } while (0); |
b8a9943d | 2377 | |
a8981d67 DE |
2378 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2379 | ||
646c6f2b DE |
2380 | #if WITH_PROFILE_MODEL_P |
2381 | if (PROFILE_MODEL_P (current_cpu)) | |
2382 | { | |
190659a2 | 2383 | m32rb_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2384 | } |
2385 | #endif | |
b8a9943d | 2386 | |
646c6f2b DE |
2387 | return new_pc; |
2388 | #undef FLD | |
2389 | } | |
2390 | ||
a8981d67 DE |
2391 | /* rte: rte. */ |
2392 | ||
646c6f2b | 2393 | CIA |
190659a2 | 2394 | SEM_FN_NAME (m32rb,rte) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2395 | { |
970a8fd6 | 2396 | #define FLD(f) abuf->fields.fmt_rte.f |
646c6f2b | 2397 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2398 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
646c6f2b | 2399 | int taken_p = 0; |
b8a9943d | 2400 | |
9d70630e | 2401 | do { |
190659a2 DE |
2402 | { |
2403 | UBI opval = CPU (h_bsm); | |
2404 | CPU (h_sm) = opval; | |
2405 | TRACE_RESULT (current_cpu, "sm-0", 'x', opval); | |
2406 | } | |
2407 | { | |
2408 | UBI opval = CPU (h_bie); | |
2409 | CPU (h_ie) = opval; | |
2410 | TRACE_RESULT (current_cpu, "ie-0", 'x', opval); | |
2411 | } | |
2412 | { | |
2413 | UBI opval = CPU (h_bcond); | |
2414 | CPU (h_cond) = opval; | |
2415 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
2416 | } | |
2417 | { | |
2418 | USI opval = ANDSI (CPU (h_bpc), -4); | |
2419 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
2420 | taken_p = 1; | |
2421 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
2422 | } | |
9d70630e | 2423 | } while (0); |
b8a9943d | 2424 | |
a8981d67 DE |
2425 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2426 | ||
646c6f2b DE |
2427 | #if WITH_PROFILE_MODEL_P |
2428 | if (PROFILE_MODEL_P (current_cpu)) | |
2429 | { | |
190659a2 | 2430 | m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
2431 | } |
2432 | #endif | |
b8a9943d | 2433 | |
646c6f2b DE |
2434 | return new_pc; |
2435 | #undef FLD | |
2436 | } | |
2437 | ||
a8981d67 DE |
2438 | /* seth: seth $dr,$hash$hi16. */ |
2439 | ||
646c6f2b | 2440 | CIA |
190659a2 | 2441 | SEM_FN_NAME (m32rb,seth) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2442 | { |
970a8fd6 | 2443 | #define FLD(f) abuf->fields.fmt_seth.f |
646c6f2b | 2444 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2445 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 2446 | |
190659a2 DE |
2447 | { |
2448 | SI opval = SLLSI (FLD (f_hi16), 16); | |
2449 | * FLD (f_r1) = opval; | |
2450 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2451 | } | |
b8a9943d | 2452 | |
a8981d67 DE |
2453 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2454 | ||
646c6f2b DE |
2455 | #if WITH_PROFILE_MODEL_P |
2456 | if (PROFILE_MODEL_P (current_cpu)) | |
2457 | { | |
190659a2 DE |
2458 | m32rb_model_mark_set_h_gr (current_cpu, abuf); |
2459 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2460 | } |
2461 | #endif | |
b8a9943d | 2462 | |
646c6f2b DE |
2463 | return new_pc; |
2464 | #undef FLD | |
2465 | } | |
2466 | ||
a8981d67 DE |
2467 | /* sll: sll $dr,$sr. */ |
2468 | ||
646c6f2b | 2469 | CIA |
190659a2 | 2470 | SEM_FN_NAME (m32rb,sll) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2471 | { |
970a8fd6 | 2472 | #define FLD(f) abuf->fields.fmt_add.f |
646c6f2b | 2473 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2474 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2475 | |
190659a2 DE |
2476 | { |
2477 | SI opval = SLLSI (* FLD (f_r1), ANDSI (* FLD (f_r2), 31)); | |
2478 | * FLD (f_r1) = opval; | |
2479 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2480 | } | |
b8a9943d | 2481 | |
a8981d67 DE |
2482 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2483 | ||
646c6f2b DE |
2484 | #if WITH_PROFILE_MODEL_P |
2485 | if (PROFILE_MODEL_P (current_cpu)) | |
2486 | { | |
190659a2 DE |
2487 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2488 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
2489 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2490 | } |
2491 | #endif | |
b8a9943d | 2492 | |
646c6f2b DE |
2493 | return new_pc; |
2494 | #undef FLD | |
2495 | } | |
2496 | ||
a8981d67 DE |
2497 | /* sll3: sll3 $dr,$sr,$simm16. */ |
2498 | ||
646c6f2b | 2499 | CIA |
190659a2 | 2500 | SEM_FN_NAME (m32rb,sll3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2501 | { |
970a8fd6 | 2502 | #define FLD(f) abuf->fields.fmt_sll3.f |
646c6f2b | 2503 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2504 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 2505 | |
190659a2 DE |
2506 | { |
2507 | SI opval = SLLSI (* FLD (f_r2), ANDSI (FLD (f_simm16), 31)); | |
2508 | * FLD (f_r1) = opval; | |
2509 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2510 | } | |
b8a9943d | 2511 | |
a8981d67 DE |
2512 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2513 | ||
646c6f2b DE |
2514 | #if WITH_PROFILE_MODEL_P |
2515 | if (PROFILE_MODEL_P (current_cpu)) | |
2516 | { | |
190659a2 DE |
2517 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2518 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
2519 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2520 | } |
2521 | #endif | |
b8a9943d | 2522 | |
646c6f2b DE |
2523 | return new_pc; |
2524 | #undef FLD | |
2525 | } | |
2526 | ||
a8981d67 DE |
2527 | /* slli: slli $dr,$uimm5. */ |
2528 | ||
646c6f2b | 2529 | CIA |
190659a2 | 2530 | SEM_FN_NAME (m32rb,slli) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2531 | { |
970a8fd6 | 2532 | #define FLD(f) abuf->fields.fmt_slli.f |
646c6f2b | 2533 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2534 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2535 | |
190659a2 DE |
2536 | { |
2537 | SI opval = SLLSI (* FLD (f_r1), FLD (f_uimm5)); | |
2538 | * FLD (f_r1) = opval; | |
2539 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2540 | } | |
b8a9943d | 2541 | |
a8981d67 DE |
2542 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2543 | ||
646c6f2b DE |
2544 | #if WITH_PROFILE_MODEL_P |
2545 | if (PROFILE_MODEL_P (current_cpu)) | |
2546 | { | |
190659a2 DE |
2547 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2548 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
2549 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2550 | } |
2551 | #endif | |
b8a9943d | 2552 | |
646c6f2b DE |
2553 | return new_pc; |
2554 | #undef FLD | |
2555 | } | |
2556 | ||
a8981d67 DE |
2557 | /* sra: sra $dr,$sr. */ |
2558 | ||
646c6f2b | 2559 | CIA |
190659a2 | 2560 | SEM_FN_NAME (m32rb,sra) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2561 | { |
970a8fd6 | 2562 | #define FLD(f) abuf->fields.fmt_add.f |
646c6f2b | 2563 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2564 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2565 | |
190659a2 DE |
2566 | { |
2567 | SI opval = SRASI (* FLD (f_r1), ANDSI (* FLD (f_r2), 31)); | |
2568 | * FLD (f_r1) = opval; | |
2569 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2570 | } | |
b8a9943d | 2571 | |
a8981d67 DE |
2572 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2573 | ||
646c6f2b DE |
2574 | #if WITH_PROFILE_MODEL_P |
2575 | if (PROFILE_MODEL_P (current_cpu)) | |
2576 | { | |
190659a2 DE |
2577 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2578 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
2579 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2580 | } |
2581 | #endif | |
b8a9943d | 2582 | |
646c6f2b DE |
2583 | return new_pc; |
2584 | #undef FLD | |
2585 | } | |
2586 | ||
a8981d67 DE |
2587 | /* sra3: sra3 $dr,$sr,$simm16. */ |
2588 | ||
646c6f2b | 2589 | CIA |
190659a2 | 2590 | SEM_FN_NAME (m32rb,sra3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2591 | { |
970a8fd6 | 2592 | #define FLD(f) abuf->fields.fmt_sll3.f |
646c6f2b | 2593 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2594 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 2595 | |
190659a2 DE |
2596 | { |
2597 | SI opval = SRASI (* FLD (f_r2), ANDSI (FLD (f_simm16), 31)); | |
2598 | * FLD (f_r1) = opval; | |
2599 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2600 | } | |
b8a9943d | 2601 | |
a8981d67 DE |
2602 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2603 | ||
646c6f2b DE |
2604 | #if WITH_PROFILE_MODEL_P |
2605 | if (PROFILE_MODEL_P (current_cpu)) | |
2606 | { | |
190659a2 DE |
2607 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2608 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
2609 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2610 | } |
2611 | #endif | |
b8a9943d | 2612 | |
646c6f2b DE |
2613 | return new_pc; |
2614 | #undef FLD | |
2615 | } | |
2616 | ||
a8981d67 DE |
2617 | /* srai: srai $dr,$uimm5. */ |
2618 | ||
646c6f2b | 2619 | CIA |
190659a2 | 2620 | SEM_FN_NAME (m32rb,srai) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2621 | { |
970a8fd6 | 2622 | #define FLD(f) abuf->fields.fmt_slli.f |
646c6f2b | 2623 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2624 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2625 | |
190659a2 DE |
2626 | { |
2627 | SI opval = SRASI (* FLD (f_r1), FLD (f_uimm5)); | |
2628 | * FLD (f_r1) = opval; | |
2629 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2630 | } | |
b8a9943d | 2631 | |
a8981d67 DE |
2632 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2633 | ||
646c6f2b DE |
2634 | #if WITH_PROFILE_MODEL_P |
2635 | if (PROFILE_MODEL_P (current_cpu)) | |
2636 | { | |
190659a2 DE |
2637 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2638 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
2639 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2640 | } |
2641 | #endif | |
b8a9943d | 2642 | |
646c6f2b DE |
2643 | return new_pc; |
2644 | #undef FLD | |
2645 | } | |
2646 | ||
a8981d67 DE |
2647 | /* srl: srl $dr,$sr. */ |
2648 | ||
646c6f2b | 2649 | CIA |
190659a2 | 2650 | SEM_FN_NAME (m32rb,srl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2651 | { |
970a8fd6 | 2652 | #define FLD(f) abuf->fields.fmt_add.f |
646c6f2b | 2653 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2654 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2655 | |
190659a2 DE |
2656 | { |
2657 | SI opval = SRLSI (* FLD (f_r1), ANDSI (* FLD (f_r2), 31)); | |
2658 | * FLD (f_r1) = opval; | |
2659 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2660 | } | |
b8a9943d | 2661 | |
a8981d67 DE |
2662 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2663 | ||
646c6f2b DE |
2664 | #if WITH_PROFILE_MODEL_P |
2665 | if (PROFILE_MODEL_P (current_cpu)) | |
2666 | { | |
190659a2 DE |
2667 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2668 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
2669 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2670 | } |
2671 | #endif | |
b8a9943d | 2672 | |
646c6f2b DE |
2673 | return new_pc; |
2674 | #undef FLD | |
2675 | } | |
2676 | ||
a8981d67 DE |
2677 | /* srl3: srl3 $dr,$sr,$simm16. */ |
2678 | ||
646c6f2b | 2679 | CIA |
190659a2 | 2680 | SEM_FN_NAME (m32rb,srl3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2681 | { |
970a8fd6 | 2682 | #define FLD(f) abuf->fields.fmt_sll3.f |
646c6f2b | 2683 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2684 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 2685 | |
190659a2 DE |
2686 | { |
2687 | SI opval = SRLSI (* FLD (f_r2), ANDSI (FLD (f_simm16), 31)); | |
2688 | * FLD (f_r1) = opval; | |
2689 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2690 | } | |
b8a9943d | 2691 | |
a8981d67 DE |
2692 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2693 | ||
646c6f2b DE |
2694 | #if WITH_PROFILE_MODEL_P |
2695 | if (PROFILE_MODEL_P (current_cpu)) | |
2696 | { | |
190659a2 DE |
2697 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2698 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
2699 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2700 | } |
2701 | #endif | |
b8a9943d | 2702 | |
646c6f2b DE |
2703 | return new_pc; |
2704 | #undef FLD | |
2705 | } | |
2706 | ||
a8981d67 DE |
2707 | /* srli: srli $dr,$uimm5. */ |
2708 | ||
646c6f2b | 2709 | CIA |
190659a2 | 2710 | SEM_FN_NAME (m32rb,srli) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2711 | { |
970a8fd6 | 2712 | #define FLD(f) abuf->fields.fmt_slli.f |
646c6f2b | 2713 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2714 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2715 | |
190659a2 DE |
2716 | { |
2717 | SI opval = SRLSI (* FLD (f_r1), FLD (f_uimm5)); | |
2718 | * FLD (f_r1) = opval; | |
2719 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
2720 | } | |
b8a9943d | 2721 | |
a8981d67 DE |
2722 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2723 | ||
646c6f2b DE |
2724 | #if WITH_PROFILE_MODEL_P |
2725 | if (PROFILE_MODEL_P (current_cpu)) | |
2726 | { | |
190659a2 DE |
2727 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2728 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
2729 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2730 | } |
2731 | #endif | |
b8a9943d | 2732 | |
646c6f2b DE |
2733 | return new_pc; |
2734 | #undef FLD | |
2735 | } | |
2736 | ||
a8981d67 DE |
2737 | /* st: st $src1,@$src2. */ |
2738 | ||
646c6f2b | 2739 | CIA |
190659a2 | 2740 | SEM_FN_NAME (m32rb,st) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2741 | { |
970a8fd6 | 2742 | #define FLD(f) abuf->fields.fmt_st.f |
646c6f2b | 2743 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2744 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2745 | |
190659a2 DE |
2746 | { |
2747 | SI opval = * FLD (f_r1); | |
2748 | SETMEMSI (current_cpu, * FLD (f_r2), opval); | |
2749 | TRACE_RESULT (current_cpu, "memory", 'x', opval); | |
2750 | } | |
a8981d67 DE |
2751 | |
2752 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); | |
b8a9943d | 2753 | |
646c6f2b DE |
2754 | #if WITH_PROFILE_MODEL_P |
2755 | if (PROFILE_MODEL_P (current_cpu)) | |
2756 | { | |
190659a2 DE |
2757 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2758 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2759 | } |
2760 | #endif | |
b8a9943d | 2761 | |
646c6f2b DE |
2762 | return new_pc; |
2763 | #undef FLD | |
2764 | } | |
2765 | ||
a8981d67 DE |
2766 | /* st-d: st $src1,@($slo16,$src2). */ |
2767 | ||
646c6f2b | 2768 | CIA |
190659a2 | 2769 | SEM_FN_NAME (m32rb,st_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2770 | { |
970a8fd6 | 2771 | #define FLD(f) abuf->fields.fmt_st_d.f |
646c6f2b | 2772 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2773 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 2774 | |
190659a2 DE |
2775 | { |
2776 | SI opval = * FLD (f_r1); | |
2777 | SETMEMSI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), opval); | |
2778 | TRACE_RESULT (current_cpu, "memory", 'x', opval); | |
2779 | } | |
a8981d67 DE |
2780 | |
2781 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); | |
b8a9943d | 2782 | |
646c6f2b DE |
2783 | #if WITH_PROFILE_MODEL_P |
2784 | if (PROFILE_MODEL_P (current_cpu)) | |
2785 | { | |
190659a2 DE |
2786 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2787 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2788 | } |
2789 | #endif | |
b8a9943d | 2790 | |
646c6f2b DE |
2791 | return new_pc; |
2792 | #undef FLD | |
2793 | } | |
2794 | ||
a8981d67 DE |
2795 | /* stb: stb $src1,@$src2. */ |
2796 | ||
646c6f2b | 2797 | CIA |
190659a2 | 2798 | SEM_FN_NAME (m32rb,stb) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2799 | { |
970a8fd6 | 2800 | #define FLD(f) abuf->fields.fmt_stb.f |
646c6f2b | 2801 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2802 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2803 | |
190659a2 DE |
2804 | { |
2805 | QI opval = * FLD (f_r1); | |
2806 | SETMEMQI (current_cpu, * FLD (f_r2), opval); | |
2807 | TRACE_RESULT (current_cpu, "memory", 'x', opval); | |
2808 | } | |
a8981d67 DE |
2809 | |
2810 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); | |
b8a9943d | 2811 | |
646c6f2b DE |
2812 | #if WITH_PROFILE_MODEL_P |
2813 | if (PROFILE_MODEL_P (current_cpu)) | |
2814 | { | |
190659a2 DE |
2815 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2816 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2817 | } |
2818 | #endif | |
b8a9943d | 2819 | |
646c6f2b DE |
2820 | return new_pc; |
2821 | #undef FLD | |
2822 | } | |
2823 | ||
a8981d67 DE |
2824 | /* stb-d: stb $src1,@($slo16,$src2). */ |
2825 | ||
646c6f2b | 2826 | CIA |
190659a2 | 2827 | SEM_FN_NAME (m32rb,stb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2828 | { |
970a8fd6 | 2829 | #define FLD(f) abuf->fields.fmt_stb_d.f |
646c6f2b | 2830 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2831 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 2832 | |
190659a2 DE |
2833 | { |
2834 | QI opval = * FLD (f_r1); | |
2835 | SETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), opval); | |
2836 | TRACE_RESULT (current_cpu, "memory", 'x', opval); | |
2837 | } | |
a8981d67 DE |
2838 | |
2839 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); | |
b8a9943d | 2840 | |
646c6f2b DE |
2841 | #if WITH_PROFILE_MODEL_P |
2842 | if (PROFILE_MODEL_P (current_cpu)) | |
2843 | { | |
190659a2 DE |
2844 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2845 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2846 | } |
2847 | #endif | |
b8a9943d | 2848 | |
646c6f2b DE |
2849 | return new_pc; |
2850 | #undef FLD | |
2851 | } | |
2852 | ||
a8981d67 DE |
2853 | /* sth: sth $src1,@$src2. */ |
2854 | ||
646c6f2b | 2855 | CIA |
190659a2 | 2856 | SEM_FN_NAME (m32rb,sth) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2857 | { |
970a8fd6 | 2858 | #define FLD(f) abuf->fields.fmt_sth.f |
646c6f2b | 2859 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2860 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2861 | |
190659a2 DE |
2862 | { |
2863 | HI opval = * FLD (f_r1); | |
2864 | SETMEMHI (current_cpu, * FLD (f_r2), opval); | |
2865 | TRACE_RESULT (current_cpu, "memory", 'x', opval); | |
2866 | } | |
a8981d67 DE |
2867 | |
2868 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); | |
b8a9943d | 2869 | |
646c6f2b DE |
2870 | #if WITH_PROFILE_MODEL_P |
2871 | if (PROFILE_MODEL_P (current_cpu)) | |
2872 | { | |
190659a2 DE |
2873 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2874 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2875 | } |
2876 | #endif | |
b8a9943d | 2877 | |
646c6f2b DE |
2878 | return new_pc; |
2879 | #undef FLD | |
2880 | } | |
2881 | ||
a8981d67 DE |
2882 | /* sth-d: sth $src1,@($slo16,$src2). */ |
2883 | ||
646c6f2b | 2884 | CIA |
190659a2 | 2885 | SEM_FN_NAME (m32rb,sth_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2886 | { |
970a8fd6 | 2887 | #define FLD(f) abuf->fields.fmt_sth_d.f |
646c6f2b | 2888 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2889 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 2890 | |
190659a2 DE |
2891 | { |
2892 | HI opval = * FLD (f_r1); | |
2893 | SETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), opval); | |
2894 | TRACE_RESULT (current_cpu, "memory", 'x', opval); | |
2895 | } | |
a8981d67 DE |
2896 | |
2897 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); | |
b8a9943d | 2898 | |
646c6f2b DE |
2899 | #if WITH_PROFILE_MODEL_P |
2900 | if (PROFILE_MODEL_P (current_cpu)) | |
2901 | { | |
190659a2 DE |
2902 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2903 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2904 | } |
2905 | #endif | |
b8a9943d | 2906 | |
646c6f2b DE |
2907 | return new_pc; |
2908 | #undef FLD | |
2909 | } | |
2910 | ||
a8981d67 DE |
2911 | /* st-plus: st $src1,@+$src2. */ |
2912 | ||
646c6f2b | 2913 | CIA |
190659a2 | 2914 | SEM_FN_NAME (m32rb,st_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2915 | { |
970a8fd6 | 2916 | #define FLD(f) abuf->fields.fmt_st_plus.f |
646c6f2b | 2917 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2918 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2919 | |
9d70630e | 2920 | do { |
02310b01 DE |
2921 | SI tmp_new_src2; |
2922 | tmp_new_src2 = ADDSI (* FLD (f_r2), 4); | |
190659a2 DE |
2923 | { |
2924 | SI opval = * FLD (f_r1); | |
2925 | SETMEMSI (current_cpu, tmp_new_src2, opval); | |
2926 | TRACE_RESULT (current_cpu, "memory", 'x', opval); | |
2927 | } | |
2928 | { | |
2929 | SI opval = tmp_new_src2; | |
2930 | * FLD (f_r2) = opval; | |
2931 | TRACE_RESULT (current_cpu, "src2", 'x', opval); | |
2932 | } | |
9d70630e | 2933 | } while (0); |
b8a9943d | 2934 | |
a8981d67 DE |
2935 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2936 | ||
646c6f2b DE |
2937 | #if WITH_PROFILE_MODEL_P |
2938 | if (PROFILE_MODEL_P (current_cpu)) | |
2939 | { | |
190659a2 DE |
2940 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2941 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
2942 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2943 | } |
2944 | #endif | |
b8a9943d | 2945 | |
646c6f2b DE |
2946 | return new_pc; |
2947 | #undef FLD | |
2948 | } | |
2949 | ||
a8981d67 DE |
2950 | /* st-minus: st $src1,@-$src2. */ |
2951 | ||
646c6f2b | 2952 | CIA |
190659a2 | 2953 | SEM_FN_NAME (m32rb,st_minus) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2954 | { |
970a8fd6 | 2955 | #define FLD(f) abuf->fields.fmt_st_plus.f |
646c6f2b | 2956 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2957 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2958 | |
9d70630e | 2959 | do { |
02310b01 DE |
2960 | SI tmp_new_src2; |
2961 | tmp_new_src2 = SUBSI (* FLD (f_r2), 4); | |
190659a2 DE |
2962 | { |
2963 | SI opval = * FLD (f_r1); | |
2964 | SETMEMSI (current_cpu, tmp_new_src2, opval); | |
2965 | TRACE_RESULT (current_cpu, "memory", 'x', opval); | |
2966 | } | |
2967 | { | |
2968 | SI opval = tmp_new_src2; | |
2969 | * FLD (f_r2) = opval; | |
2970 | TRACE_RESULT (current_cpu, "src2", 'x', opval); | |
2971 | } | |
9d70630e | 2972 | } while (0); |
b8a9943d | 2973 | |
a8981d67 DE |
2974 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
2975 | ||
646c6f2b DE |
2976 | #if WITH_PROFILE_MODEL_P |
2977 | if (PROFILE_MODEL_P (current_cpu)) | |
2978 | { | |
190659a2 DE |
2979 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
2980 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
2981 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
2982 | } |
2983 | #endif | |
b8a9943d | 2984 | |
646c6f2b DE |
2985 | return new_pc; |
2986 | #undef FLD | |
2987 | } | |
2988 | ||
a8981d67 DE |
2989 | /* sub: sub $dr,$sr. */ |
2990 | ||
646c6f2b | 2991 | CIA |
190659a2 | 2992 | SEM_FN_NAME (m32rb,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2993 | { |
970a8fd6 | 2994 | #define FLD(f) abuf->fields.fmt_add.f |
646c6f2b | 2995 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2996 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2997 | |
190659a2 DE |
2998 | { |
2999 | SI opval = SUBSI (* FLD (f_r1), * FLD (f_r2)); | |
3000 | * FLD (f_r1) = opval; | |
3001 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
3002 | } | |
b8a9943d | 3003 | |
a8981d67 DE |
3004 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3005 | ||
646c6f2b DE |
3006 | #if WITH_PROFILE_MODEL_P |
3007 | if (PROFILE_MODEL_P (current_cpu)) | |
3008 | { | |
190659a2 DE |
3009 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
3010 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
3011 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
3012 | } |
3013 | #endif | |
b8a9943d | 3014 | |
646c6f2b DE |
3015 | return new_pc; |
3016 | #undef FLD | |
3017 | } | |
3018 | ||
a8981d67 DE |
3019 | /* subv: subv $dr,$sr. */ |
3020 | ||
646c6f2b | 3021 | CIA |
190659a2 | 3022 | SEM_FN_NAME (m32rb,subv) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 3023 | { |
970a8fd6 | 3024 | #define FLD(f) abuf->fields.fmt_addv.f |
646c6f2b | 3025 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3026 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 3027 | |
646c6f2b | 3028 | do { |
a040908c | 3029 | UBI temp1;SI temp0; |
9d70630e DE |
3030 | temp0 = SUBSI (* FLD (f_r1), * FLD (f_r2)); |
3031 | temp1 = SUBOFSI (* FLD (f_r1), * FLD (f_r2), 0); | |
190659a2 DE |
3032 | { |
3033 | SI opval = temp0; | |
3034 | * FLD (f_r1) = opval; | |
3035 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
3036 | } | |
3037 | { | |
3038 | UBI opval = temp1; | |
3039 | CPU (h_cond) = opval; | |
3040 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
3041 | } | |
646c6f2b | 3042 | } while (0); |
b8a9943d | 3043 | |
a8981d67 DE |
3044 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3045 | ||
646c6f2b DE |
3046 | #if WITH_PROFILE_MODEL_P |
3047 | if (PROFILE_MODEL_P (current_cpu)) | |
3048 | { | |
190659a2 DE |
3049 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
3050 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
3051 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
3052 | } |
3053 | #endif | |
b8a9943d | 3054 | |
646c6f2b DE |
3055 | return new_pc; |
3056 | #undef FLD | |
3057 | } | |
3058 | ||
a8981d67 DE |
3059 | /* subx: subx $dr,$sr. */ |
3060 | ||
646c6f2b | 3061 | CIA |
190659a2 | 3062 | SEM_FN_NAME (m32rb,subx) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 3063 | { |
970a8fd6 | 3064 | #define FLD(f) abuf->fields.fmt_addx.f |
646c6f2b | 3065 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3066 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 3067 | |
646c6f2b | 3068 | do { |
a040908c | 3069 | UBI temp1;SI temp0; |
9d70630e DE |
3070 | temp0 = SUBCSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond)); |
3071 | temp1 = SUBCFSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond)); | |
190659a2 DE |
3072 | { |
3073 | SI opval = temp0; | |
3074 | * FLD (f_r1) = opval; | |
3075 | TRACE_RESULT (current_cpu, "dr", 'x', opval); | |
3076 | } | |
3077 | { | |
3078 | UBI opval = temp1; | |
3079 | CPU (h_cond) = opval; | |
3080 | TRACE_RESULT (current_cpu, "condbit", 'x', opval); | |
3081 | } | |
646c6f2b | 3082 | } while (0); |
b8a9943d | 3083 | |
a8981d67 DE |
3084 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3085 | ||
646c6f2b DE |
3086 | #if WITH_PROFILE_MODEL_P |
3087 | if (PROFILE_MODEL_P (current_cpu)) | |
3088 | { | |
190659a2 DE |
3089 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
3090 | m32rb_model_mark_set_h_gr (current_cpu, abuf); | |
3091 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
3092 | } |
3093 | #endif | |
b8a9943d | 3094 | |
646c6f2b DE |
3095 | return new_pc; |
3096 | #undef FLD | |
3097 | } | |
3098 | ||
a8981d67 DE |
3099 | /* trap: trap $uimm4. */ |
3100 | ||
646c6f2b | 3101 | CIA |
190659a2 | 3102 | SEM_FN_NAME (m32rb,trap) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 3103 | { |
970a8fd6 | 3104 | #define FLD(f) abuf->fields.fmt_trap.f |
646c6f2b | 3105 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3106 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
646c6f2b | 3107 | int taken_p = 0; |
b8a9943d | 3108 | |
cab58155 | 3109 | do { |
190659a2 DE |
3110 | { |
3111 | USI opval = ADDSI (CPU (h_pc), 4); | |
3112 | m32rb_h_cr_set (current_cpu, ((HOSTUINT) 6), opval); | |
3113 | TRACE_RESULT (current_cpu, "cr-6", 'x', opval); | |
3114 | } | |
3115 | { | |
3116 | USI opval = ANDSI (SLLSI (m32rb_h_cr_get (current_cpu, ((HOSTUINT) 0)), 8), 65408); | |
3117 | m32rb_h_cr_set (current_cpu, ((HOSTUINT) 0), opval); | |
3118 | TRACE_RESULT (current_cpu, "cr-0", 'x', opval); | |
3119 | } | |
3120 | { | |
3121 | SI opval = m32r_trap (current_cpu, CPU (h_pc), FLD (f_uimm4)); | |
3122 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval)); | |
3123 | taken_p = 1; | |
3124 | TRACE_RESULT (current_cpu, "pc", 'x', opval); | |
3125 | } | |
cab58155 | 3126 | } while (0); |
b8a9943d | 3127 | |
a8981d67 DE |
3128 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3129 | ||
646c6f2b DE |
3130 | #if WITH_PROFILE_MODEL_P |
3131 | if (PROFILE_MODEL_P (current_cpu)) | |
3132 | { | |
190659a2 | 3133 | m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
3134 | } |
3135 | #endif | |
b8a9943d | 3136 | |
646c6f2b DE |
3137 | return new_pc; |
3138 | #undef FLD | |
3139 | } | |
3140 | ||
a8981d67 DE |
3141 | /* unlock: unlock $src1,@$src2. */ |
3142 | ||
646c6f2b | 3143 | CIA |
190659a2 | 3144 | SEM_FN_NAME (m32rb,unlock) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 3145 | { |
970a8fd6 | 3146 | #define FLD(f) abuf->fields.fmt_unlock.f |
646c6f2b | 3147 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 3148 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 3149 | |
cab58155 DE |
3150 | do { |
3151 | if (CPU (h_lock)) { | |
190659a2 DE |
3152 | { |
3153 | SI opval = * FLD (f_r1); | |
3154 | SETMEMSI (current_cpu, * FLD (f_r2), opval); | |
3155 | TRACE_RESULT (current_cpu, "memory", 'x', opval); | |
3156 | } | |
3157 | } | |
3158 | { | |
3159 | UBI opval = 0; | |
3160 | CPU (h_lock) = opval; | |
3161 | TRACE_RESULT (current_cpu, "lock-0", 'x', opval); | |
3162 | } | |
cab58155 | 3163 | } while (0); |
b8a9943d | 3164 | |
a8981d67 DE |
3165 | PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num); |
3166 | ||
646c6f2b DE |
3167 | #if WITH_PROFILE_MODEL_P |
3168 | if (PROFILE_MODEL_P (current_cpu)) | |
3169 | { | |
190659a2 DE |
3170 | m32rb_model_mark_get_h_gr (current_cpu, abuf); |
3171 | m32rb_model_profile_insn (current_cpu, abuf); | |
646c6f2b DE |
3172 | } |
3173 | #endif | |
b8a9943d | 3174 | |
646c6f2b DE |
3175 | return new_pc; |
3176 | #undef FLD | |
3177 | } | |
3178 | ||
e0bd6e18 | 3179 | CIA |
190659a2 | 3180 | SEM_FN_NAME (m32rb,illegal) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
9d70630e DE |
3181 | { |
3182 | sim_engine_illegal_insn (current_cpu, NULL_CIA /*FIXME*/); | |
3183 | return 0; | |
3184 | } | |
3185 | ||
a040908c | 3186 | #endif /* WANT_CPU */ |