Commit | Line | Data |
---|---|---|
646c6f2b DE |
1 | /* Simulator instruction semantics for m32r. |
2 | ||
b8a9943d DE |
3 | This file is machine generated with CGEN. |
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 DE |
25 | #define WANT_CPU |
26 | #define WANT_CPU_M32R | |
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 | ||
9d70630e DE |
33 | #if ! defined (SCACHE_P) || (defined (SCACHE_P) && WITH_SCACHE) |
34 | ||
35 | #undef GET_ATTR | |
36 | #define GET_ATTR(cpu, num, attr) CGEN_INSN_ATTR (abuf->opcode, CGEN_INSN_##attr) | |
37 | ||
646c6f2b DE |
38 | /* Perform add: add $dr,$sr. */ |
39 | CIA | |
9d70630e | 40 | SEM_FN_NAME (m32r,add) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 41 | { |
970a8fd6 | 42 | #define FLD(f) abuf->fields.fmt_add.f |
646c6f2b | 43 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 44 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 45 | |
646c6f2b DE |
46 | * FLD (f_r1) = ADDSI (* FLD (f_r1), * FLD (f_r2)); |
47 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 48 | |
646c6f2b DE |
49 | #if WITH_PROFILE_MODEL_P |
50 | if (PROFILE_MODEL_P (current_cpu)) | |
51 | { | |
9d70630e DE |
52 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
53 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 54 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
55 | } |
56 | #endif | |
b8a9943d | 57 | |
646c6f2b DE |
58 | return new_pc; |
59 | #undef FLD | |
60 | } | |
61 | ||
970a8fd6 | 62 | /* Perform add3: add3 $dr,$sr,$hash$slo16. */ |
646c6f2b | 63 | CIA |
9d70630e | 64 | SEM_FN_NAME (m32r,add3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 65 | { |
970a8fd6 | 66 | #define FLD(f) abuf->fields.fmt_add3.f |
646c6f2b | 67 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 68 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 69 | |
646c6f2b DE |
70 | * FLD (f_r1) = ADDSI (* FLD (f_r2), FLD (f_simm16)); |
71 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 72 | |
646c6f2b DE |
73 | #if WITH_PROFILE_MODEL_P |
74 | if (PROFILE_MODEL_P (current_cpu)) | |
75 | { | |
9d70630e DE |
76 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
77 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 78 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
79 | } |
80 | #endif | |
b8a9943d | 81 | |
646c6f2b DE |
82 | return new_pc; |
83 | #undef FLD | |
84 | } | |
85 | ||
86 | /* Perform and: and $dr,$sr. */ | |
87 | CIA | |
9d70630e | 88 | SEM_FN_NAME (m32r,and) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 89 | { |
970a8fd6 | 90 | #define FLD(f) abuf->fields.fmt_add.f |
646c6f2b | 91 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 92 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 93 | |
646c6f2b DE |
94 | * FLD (f_r1) = ANDSI (* FLD (f_r1), * FLD (f_r2)); |
95 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 96 | |
646c6f2b DE |
97 | #if WITH_PROFILE_MODEL_P |
98 | if (PROFILE_MODEL_P (current_cpu)) | |
99 | { | |
9d70630e DE |
100 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
101 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 102 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
103 | } |
104 | #endif | |
b8a9943d | 105 | |
646c6f2b DE |
106 | return new_pc; |
107 | #undef FLD | |
108 | } | |
109 | ||
970a8fd6 | 110 | /* Perform and3: and3 $dr,$sr,$uimm16. */ |
646c6f2b | 111 | CIA |
9d70630e | 112 | SEM_FN_NAME (m32r,and3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 113 | { |
970a8fd6 | 114 | #define FLD(f) abuf->fields.fmt_and3.f |
646c6f2b | 115 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 116 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 117 | |
646c6f2b DE |
118 | * FLD (f_r1) = ANDSI (* FLD (f_r2), FLD (f_uimm16)); |
119 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 120 | |
646c6f2b DE |
121 | #if WITH_PROFILE_MODEL_P |
122 | if (PROFILE_MODEL_P (current_cpu)) | |
123 | { | |
9d70630e DE |
124 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
125 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 126 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
127 | } |
128 | #endif | |
b8a9943d | 129 | |
646c6f2b DE |
130 | return new_pc; |
131 | #undef FLD | |
132 | } | |
133 | ||
134 | /* Perform or: or $dr,$sr. */ | |
135 | CIA | |
9d70630e | 136 | SEM_FN_NAME (m32r,or) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 137 | { |
970a8fd6 | 138 | #define FLD(f) abuf->fields.fmt_add.f |
646c6f2b | 139 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 140 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 141 | |
646c6f2b DE |
142 | * FLD (f_r1) = ORSI (* FLD (f_r1), * FLD (f_r2)); |
143 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 144 | |
646c6f2b DE |
145 | #if WITH_PROFILE_MODEL_P |
146 | if (PROFILE_MODEL_P (current_cpu)) | |
147 | { | |
9d70630e DE |
148 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
149 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 150 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
151 | } |
152 | #endif | |
b8a9943d | 153 | |
646c6f2b DE |
154 | return new_pc; |
155 | #undef FLD | |
156 | } | |
157 | ||
970a8fd6 | 158 | /* Perform or3: or3 $dr,$sr,$hash$ulo16. */ |
646c6f2b | 159 | CIA |
9d70630e | 160 | SEM_FN_NAME (m32r,or3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 161 | { |
970a8fd6 | 162 | #define FLD(f) abuf->fields.fmt_or3.f |
646c6f2b | 163 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 164 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 165 | |
646c6f2b DE |
166 | * FLD (f_r1) = ORSI (* FLD (f_r2), FLD (f_uimm16)); |
167 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 168 | |
646c6f2b DE |
169 | #if WITH_PROFILE_MODEL_P |
170 | if (PROFILE_MODEL_P (current_cpu)) | |
171 | { | |
9d70630e DE |
172 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
173 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 174 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
175 | } |
176 | #endif | |
b8a9943d | 177 | |
646c6f2b DE |
178 | return new_pc; |
179 | #undef FLD | |
180 | } | |
181 | ||
182 | /* Perform xor: xor $dr,$sr. */ | |
183 | CIA | |
9d70630e | 184 | SEM_FN_NAME (m32r,xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 185 | { |
970a8fd6 | 186 | #define FLD(f) abuf->fields.fmt_add.f |
646c6f2b | 187 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 188 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 189 | |
646c6f2b DE |
190 | * FLD (f_r1) = XORSI (* FLD (f_r1), * FLD (f_r2)); |
191 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 192 | |
646c6f2b DE |
193 | #if WITH_PROFILE_MODEL_P |
194 | if (PROFILE_MODEL_P (current_cpu)) | |
195 | { | |
9d70630e DE |
196 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
197 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 198 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
199 | } |
200 | #endif | |
b8a9943d | 201 | |
646c6f2b DE |
202 | return new_pc; |
203 | #undef FLD | |
204 | } | |
205 | ||
970a8fd6 | 206 | /* Perform xor3: xor3 $dr,$sr,$uimm16. */ |
646c6f2b | 207 | CIA |
9d70630e | 208 | SEM_FN_NAME (m32r,xor3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 209 | { |
970a8fd6 | 210 | #define FLD(f) abuf->fields.fmt_and3.f |
646c6f2b | 211 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 212 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 213 | |
646c6f2b DE |
214 | * FLD (f_r1) = XORSI (* FLD (f_r2), FLD (f_uimm16)); |
215 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 216 | |
646c6f2b DE |
217 | #if WITH_PROFILE_MODEL_P |
218 | if (PROFILE_MODEL_P (current_cpu)) | |
219 | { | |
9d70630e DE |
220 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
221 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 222 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
223 | } |
224 | #endif | |
b8a9943d | 225 | |
646c6f2b DE |
226 | return new_pc; |
227 | #undef FLD | |
228 | } | |
229 | ||
970a8fd6 | 230 | /* Perform addi: addi $dr,$simm8. */ |
646c6f2b | 231 | CIA |
9d70630e | 232 | SEM_FN_NAME (m32r,addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 233 | { |
970a8fd6 | 234 | #define FLD(f) abuf->fields.fmt_addi.f |
646c6f2b | 235 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 236 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 237 | |
646c6f2b DE |
238 | * FLD (f_r1) = ADDSI (* FLD (f_r1), FLD (f_simm8)); |
239 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 240 | |
646c6f2b DE |
241 | #if WITH_PROFILE_MODEL_P |
242 | if (PROFILE_MODEL_P (current_cpu)) | |
243 | { | |
9d70630e DE |
244 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
245 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 246 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
247 | } |
248 | #endif | |
b8a9943d | 249 | |
646c6f2b DE |
250 | return new_pc; |
251 | #undef FLD | |
252 | } | |
253 | ||
254 | /* Perform addv: addv $dr,$sr. */ | |
255 | CIA | |
9d70630e | 256 | SEM_FN_NAME (m32r,addv) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 257 | { |
970a8fd6 | 258 | #define FLD(f) abuf->fields.fmt_addv.f |
646c6f2b | 259 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 260 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 261 | |
646c6f2b DE |
262 | do { |
263 | BI temp1;SI temp0; | |
9d70630e DE |
264 | temp0 = ADDSI (* FLD (f_r1), * FLD (f_r2)); |
265 | temp1 = ADDOFSI (* FLD (f_r1), * FLD (f_r2), 0); | |
646c6f2b DE |
266 | * FLD (f_r1) = temp0; |
267 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
9d70630e DE |
268 | CPU (h_cond) = temp1; |
269 | TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); | |
646c6f2b | 270 | } while (0); |
b8a9943d | 271 | |
646c6f2b DE |
272 | #if WITH_PROFILE_MODEL_P |
273 | if (PROFILE_MODEL_P (current_cpu)) | |
274 | { | |
9d70630e DE |
275 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
276 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 277 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
278 | } |
279 | #endif | |
b8a9943d | 280 | |
646c6f2b DE |
281 | return new_pc; |
282 | #undef FLD | |
283 | } | |
284 | ||
970a8fd6 | 285 | /* Perform addv3: addv3 $dr,$sr,$simm16. */ |
646c6f2b | 286 | CIA |
9d70630e | 287 | SEM_FN_NAME (m32r,addv3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 288 | { |
970a8fd6 | 289 | #define FLD(f) abuf->fields.fmt_addv3.f |
646c6f2b | 290 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 291 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 292 | |
646c6f2b DE |
293 | do { |
294 | BI temp1;SI temp0; | |
9d70630e DE |
295 | temp0 = ADDSI (* FLD (f_r2), FLD (f_simm16)); |
296 | temp1 = ADDOFSI (* FLD (f_r2), FLD (f_simm16), 0); | |
646c6f2b DE |
297 | * FLD (f_r1) = temp0; |
298 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
9d70630e DE |
299 | CPU (h_cond) = temp1; |
300 | TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); | |
646c6f2b | 301 | } while (0); |
b8a9943d | 302 | |
646c6f2b DE |
303 | #if WITH_PROFILE_MODEL_P |
304 | if (PROFILE_MODEL_P (current_cpu)) | |
305 | { | |
9d70630e DE |
306 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
307 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 308 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
309 | } |
310 | #endif | |
b8a9943d | 311 | |
646c6f2b DE |
312 | return new_pc; |
313 | #undef FLD | |
314 | } | |
315 | ||
316 | /* Perform addx: addx $dr,$sr. */ | |
317 | CIA | |
9d70630e | 318 | SEM_FN_NAME (m32r,addx) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 319 | { |
970a8fd6 | 320 | #define FLD(f) abuf->fields.fmt_addx.f |
646c6f2b | 321 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 322 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 323 | |
646c6f2b DE |
324 | do { |
325 | BI temp1;SI temp0; | |
9d70630e DE |
326 | temp0 = ADDCSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond)); |
327 | temp1 = ADDCFSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond)); | |
646c6f2b DE |
328 | * FLD (f_r1) = temp0; |
329 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
9d70630e DE |
330 | CPU (h_cond) = temp1; |
331 | TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); | |
646c6f2b | 332 | } while (0); |
b8a9943d | 333 | |
646c6f2b DE |
334 | #if WITH_PROFILE_MODEL_P |
335 | if (PROFILE_MODEL_P (current_cpu)) | |
336 | { | |
9d70630e DE |
337 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
338 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 339 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
340 | } |
341 | #endif | |
b8a9943d | 342 | |
646c6f2b DE |
343 | return new_pc; |
344 | #undef FLD | |
345 | } | |
346 | ||
347 | /* Perform bc8: bc $disp8. */ | |
348 | CIA | |
9d70630e | 349 | SEM_FN_NAME (m32r,bc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 350 | { |
970a8fd6 | 351 | #define FLD(f) abuf->fields.fmt_bc8.f |
646c6f2b | 352 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 353 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
646c6f2b | 354 | int taken_p = 0; |
b8a9943d | 355 | |
9d70630e | 356 | if (CPU (h_cond)) { |
02310b01 | 357 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp8))); |
646c6f2b | 358 | taken_p = 1; |
cab58155 | 359 | TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); |
646c6f2b | 360 | } |
b8a9943d | 361 | |
646c6f2b DE |
362 | #if WITH_PROFILE_MODEL_P |
363 | if (PROFILE_MODEL_P (current_cpu)) | |
364 | { | |
b8a9943d | 365 | m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
366 | } |
367 | #endif | |
b8a9943d | 368 | |
646c6f2b DE |
369 | return new_pc; |
370 | #undef FLD | |
371 | } | |
372 | ||
373 | /* Perform bc24: bc $disp24. */ | |
374 | CIA | |
9d70630e | 375 | SEM_FN_NAME (m32r,bc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 376 | { |
970a8fd6 | 377 | #define FLD(f) abuf->fields.fmt_bc24.f |
646c6f2b | 378 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 379 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 380 | int taken_p = 0; |
b8a9943d | 381 | |
9d70630e | 382 | if (CPU (h_cond)) { |
02310b01 | 383 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp24))); |
646c6f2b | 384 | taken_p = 1; |
cab58155 | 385 | TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); |
646c6f2b | 386 | } |
b8a9943d | 387 | |
646c6f2b DE |
388 | #if WITH_PROFILE_MODEL_P |
389 | if (PROFILE_MODEL_P (current_cpu)) | |
390 | { | |
b8a9943d | 391 | m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
392 | } |
393 | #endif | |
b8a9943d | 394 | |
646c6f2b DE |
395 | return new_pc; |
396 | #undef FLD | |
397 | } | |
398 | ||
399 | /* Perform beq: beq $src1,$src2,$disp16. */ | |
400 | CIA | |
9d70630e | 401 | SEM_FN_NAME (m32r,beq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 402 | { |
970a8fd6 | 403 | #define FLD(f) abuf->fields.fmt_beq.f |
646c6f2b | 404 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 405 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 406 | int taken_p = 0; |
b8a9943d | 407 | |
9d70630e | 408 | if (EQSI (* FLD (f_r1), * FLD (f_r2))) { |
02310b01 | 409 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); |
646c6f2b | 410 | taken_p = 1; |
cab58155 | 411 | TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); |
646c6f2b | 412 | } |
b8a9943d | 413 | |
646c6f2b DE |
414 | #if WITH_PROFILE_MODEL_P |
415 | if (PROFILE_MODEL_P (current_cpu)) | |
416 | { | |
9d70630e | 417 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 418 | m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
419 | } |
420 | #endif | |
b8a9943d | 421 | |
646c6f2b DE |
422 | return new_pc; |
423 | #undef FLD | |
424 | } | |
425 | ||
426 | /* Perform beqz: beqz $src2,$disp16. */ | |
427 | CIA | |
9d70630e | 428 | SEM_FN_NAME (m32r,beqz) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 429 | { |
970a8fd6 | 430 | #define FLD(f) abuf->fields.fmt_beqz.f |
646c6f2b | 431 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 432 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 433 | int taken_p = 0; |
b8a9943d | 434 | |
9d70630e | 435 | if (EQSI (* FLD (f_r2), 0)) { |
02310b01 | 436 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); |
646c6f2b | 437 | taken_p = 1; |
cab58155 | 438 | TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); |
646c6f2b | 439 | } |
b8a9943d | 440 | |
646c6f2b DE |
441 | #if WITH_PROFILE_MODEL_P |
442 | if (PROFILE_MODEL_P (current_cpu)) | |
443 | { | |
9d70630e | 444 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 445 | m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
446 | } |
447 | #endif | |
b8a9943d | 448 | |
646c6f2b DE |
449 | return new_pc; |
450 | #undef FLD | |
451 | } | |
452 | ||
453 | /* Perform bgez: bgez $src2,$disp16. */ | |
454 | CIA | |
9d70630e | 455 | SEM_FN_NAME (m32r,bgez) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 456 | { |
970a8fd6 | 457 | #define FLD(f) abuf->fields.fmt_beqz.f |
646c6f2b | 458 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 459 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 460 | int taken_p = 0; |
b8a9943d | 461 | |
9d70630e | 462 | if (GESI (* FLD (f_r2), 0)) { |
02310b01 | 463 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); |
646c6f2b | 464 | taken_p = 1; |
cab58155 | 465 | TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); |
646c6f2b | 466 | } |
b8a9943d | 467 | |
646c6f2b DE |
468 | #if WITH_PROFILE_MODEL_P |
469 | if (PROFILE_MODEL_P (current_cpu)) | |
470 | { | |
9d70630e | 471 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 472 | m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
473 | } |
474 | #endif | |
b8a9943d | 475 | |
646c6f2b DE |
476 | return new_pc; |
477 | #undef FLD | |
478 | } | |
479 | ||
480 | /* Perform bgtz: bgtz $src2,$disp16. */ | |
481 | CIA | |
9d70630e | 482 | SEM_FN_NAME (m32r,bgtz) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 483 | { |
970a8fd6 | 484 | #define FLD(f) abuf->fields.fmt_beqz.f |
646c6f2b | 485 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 486 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 487 | int taken_p = 0; |
b8a9943d | 488 | |
9d70630e | 489 | if (GTSI (* FLD (f_r2), 0)) { |
02310b01 | 490 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); |
646c6f2b | 491 | taken_p = 1; |
cab58155 | 492 | TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); |
646c6f2b | 493 | } |
b8a9943d | 494 | |
646c6f2b DE |
495 | #if WITH_PROFILE_MODEL_P |
496 | if (PROFILE_MODEL_P (current_cpu)) | |
497 | { | |
9d70630e | 498 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 499 | m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
500 | } |
501 | #endif | |
b8a9943d | 502 | |
646c6f2b DE |
503 | return new_pc; |
504 | #undef FLD | |
505 | } | |
506 | ||
507 | /* Perform blez: blez $src2,$disp16. */ | |
508 | CIA | |
9d70630e | 509 | SEM_FN_NAME (m32r,blez) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 510 | { |
970a8fd6 | 511 | #define FLD(f) abuf->fields.fmt_beqz.f |
646c6f2b | 512 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 513 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 514 | int taken_p = 0; |
b8a9943d | 515 | |
9d70630e | 516 | if (LESI (* FLD (f_r2), 0)) { |
02310b01 | 517 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); |
646c6f2b | 518 | taken_p = 1; |
cab58155 | 519 | TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); |
646c6f2b | 520 | } |
b8a9943d | 521 | |
646c6f2b DE |
522 | #if WITH_PROFILE_MODEL_P |
523 | if (PROFILE_MODEL_P (current_cpu)) | |
524 | { | |
9d70630e | 525 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 526 | m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
527 | } |
528 | #endif | |
b8a9943d | 529 | |
646c6f2b DE |
530 | return new_pc; |
531 | #undef FLD | |
532 | } | |
533 | ||
534 | /* Perform bltz: bltz $src2,$disp16. */ | |
535 | CIA | |
9d70630e | 536 | SEM_FN_NAME (m32r,bltz) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 537 | { |
970a8fd6 | 538 | #define FLD(f) abuf->fields.fmt_beqz.f |
646c6f2b | 539 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 540 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 541 | int taken_p = 0; |
b8a9943d | 542 | |
9d70630e | 543 | if (LTSI (* FLD (f_r2), 0)) { |
02310b01 | 544 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); |
646c6f2b | 545 | taken_p = 1; |
cab58155 | 546 | TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); |
646c6f2b | 547 | } |
b8a9943d | 548 | |
646c6f2b DE |
549 | #if WITH_PROFILE_MODEL_P |
550 | if (PROFILE_MODEL_P (current_cpu)) | |
551 | { | |
9d70630e | 552 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 553 | m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
554 | } |
555 | #endif | |
b8a9943d | 556 | |
646c6f2b DE |
557 | return new_pc; |
558 | #undef FLD | |
559 | } | |
560 | ||
561 | /* Perform bnez: bnez $src2,$disp16. */ | |
562 | CIA | |
9d70630e | 563 | SEM_FN_NAME (m32r,bnez) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 564 | { |
970a8fd6 | 565 | #define FLD(f) abuf->fields.fmt_beqz.f |
646c6f2b | 566 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 567 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 568 | int taken_p = 0; |
b8a9943d | 569 | |
9d70630e | 570 | if (NESI (* FLD (f_r2), 0)) { |
02310b01 | 571 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); |
646c6f2b | 572 | taken_p = 1; |
cab58155 | 573 | TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); |
646c6f2b | 574 | } |
b8a9943d | 575 | |
646c6f2b DE |
576 | #if WITH_PROFILE_MODEL_P |
577 | if (PROFILE_MODEL_P (current_cpu)) | |
578 | { | |
9d70630e | 579 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 580 | m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
581 | } |
582 | #endif | |
b8a9943d | 583 | |
646c6f2b DE |
584 | return new_pc; |
585 | #undef FLD | |
586 | } | |
587 | ||
588 | /* Perform bl8: bl $disp8. */ | |
589 | CIA | |
9d70630e | 590 | SEM_FN_NAME (m32r,bl8) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 591 | { |
970a8fd6 | 592 | #define FLD(f) abuf->fields.fmt_bl8.f |
646c6f2b | 593 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 594 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
646c6f2b | 595 | int taken_p = 0; |
b8a9943d | 596 | |
9d70630e DE |
597 | do { |
598 | CPU (h_gr[14]) = ADDSI (ANDSI (CPU (h_pc), -4), 4); | |
b8a9943d | 599 | TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14])); |
02310b01 | 600 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp8))); |
646c6f2b | 601 | taken_p = 1; |
cab58155 | 602 | TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); |
9d70630e | 603 | } while (0); |
b8a9943d | 604 | |
646c6f2b DE |
605 | #if WITH_PROFILE_MODEL_P |
606 | if (PROFILE_MODEL_P (current_cpu)) | |
607 | { | |
b8a9943d DE |
608 | m32r_model_mark_set_h_gr (current_cpu, abuf); |
609 | m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
646c6f2b DE |
610 | } |
611 | #endif | |
b8a9943d | 612 | |
646c6f2b DE |
613 | return new_pc; |
614 | #undef FLD | |
615 | } | |
616 | ||
617 | /* Perform bl24: bl $disp24. */ | |
618 | CIA | |
9d70630e | 619 | SEM_FN_NAME (m32r,bl24) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 620 | { |
970a8fd6 | 621 | #define FLD(f) abuf->fields.fmt_bl24.f |
646c6f2b | 622 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 623 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 624 | int taken_p = 0; |
b8a9943d | 625 | |
9d70630e DE |
626 | do { |
627 | CPU (h_gr[14]) = ADDSI (CPU (h_pc), 4); | |
b8a9943d | 628 | TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14])); |
02310b01 | 629 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp24))); |
646c6f2b | 630 | taken_p = 1; |
cab58155 | 631 | TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); |
9d70630e | 632 | } while (0); |
b8a9943d | 633 | |
646c6f2b DE |
634 | #if WITH_PROFILE_MODEL_P |
635 | if (PROFILE_MODEL_P (current_cpu)) | |
636 | { | |
b8a9943d DE |
637 | m32r_model_mark_set_h_gr (current_cpu, abuf); |
638 | m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
646c6f2b DE |
639 | } |
640 | #endif | |
b8a9943d | 641 | |
646c6f2b DE |
642 | return new_pc; |
643 | #undef FLD | |
644 | } | |
645 | ||
646 | /* Perform bnc8: bnc $disp8. */ | |
647 | CIA | |
9d70630e | 648 | SEM_FN_NAME (m32r,bnc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 649 | { |
970a8fd6 | 650 | #define FLD(f) abuf->fields.fmt_bc8.f |
646c6f2b | 651 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 652 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
646c6f2b | 653 | int taken_p = 0; |
b8a9943d | 654 | |
9d70630e | 655 | if (NOTBI (CPU (h_cond))) { |
02310b01 | 656 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp8))); |
646c6f2b | 657 | taken_p = 1; |
cab58155 | 658 | TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); |
646c6f2b | 659 | } |
b8a9943d | 660 | |
646c6f2b DE |
661 | #if WITH_PROFILE_MODEL_P |
662 | if (PROFILE_MODEL_P (current_cpu)) | |
663 | { | |
b8a9943d | 664 | m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
665 | } |
666 | #endif | |
b8a9943d | 667 | |
646c6f2b DE |
668 | return new_pc; |
669 | #undef FLD | |
670 | } | |
671 | ||
672 | /* Perform bnc24: bnc $disp24. */ | |
673 | CIA | |
9d70630e | 674 | SEM_FN_NAME (m32r,bnc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 675 | { |
970a8fd6 | 676 | #define FLD(f) abuf->fields.fmt_bc24.f |
646c6f2b | 677 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 678 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 679 | int taken_p = 0; |
b8a9943d | 680 | |
9d70630e | 681 | if (NOTBI (CPU (h_cond))) { |
02310b01 | 682 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp24))); |
646c6f2b | 683 | taken_p = 1; |
cab58155 | 684 | TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); |
646c6f2b | 685 | } |
b8a9943d | 686 | |
646c6f2b DE |
687 | #if WITH_PROFILE_MODEL_P |
688 | if (PROFILE_MODEL_P (current_cpu)) | |
689 | { | |
b8a9943d | 690 | m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
691 | } |
692 | #endif | |
b8a9943d | 693 | |
646c6f2b DE |
694 | return new_pc; |
695 | #undef FLD | |
696 | } | |
697 | ||
698 | /* Perform bne: bne $src1,$src2,$disp16. */ | |
699 | CIA | |
9d70630e | 700 | SEM_FN_NAME (m32r,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 701 | { |
970a8fd6 | 702 | #define FLD(f) abuf->fields.fmt_beq.f |
646c6f2b | 703 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 704 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 705 | int taken_p = 0; |
b8a9943d | 706 | |
9d70630e | 707 | if (NESI (* FLD (f_r1), * FLD (f_r2))) { |
02310b01 | 708 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); |
646c6f2b | 709 | taken_p = 1; |
cab58155 | 710 | TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); |
646c6f2b | 711 | } |
b8a9943d | 712 | |
646c6f2b DE |
713 | #if WITH_PROFILE_MODEL_P |
714 | if (PROFILE_MODEL_P (current_cpu)) | |
715 | { | |
9d70630e | 716 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 717 | m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
718 | } |
719 | #endif | |
b8a9943d | 720 | |
646c6f2b DE |
721 | return new_pc; |
722 | #undef FLD | |
723 | } | |
724 | ||
725 | /* Perform bra8: bra $disp8. */ | |
726 | CIA | |
9d70630e | 727 | SEM_FN_NAME (m32r,bra8) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 728 | { |
970a8fd6 | 729 | #define FLD(f) abuf->fields.fmt_bra8.f |
646c6f2b | 730 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 731 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
646c6f2b | 732 | int taken_p = 0; |
b8a9943d | 733 | |
02310b01 | 734 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp8))); |
646c6f2b | 735 | taken_p = 1; |
cab58155 | 736 | TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); |
b8a9943d | 737 | |
646c6f2b DE |
738 | #if WITH_PROFILE_MODEL_P |
739 | if (PROFILE_MODEL_P (current_cpu)) | |
740 | { | |
b8a9943d | 741 | m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
742 | } |
743 | #endif | |
b8a9943d | 744 | |
646c6f2b DE |
745 | return new_pc; |
746 | #undef FLD | |
747 | } | |
748 | ||
749 | /* Perform bra24: bra $disp24. */ | |
750 | CIA | |
9d70630e | 751 | SEM_FN_NAME (m32r,bra24) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 752 | { |
970a8fd6 | 753 | #define FLD(f) abuf->fields.fmt_bra24.f |
646c6f2b | 754 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 755 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
646c6f2b | 756 | int taken_p = 0; |
b8a9943d | 757 | |
02310b01 | 758 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp24))); |
646c6f2b | 759 | taken_p = 1; |
cab58155 | 760 | TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); |
b8a9943d | 761 | |
646c6f2b DE |
762 | #if WITH_PROFILE_MODEL_P |
763 | if (PROFILE_MODEL_P (current_cpu)) | |
764 | { | |
b8a9943d | 765 | m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
766 | } |
767 | #endif | |
b8a9943d | 768 | |
646c6f2b DE |
769 | return new_pc; |
770 | #undef FLD | |
771 | } | |
772 | ||
773 | /* Perform cmp: cmp $src1,$src2. */ | |
774 | CIA | |
9d70630e | 775 | SEM_FN_NAME (m32r,cmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 776 | { |
970a8fd6 | 777 | #define FLD(f) abuf->fields.fmt_cmp.f |
646c6f2b | 778 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 779 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 780 | |
9d70630e DE |
781 | CPU (h_cond) = LTSI (* FLD (f_r1), * FLD (f_r2)); |
782 | TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); | |
b8a9943d | 783 | |
646c6f2b DE |
784 | #if WITH_PROFILE_MODEL_P |
785 | if (PROFILE_MODEL_P (current_cpu)) | |
786 | { | |
9d70630e | 787 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 788 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
789 | } |
790 | #endif | |
b8a9943d | 791 | |
646c6f2b DE |
792 | return new_pc; |
793 | #undef FLD | |
794 | } | |
795 | ||
970a8fd6 | 796 | /* Perform cmpi: cmpi $src2,$simm16. */ |
646c6f2b | 797 | CIA |
9d70630e | 798 | SEM_FN_NAME (m32r,cmpi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 799 | { |
970a8fd6 | 800 | #define FLD(f) abuf->fields.fmt_cmpi.f |
646c6f2b | 801 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 802 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 803 | |
9d70630e DE |
804 | CPU (h_cond) = LTSI (* FLD (f_r2), FLD (f_simm16)); |
805 | TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); | |
b8a9943d | 806 | |
646c6f2b DE |
807 | #if WITH_PROFILE_MODEL_P |
808 | if (PROFILE_MODEL_P (current_cpu)) | |
809 | { | |
9d70630e | 810 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 811 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
812 | } |
813 | #endif | |
b8a9943d | 814 | |
646c6f2b DE |
815 | return new_pc; |
816 | #undef FLD | |
817 | } | |
818 | ||
819 | /* Perform cmpu: cmpu $src1,$src2. */ | |
820 | CIA | |
9d70630e | 821 | SEM_FN_NAME (m32r,cmpu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 822 | { |
970a8fd6 | 823 | #define FLD(f) abuf->fields.fmt_cmp.f |
646c6f2b | 824 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 825 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 826 | |
9d70630e DE |
827 | CPU (h_cond) = LTUSI (* FLD (f_r1), * FLD (f_r2)); |
828 | TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); | |
b8a9943d | 829 | |
646c6f2b DE |
830 | #if WITH_PROFILE_MODEL_P |
831 | if (PROFILE_MODEL_P (current_cpu)) | |
832 | { | |
9d70630e | 833 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 834 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
835 | } |
836 | #endif | |
b8a9943d | 837 | |
646c6f2b DE |
838 | return new_pc; |
839 | #undef FLD | |
840 | } | |
841 | ||
970a8fd6 | 842 | /* Perform cmpui: cmpui $src2,$simm16. */ |
646c6f2b | 843 | CIA |
9d70630e | 844 | SEM_FN_NAME (m32r,cmpui) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 845 | { |
970a8fd6 | 846 | #define FLD(f) abuf->fields.fmt_cmpi.f |
646c6f2b | 847 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 848 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 849 | |
970a8fd6 | 850 | CPU (h_cond) = LTUSI (* FLD (f_r2), FLD (f_simm16)); |
9d70630e | 851 | TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); |
b8a9943d | 852 | |
646c6f2b DE |
853 | #if WITH_PROFILE_MODEL_P |
854 | if (PROFILE_MODEL_P (current_cpu)) | |
855 | { | |
9d70630e | 856 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 857 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
858 | } |
859 | #endif | |
b8a9943d | 860 | |
646c6f2b DE |
861 | return new_pc; |
862 | #undef FLD | |
863 | } | |
864 | ||
865 | /* Perform div: div $dr,$sr. */ | |
866 | CIA | |
9d70630e | 867 | SEM_FN_NAME (m32r,div) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 868 | { |
970a8fd6 | 869 | #define FLD(f) abuf->fields.fmt_div.f |
646c6f2b | 870 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 871 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 872 | |
9d70630e | 873 | if (NESI (* FLD (f_r2), 0)) { |
646c6f2b DE |
874 | * FLD (f_r1) = DIVSI (* FLD (f_r1), * FLD (f_r2)); |
875 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
876 | } | |
b8a9943d | 877 | |
646c6f2b DE |
878 | #if WITH_PROFILE_MODEL_P |
879 | if (PROFILE_MODEL_P (current_cpu)) | |
880 | { | |
9d70630e DE |
881 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
882 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 883 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
884 | } |
885 | #endif | |
b8a9943d | 886 | |
646c6f2b DE |
887 | return new_pc; |
888 | #undef FLD | |
889 | } | |
890 | ||
891 | /* Perform divu: divu $dr,$sr. */ | |
892 | CIA | |
9d70630e | 893 | SEM_FN_NAME (m32r,divu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 894 | { |
970a8fd6 | 895 | #define FLD(f) abuf->fields.fmt_div.f |
646c6f2b | 896 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 897 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 898 | |
9d70630e | 899 | if (NESI (* FLD (f_r2), 0)) { |
646c6f2b DE |
900 | * FLD (f_r1) = UDIVSI (* FLD (f_r1), * FLD (f_r2)); |
901 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
902 | } | |
b8a9943d | 903 | |
646c6f2b DE |
904 | #if WITH_PROFILE_MODEL_P |
905 | if (PROFILE_MODEL_P (current_cpu)) | |
906 | { | |
9d70630e DE |
907 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
908 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 909 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
910 | } |
911 | #endif | |
b8a9943d | 912 | |
646c6f2b DE |
913 | return new_pc; |
914 | #undef FLD | |
915 | } | |
916 | ||
917 | /* Perform rem: rem $dr,$sr. */ | |
918 | CIA | |
9d70630e | 919 | SEM_FN_NAME (m32r,rem) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 920 | { |
970a8fd6 | 921 | #define FLD(f) abuf->fields.fmt_div.f |
646c6f2b | 922 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 923 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 924 | |
9d70630e | 925 | if (NESI (* FLD (f_r2), 0)) { |
646c6f2b DE |
926 | * FLD (f_r1) = MODSI (* FLD (f_r1), * FLD (f_r2)); |
927 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
928 | } | |
b8a9943d | 929 | |
646c6f2b DE |
930 | #if WITH_PROFILE_MODEL_P |
931 | if (PROFILE_MODEL_P (current_cpu)) | |
932 | { | |
9d70630e DE |
933 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
934 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 935 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
936 | } |
937 | #endif | |
b8a9943d | 938 | |
646c6f2b DE |
939 | return new_pc; |
940 | #undef FLD | |
941 | } | |
942 | ||
943 | /* Perform remu: remu $dr,$sr. */ | |
944 | CIA | |
9d70630e | 945 | SEM_FN_NAME (m32r,remu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 946 | { |
970a8fd6 | 947 | #define FLD(f) abuf->fields.fmt_div.f |
646c6f2b | 948 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 949 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 950 | |
9d70630e | 951 | if (NESI (* FLD (f_r2), 0)) { |
646c6f2b DE |
952 | * FLD (f_r1) = UMODSI (* FLD (f_r1), * FLD (f_r2)); |
953 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
954 | } | |
b8a9943d | 955 | |
646c6f2b DE |
956 | #if WITH_PROFILE_MODEL_P |
957 | if (PROFILE_MODEL_P (current_cpu)) | |
958 | { | |
9d70630e DE |
959 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
960 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 961 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
962 | } |
963 | #endif | |
b8a9943d | 964 | |
646c6f2b DE |
965 | return new_pc; |
966 | #undef FLD | |
967 | } | |
968 | ||
969 | /* Perform jl: jl $sr. */ | |
970 | CIA | |
9d70630e | 971 | SEM_FN_NAME (m32r,jl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 972 | { |
970a8fd6 | 973 | #define FLD(f) abuf->fields.fmt_jl.f |
646c6f2b | 974 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 975 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
646c6f2b | 976 | int taken_p = 0; |
b8a9943d | 977 | |
646c6f2b | 978 | do { |
e0bd6e18 | 979 | SI temp1;SI temp0; |
9d70630e DE |
980 | temp0 = ADDSI (ANDSI (CPU (h_pc), -4), 4); |
981 | temp1 = * FLD (f_r2); | |
982 | CPU (h_gr[14]) = temp0; | |
b8a9943d | 983 | TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14])); |
02310b01 | 984 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, temp1)); |
646c6f2b | 985 | taken_p = 1; |
cab58155 | 986 | TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); |
646c6f2b | 987 | } while (0); |
b8a9943d | 988 | |
646c6f2b DE |
989 | #if WITH_PROFILE_MODEL_P |
990 | if (PROFILE_MODEL_P (current_cpu)) | |
991 | { | |
9d70630e | 992 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d DE |
993 | m32r_model_mark_set_h_gr (current_cpu, abuf); |
994 | m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); | |
646c6f2b DE |
995 | } |
996 | #endif | |
b8a9943d | 997 | |
646c6f2b DE |
998 | return new_pc; |
999 | #undef FLD | |
1000 | } | |
1001 | ||
1002 | /* Perform jmp: jmp $sr. */ | |
1003 | CIA | |
9d70630e | 1004 | SEM_FN_NAME (m32r,jmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1005 | { |
970a8fd6 | 1006 | #define FLD(f) abuf->fields.fmt_jmp.f |
646c6f2b | 1007 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1008 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
646c6f2b | 1009 | int taken_p = 0; |
b8a9943d | 1010 | |
02310b01 | 1011 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, * FLD (f_r2))); |
646c6f2b | 1012 | taken_p = 1; |
cab58155 | 1013 | TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); |
b8a9943d | 1014 | |
646c6f2b DE |
1015 | #if WITH_PROFILE_MODEL_P |
1016 | if (PROFILE_MODEL_P (current_cpu)) | |
1017 | { | |
9d70630e | 1018 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 1019 | m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
1020 | } |
1021 | #endif | |
b8a9943d | 1022 | |
646c6f2b DE |
1023 | return new_pc; |
1024 | #undef FLD | |
1025 | } | |
1026 | ||
1027 | /* Perform ld: ld $dr,@$sr. */ | |
1028 | CIA | |
9d70630e | 1029 | SEM_FN_NAME (m32r,ld) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1030 | { |
970a8fd6 | 1031 | #define FLD(f) abuf->fields.fmt_ld.f |
646c6f2b | 1032 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1033 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1034 | |
646c6f2b DE |
1035 | * FLD (f_r1) = GETMEMSI (current_cpu, * FLD (f_r2)); |
1036 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 1037 | |
646c6f2b DE |
1038 | #if WITH_PROFILE_MODEL_P |
1039 | if (PROFILE_MODEL_P (current_cpu)) | |
1040 | { | |
9d70630e DE |
1041 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
1042 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 1043 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1044 | } |
1045 | #endif | |
b8a9943d | 1046 | |
646c6f2b DE |
1047 | return new_pc; |
1048 | #undef FLD | |
1049 | } | |
1050 | ||
1051 | /* Perform ld-d: ld $dr,@($slo16,$sr). */ | |
1052 | CIA | |
9d70630e | 1053 | SEM_FN_NAME (m32r,ld_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1054 | { |
970a8fd6 | 1055 | #define FLD(f) abuf->fields.fmt_ld_d.f |
646c6f2b | 1056 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1057 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 1058 | |
646c6f2b DE |
1059 | * FLD (f_r1) = GETMEMSI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))); |
1060 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 1061 | |
646c6f2b DE |
1062 | #if WITH_PROFILE_MODEL_P |
1063 | if (PROFILE_MODEL_P (current_cpu)) | |
1064 | { | |
9d70630e DE |
1065 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
1066 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 1067 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1068 | } |
1069 | #endif | |
b8a9943d | 1070 | |
646c6f2b DE |
1071 | return new_pc; |
1072 | #undef FLD | |
1073 | } | |
1074 | ||
1075 | /* Perform ldb: ldb $dr,@$sr. */ | |
1076 | CIA | |
9d70630e | 1077 | SEM_FN_NAME (m32r,ldb) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1078 | { |
970a8fd6 | 1079 | #define FLD(f) abuf->fields.fmt_ldb.f |
646c6f2b | 1080 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1081 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1082 | |
646c6f2b DE |
1083 | * FLD (f_r1) = EXTQISI (GETMEMQI (current_cpu, * FLD (f_r2))); |
1084 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 1085 | |
646c6f2b DE |
1086 | #if WITH_PROFILE_MODEL_P |
1087 | if (PROFILE_MODEL_P (current_cpu)) | |
1088 | { | |
9d70630e DE |
1089 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
1090 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 1091 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1092 | } |
1093 | #endif | |
b8a9943d | 1094 | |
646c6f2b DE |
1095 | return new_pc; |
1096 | #undef FLD | |
1097 | } | |
1098 | ||
1099 | /* Perform ldb-d: ldb $dr,@($slo16,$sr). */ | |
1100 | CIA | |
9d70630e | 1101 | SEM_FN_NAME (m32r,ldb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1102 | { |
970a8fd6 | 1103 | #define FLD(f) abuf->fields.fmt_ldb_d.f |
646c6f2b | 1104 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1105 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 1106 | |
646c6f2b DE |
1107 | * FLD (f_r1) = EXTQISI (GETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); |
1108 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 1109 | |
646c6f2b DE |
1110 | #if WITH_PROFILE_MODEL_P |
1111 | if (PROFILE_MODEL_P (current_cpu)) | |
1112 | { | |
9d70630e DE |
1113 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
1114 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 1115 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1116 | } |
1117 | #endif | |
b8a9943d | 1118 | |
646c6f2b DE |
1119 | return new_pc; |
1120 | #undef FLD | |
1121 | } | |
1122 | ||
1123 | /* Perform ldh: ldh $dr,@$sr. */ | |
1124 | CIA | |
9d70630e | 1125 | SEM_FN_NAME (m32r,ldh) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1126 | { |
970a8fd6 | 1127 | #define FLD(f) abuf->fields.fmt_ldh.f |
646c6f2b | 1128 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1129 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1130 | |
646c6f2b DE |
1131 | * FLD (f_r1) = EXTHISI (GETMEMHI (current_cpu, * FLD (f_r2))); |
1132 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 1133 | |
646c6f2b DE |
1134 | #if WITH_PROFILE_MODEL_P |
1135 | if (PROFILE_MODEL_P (current_cpu)) | |
1136 | { | |
9d70630e DE |
1137 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
1138 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 1139 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1140 | } |
1141 | #endif | |
b8a9943d | 1142 | |
646c6f2b DE |
1143 | return new_pc; |
1144 | #undef FLD | |
1145 | } | |
1146 | ||
1147 | /* Perform ldh-d: ldh $dr,@($slo16,$sr). */ | |
1148 | CIA | |
9d70630e | 1149 | SEM_FN_NAME (m32r,ldh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1150 | { |
970a8fd6 | 1151 | #define FLD(f) abuf->fields.fmt_ldh_d.f |
646c6f2b | 1152 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1153 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 1154 | |
646c6f2b DE |
1155 | * FLD (f_r1) = EXTHISI (GETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); |
1156 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 1157 | |
646c6f2b DE |
1158 | #if WITH_PROFILE_MODEL_P |
1159 | if (PROFILE_MODEL_P (current_cpu)) | |
1160 | { | |
9d70630e DE |
1161 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
1162 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 1163 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1164 | } |
1165 | #endif | |
b8a9943d | 1166 | |
646c6f2b DE |
1167 | return new_pc; |
1168 | #undef FLD | |
1169 | } | |
1170 | ||
1171 | /* Perform ldub: ldub $dr,@$sr. */ | |
1172 | CIA | |
9d70630e | 1173 | SEM_FN_NAME (m32r,ldub) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1174 | { |
970a8fd6 | 1175 | #define FLD(f) abuf->fields.fmt_ldb.f |
646c6f2b | 1176 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1177 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1178 | |
646c6f2b DE |
1179 | * FLD (f_r1) = ZEXTQISI (GETMEMQI (current_cpu, * FLD (f_r2))); |
1180 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 1181 | |
646c6f2b DE |
1182 | #if WITH_PROFILE_MODEL_P |
1183 | if (PROFILE_MODEL_P (current_cpu)) | |
1184 | { | |
9d70630e DE |
1185 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
1186 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 1187 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1188 | } |
1189 | #endif | |
b8a9943d | 1190 | |
646c6f2b DE |
1191 | return new_pc; |
1192 | #undef FLD | |
1193 | } | |
1194 | ||
1195 | /* Perform ldub-d: ldub $dr,@($slo16,$sr). */ | |
1196 | CIA | |
9d70630e | 1197 | SEM_FN_NAME (m32r,ldub_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1198 | { |
970a8fd6 | 1199 | #define FLD(f) abuf->fields.fmt_ldb_d.f |
646c6f2b | 1200 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1201 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 1202 | |
646c6f2b DE |
1203 | * FLD (f_r1) = ZEXTQISI (GETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); |
1204 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 1205 | |
646c6f2b DE |
1206 | #if WITH_PROFILE_MODEL_P |
1207 | if (PROFILE_MODEL_P (current_cpu)) | |
1208 | { | |
9d70630e DE |
1209 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
1210 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 1211 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1212 | } |
1213 | #endif | |
b8a9943d | 1214 | |
646c6f2b DE |
1215 | return new_pc; |
1216 | #undef FLD | |
1217 | } | |
1218 | ||
1219 | /* Perform lduh: lduh $dr,@$sr. */ | |
1220 | CIA | |
9d70630e | 1221 | SEM_FN_NAME (m32r,lduh) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1222 | { |
970a8fd6 | 1223 | #define FLD(f) abuf->fields.fmt_ldh.f |
646c6f2b | 1224 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1225 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1226 | |
646c6f2b DE |
1227 | * FLD (f_r1) = ZEXTHISI (GETMEMHI (current_cpu, * FLD (f_r2))); |
1228 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 1229 | |
646c6f2b DE |
1230 | #if WITH_PROFILE_MODEL_P |
1231 | if (PROFILE_MODEL_P (current_cpu)) | |
1232 | { | |
9d70630e DE |
1233 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
1234 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 1235 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1236 | } |
1237 | #endif | |
b8a9943d | 1238 | |
646c6f2b DE |
1239 | return new_pc; |
1240 | #undef FLD | |
1241 | } | |
1242 | ||
1243 | /* Perform lduh-d: lduh $dr,@($slo16,$sr). */ | |
1244 | CIA | |
9d70630e | 1245 | SEM_FN_NAME (m32r,lduh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1246 | { |
970a8fd6 | 1247 | #define FLD(f) abuf->fields.fmt_ldh_d.f |
646c6f2b | 1248 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1249 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 1250 | |
646c6f2b DE |
1251 | * FLD (f_r1) = ZEXTHISI (GETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); |
1252 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 1253 | |
646c6f2b DE |
1254 | #if WITH_PROFILE_MODEL_P |
1255 | if (PROFILE_MODEL_P (current_cpu)) | |
1256 | { | |
9d70630e DE |
1257 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
1258 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 1259 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1260 | } |
1261 | #endif | |
b8a9943d | 1262 | |
646c6f2b DE |
1263 | return new_pc; |
1264 | #undef FLD | |
1265 | } | |
1266 | ||
1267 | /* Perform ld-plus: ld $dr,@$sr+. */ | |
1268 | CIA | |
9d70630e | 1269 | SEM_FN_NAME (m32r,ld_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1270 | { |
970a8fd6 | 1271 | #define FLD(f) abuf->fields.fmt_ld_plus.f |
646c6f2b | 1272 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1273 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1274 | |
646c6f2b DE |
1275 | do { |
1276 | SI temp1;SI temp0; | |
9d70630e DE |
1277 | temp0 = GETMEMSI (current_cpu, * FLD (f_r2)); |
1278 | temp1 = ADDSI (* FLD (f_r2), 4); | |
646c6f2b DE |
1279 | * FLD (f_r1) = temp0; |
1280 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
1281 | * FLD (f_r2) = temp1; | |
1282 | TRACE_RESULT (current_cpu, "sr", 'x', * FLD (f_r2)); | |
1283 | } while (0); | |
b8a9943d | 1284 | |
646c6f2b DE |
1285 | #if WITH_PROFILE_MODEL_P |
1286 | if (PROFILE_MODEL_P (current_cpu)) | |
1287 | { | |
9d70630e DE |
1288 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
1289 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 1290 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1291 | } |
1292 | #endif | |
b8a9943d | 1293 | |
646c6f2b DE |
1294 | return new_pc; |
1295 | #undef FLD | |
1296 | } | |
1297 | ||
970a8fd6 | 1298 | /* Perform ld24: ld24 $dr,$uimm24. */ |
646c6f2b | 1299 | CIA |
9d70630e | 1300 | SEM_FN_NAME (m32r,ld24) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1301 | { |
970a8fd6 | 1302 | #define FLD(f) abuf->fields.fmt_ld24.f |
646c6f2b | 1303 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1304 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 1305 | |
646c6f2b DE |
1306 | * FLD (f_r1) = FLD (f_uimm24); |
1307 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 1308 | |
646c6f2b DE |
1309 | #if WITH_PROFILE_MODEL_P |
1310 | if (PROFILE_MODEL_P (current_cpu)) | |
1311 | { | |
9d70630e | 1312 | m32r_model_mark_set_h_gr (current_cpu, abuf); |
b8a9943d | 1313 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1314 | } |
1315 | #endif | |
b8a9943d | 1316 | |
646c6f2b DE |
1317 | return new_pc; |
1318 | #undef FLD | |
1319 | } | |
1320 | ||
970a8fd6 | 1321 | /* Perform ldi8: ldi $dr,$simm8. */ |
646c6f2b | 1322 | CIA |
9d70630e | 1323 | SEM_FN_NAME (m32r,ldi8) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1324 | { |
970a8fd6 | 1325 | #define FLD(f) abuf->fields.fmt_ldi8.f |
646c6f2b | 1326 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1327 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1328 | |
646c6f2b DE |
1329 | * FLD (f_r1) = FLD (f_simm8); |
1330 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 1331 | |
646c6f2b DE |
1332 | #if WITH_PROFILE_MODEL_P |
1333 | if (PROFILE_MODEL_P (current_cpu)) | |
1334 | { | |
9d70630e | 1335 | m32r_model_mark_set_h_gr (current_cpu, abuf); |
b8a9943d | 1336 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1337 | } |
1338 | #endif | |
b8a9943d | 1339 | |
646c6f2b DE |
1340 | return new_pc; |
1341 | #undef FLD | |
1342 | } | |
1343 | ||
970a8fd6 | 1344 | /* Perform ldi16: ldi $dr,$hash$slo16. */ |
646c6f2b | 1345 | CIA |
9d70630e | 1346 | SEM_FN_NAME (m32r,ldi16) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1347 | { |
970a8fd6 | 1348 | #define FLD(f) abuf->fields.fmt_ldi16.f |
646c6f2b | 1349 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1350 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 1351 | |
646c6f2b DE |
1352 | * FLD (f_r1) = FLD (f_simm16); |
1353 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 1354 | |
646c6f2b DE |
1355 | #if WITH_PROFILE_MODEL_P |
1356 | if (PROFILE_MODEL_P (current_cpu)) | |
1357 | { | |
9d70630e | 1358 | m32r_model_mark_set_h_gr (current_cpu, abuf); |
b8a9943d | 1359 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1360 | } |
1361 | #endif | |
b8a9943d | 1362 | |
646c6f2b DE |
1363 | return new_pc; |
1364 | #undef FLD | |
1365 | } | |
1366 | ||
1367 | /* Perform lock: lock $dr,@$sr. */ | |
1368 | CIA | |
9d70630e | 1369 | SEM_FN_NAME (m32r,lock) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1370 | { |
970a8fd6 | 1371 | #define FLD(f) abuf->fields.fmt_lock.f |
646c6f2b | 1372 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1373 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1374 | |
cab58155 DE |
1375 | do { |
1376 | CPU (h_lock) = 1; | |
1377 | TRACE_RESULT (current_cpu, "h-lock-0", 'x', CPU (h_lock)); | |
1378 | * FLD (f_r1) = GETMEMSI (current_cpu, * FLD (f_r2)); | |
1379 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
1380 | } while (0); | |
b8a9943d | 1381 | |
646c6f2b DE |
1382 | #if WITH_PROFILE_MODEL_P |
1383 | if (PROFILE_MODEL_P (current_cpu)) | |
1384 | { | |
9d70630e DE |
1385 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
1386 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 1387 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1388 | } |
1389 | #endif | |
b8a9943d | 1390 | |
646c6f2b DE |
1391 | return new_pc; |
1392 | #undef FLD | |
1393 | } | |
1394 | ||
1395 | /* Perform machi: machi $src1,$src2. */ | |
1396 | CIA | |
9d70630e | 1397 | SEM_FN_NAME (m32r,machi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1398 | { |
970a8fd6 | 1399 | #define FLD(f) abuf->fields.fmt_machi.f |
646c6f2b | 1400 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1401 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1402 | |
970a8fd6 DE |
1403 | m32r_h_accum_set (current_cpu, SRADI (SLLDI (ADDDI (m32r_h_accum_get (current_cpu), MULDI (EXTSIDI (ANDSI (* FLD (f_r1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16))))), 8), 8)); |
1404 | TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu)); | |
b8a9943d | 1405 | |
646c6f2b DE |
1406 | #if WITH_PROFILE_MODEL_P |
1407 | if (PROFILE_MODEL_P (current_cpu)) | |
1408 | { | |
9d70630e | 1409 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 1410 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1411 | } |
1412 | #endif | |
b8a9943d | 1413 | |
646c6f2b DE |
1414 | return new_pc; |
1415 | #undef FLD | |
1416 | } | |
1417 | ||
1418 | /* Perform maclo: maclo $src1,$src2. */ | |
1419 | CIA | |
9d70630e | 1420 | SEM_FN_NAME (m32r,maclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1421 | { |
970a8fd6 | 1422 | #define FLD(f) abuf->fields.fmt_machi.f |
646c6f2b | 1423 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1424 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1425 | |
970a8fd6 DE |
1426 | m32r_h_accum_set (current_cpu, SRADI (SLLDI (ADDDI (m32r_h_accum_get (current_cpu), MULDI (EXTSIDI (SLLSI (* FLD (f_r1), 16)), EXTHIDI (TRUNCSIHI (* FLD (f_r2))))), 8), 8)); |
1427 | TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu)); | |
b8a9943d | 1428 | |
646c6f2b DE |
1429 | #if WITH_PROFILE_MODEL_P |
1430 | if (PROFILE_MODEL_P (current_cpu)) | |
1431 | { | |
9d70630e | 1432 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 1433 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1434 | } |
1435 | #endif | |
b8a9943d | 1436 | |
646c6f2b DE |
1437 | return new_pc; |
1438 | #undef FLD | |
1439 | } | |
1440 | ||
1441 | /* Perform macwhi: macwhi $src1,$src2. */ | |
1442 | CIA | |
9d70630e | 1443 | SEM_FN_NAME (m32r,macwhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1444 | { |
970a8fd6 | 1445 | #define FLD(f) abuf->fields.fmt_machi.f |
646c6f2b | 1446 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1447 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1448 | |
970a8fd6 DE |
1449 | m32r_h_accum_set (current_cpu, SRADI (SLLDI (ADDDI (m32r_h_accum_get (current_cpu), MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16))))), 8), 8)); |
1450 | TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu)); | |
b8a9943d | 1451 | |
646c6f2b DE |
1452 | #if WITH_PROFILE_MODEL_P |
1453 | if (PROFILE_MODEL_P (current_cpu)) | |
1454 | { | |
9d70630e | 1455 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 1456 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1457 | } |
1458 | #endif | |
b8a9943d | 1459 | |
646c6f2b DE |
1460 | return new_pc; |
1461 | #undef FLD | |
1462 | } | |
1463 | ||
1464 | /* Perform macwlo: macwlo $src1,$src2. */ | |
1465 | CIA | |
9d70630e | 1466 | SEM_FN_NAME (m32r,macwlo) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1467 | { |
970a8fd6 | 1468 | #define FLD(f) abuf->fields.fmt_machi.f |
646c6f2b | 1469 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1470 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1471 | |
970a8fd6 DE |
1472 | m32r_h_accum_set (current_cpu, SRADI (SLLDI (ADDDI (m32r_h_accum_get (current_cpu), MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (* FLD (f_r2))))), 8), 8)); |
1473 | TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu)); | |
b8a9943d | 1474 | |
646c6f2b DE |
1475 | #if WITH_PROFILE_MODEL_P |
1476 | if (PROFILE_MODEL_P (current_cpu)) | |
1477 | { | |
9d70630e | 1478 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 1479 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1480 | } |
1481 | #endif | |
b8a9943d | 1482 | |
646c6f2b DE |
1483 | return new_pc; |
1484 | #undef FLD | |
1485 | } | |
1486 | ||
1487 | /* Perform mul: mul $dr,$sr. */ | |
1488 | CIA | |
9d70630e | 1489 | SEM_FN_NAME (m32r,mul) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1490 | { |
970a8fd6 | 1491 | #define FLD(f) abuf->fields.fmt_add.f |
646c6f2b | 1492 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1493 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1494 | |
646c6f2b DE |
1495 | * FLD (f_r1) = MULSI (* FLD (f_r1), * FLD (f_r2)); |
1496 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 1497 | |
646c6f2b DE |
1498 | #if WITH_PROFILE_MODEL_P |
1499 | if (PROFILE_MODEL_P (current_cpu)) | |
1500 | { | |
9d70630e DE |
1501 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
1502 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 1503 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1504 | } |
1505 | #endif | |
b8a9943d | 1506 | |
646c6f2b DE |
1507 | return new_pc; |
1508 | #undef FLD | |
1509 | } | |
1510 | ||
1511 | /* Perform mulhi: mulhi $src1,$src2. */ | |
1512 | CIA | |
9d70630e | 1513 | SEM_FN_NAME (m32r,mulhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1514 | { |
970a8fd6 | 1515 | #define FLD(f) abuf->fields.fmt_mulhi.f |
646c6f2b | 1516 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1517 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1518 | |
970a8fd6 DE |
1519 | m32r_h_accum_set (current_cpu, SRADI (SLLDI (MULDI (EXTSIDI (ANDSI (* FLD (f_r1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16)))), 16), 16)); |
1520 | TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu)); | |
b8a9943d | 1521 | |
646c6f2b DE |
1522 | #if WITH_PROFILE_MODEL_P |
1523 | if (PROFILE_MODEL_P (current_cpu)) | |
1524 | { | |
9d70630e | 1525 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 1526 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1527 | } |
1528 | #endif | |
b8a9943d | 1529 | |
646c6f2b DE |
1530 | return new_pc; |
1531 | #undef FLD | |
1532 | } | |
1533 | ||
1534 | /* Perform mullo: mullo $src1,$src2. */ | |
1535 | CIA | |
9d70630e | 1536 | SEM_FN_NAME (m32r,mullo) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1537 | { |
970a8fd6 | 1538 | #define FLD(f) abuf->fields.fmt_mulhi.f |
646c6f2b | 1539 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1540 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1541 | |
970a8fd6 DE |
1542 | m32r_h_accum_set (current_cpu, SRADI (SLLDI (MULDI (EXTSIDI (SLLSI (* FLD (f_r1), 16)), EXTHIDI (TRUNCSIHI (* FLD (f_r2)))), 16), 16)); |
1543 | TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu)); | |
b8a9943d | 1544 | |
646c6f2b DE |
1545 | #if WITH_PROFILE_MODEL_P |
1546 | if (PROFILE_MODEL_P (current_cpu)) | |
1547 | { | |
9d70630e | 1548 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 1549 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1550 | } |
1551 | #endif | |
b8a9943d | 1552 | |
646c6f2b DE |
1553 | return new_pc; |
1554 | #undef FLD | |
1555 | } | |
1556 | ||
1557 | /* Perform mulwhi: mulwhi $src1,$src2. */ | |
1558 | CIA | |
9d70630e | 1559 | SEM_FN_NAME (m32r,mulwhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1560 | { |
970a8fd6 | 1561 | #define FLD(f) abuf->fields.fmt_mulhi.f |
646c6f2b | 1562 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1563 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1564 | |
970a8fd6 DE |
1565 | m32r_h_accum_set (current_cpu, SRADI (SLLDI (MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16)))), 8), 8)); |
1566 | TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu)); | |
b8a9943d | 1567 | |
646c6f2b DE |
1568 | #if WITH_PROFILE_MODEL_P |
1569 | if (PROFILE_MODEL_P (current_cpu)) | |
1570 | { | |
9d70630e | 1571 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 1572 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1573 | } |
1574 | #endif | |
b8a9943d | 1575 | |
646c6f2b DE |
1576 | return new_pc; |
1577 | #undef FLD | |
1578 | } | |
1579 | ||
1580 | /* Perform mulwlo: mulwlo $src1,$src2. */ | |
1581 | CIA | |
9d70630e | 1582 | SEM_FN_NAME (m32r,mulwlo) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1583 | { |
970a8fd6 | 1584 | #define FLD(f) abuf->fields.fmt_mulhi.f |
646c6f2b | 1585 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1586 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1587 | |
970a8fd6 DE |
1588 | m32r_h_accum_set (current_cpu, SRADI (SLLDI (MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (* FLD (f_r2)))), 8), 8)); |
1589 | TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu)); | |
b8a9943d | 1590 | |
646c6f2b DE |
1591 | #if WITH_PROFILE_MODEL_P |
1592 | if (PROFILE_MODEL_P (current_cpu)) | |
1593 | { | |
9d70630e | 1594 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 1595 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1596 | } |
1597 | #endif | |
b8a9943d | 1598 | |
646c6f2b DE |
1599 | return new_pc; |
1600 | #undef FLD | |
1601 | } | |
1602 | ||
1603 | /* Perform mv: mv $dr,$sr. */ | |
1604 | CIA | |
9d70630e | 1605 | SEM_FN_NAME (m32r,mv) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1606 | { |
970a8fd6 | 1607 | #define FLD(f) abuf->fields.fmt_mv.f |
646c6f2b | 1608 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1609 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1610 | |
646c6f2b DE |
1611 | * FLD (f_r1) = * FLD (f_r2); |
1612 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 1613 | |
646c6f2b DE |
1614 | #if WITH_PROFILE_MODEL_P |
1615 | if (PROFILE_MODEL_P (current_cpu)) | |
1616 | { | |
9d70630e DE |
1617 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
1618 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 1619 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1620 | } |
1621 | #endif | |
b8a9943d | 1622 | |
646c6f2b DE |
1623 | return new_pc; |
1624 | #undef FLD | |
1625 | } | |
1626 | ||
1627 | /* Perform mvfachi: mvfachi $dr. */ | |
1628 | CIA | |
9d70630e | 1629 | SEM_FN_NAME (m32r,mvfachi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1630 | { |
970a8fd6 | 1631 | #define FLD(f) abuf->fields.fmt_mvfachi.f |
646c6f2b | 1632 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1633 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1634 | |
970a8fd6 | 1635 | * FLD (f_r1) = TRUNCDISI (SRADI (m32r_h_accum_get (current_cpu), 32)); |
646c6f2b | 1636 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); |
b8a9943d | 1637 | |
646c6f2b DE |
1638 | #if WITH_PROFILE_MODEL_P |
1639 | if (PROFILE_MODEL_P (current_cpu)) | |
1640 | { | |
9d70630e | 1641 | m32r_model_mark_set_h_gr (current_cpu, abuf); |
b8a9943d | 1642 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1643 | } |
1644 | #endif | |
b8a9943d | 1645 | |
646c6f2b DE |
1646 | return new_pc; |
1647 | #undef FLD | |
1648 | } | |
1649 | ||
1650 | /* Perform mvfaclo: mvfaclo $dr. */ | |
1651 | CIA | |
9d70630e | 1652 | SEM_FN_NAME (m32r,mvfaclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1653 | { |
970a8fd6 | 1654 | #define FLD(f) abuf->fields.fmt_mvfachi.f |
646c6f2b | 1655 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1656 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1657 | |
970a8fd6 | 1658 | * FLD (f_r1) = TRUNCDISI (m32r_h_accum_get (current_cpu)); |
646c6f2b | 1659 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); |
b8a9943d | 1660 | |
646c6f2b DE |
1661 | #if WITH_PROFILE_MODEL_P |
1662 | if (PROFILE_MODEL_P (current_cpu)) | |
1663 | { | |
9d70630e | 1664 | m32r_model_mark_set_h_gr (current_cpu, abuf); |
b8a9943d | 1665 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1666 | } |
1667 | #endif | |
b8a9943d | 1668 | |
646c6f2b DE |
1669 | return new_pc; |
1670 | #undef FLD | |
1671 | } | |
1672 | ||
1673 | /* Perform mvfacmi: mvfacmi $dr. */ | |
1674 | CIA | |
9d70630e | 1675 | SEM_FN_NAME (m32r,mvfacmi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1676 | { |
970a8fd6 | 1677 | #define FLD(f) abuf->fields.fmt_mvfachi.f |
646c6f2b | 1678 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1679 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1680 | |
970a8fd6 | 1681 | * FLD (f_r1) = TRUNCDISI (SRADI (m32r_h_accum_get (current_cpu), 16)); |
646c6f2b | 1682 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); |
b8a9943d | 1683 | |
646c6f2b DE |
1684 | #if WITH_PROFILE_MODEL_P |
1685 | if (PROFILE_MODEL_P (current_cpu)) | |
1686 | { | |
9d70630e | 1687 | m32r_model_mark_set_h_gr (current_cpu, abuf); |
b8a9943d | 1688 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1689 | } |
1690 | #endif | |
b8a9943d | 1691 | |
646c6f2b DE |
1692 | return new_pc; |
1693 | #undef FLD | |
1694 | } | |
1695 | ||
1696 | /* Perform mvfc: mvfc $dr,$scr. */ | |
1697 | CIA | |
9d70630e | 1698 | SEM_FN_NAME (m32r,mvfc) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1699 | { |
970a8fd6 | 1700 | #define FLD(f) abuf->fields.fmt_mvfc.f |
646c6f2b | 1701 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1702 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1703 | |
9d70630e | 1704 | * FLD (f_r1) = m32r_h_cr_get (current_cpu, FLD (f_r2)); |
646c6f2b | 1705 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); |
b8a9943d | 1706 | |
646c6f2b DE |
1707 | #if WITH_PROFILE_MODEL_P |
1708 | if (PROFILE_MODEL_P (current_cpu)) | |
1709 | { | |
9d70630e | 1710 | m32r_model_mark_set_h_gr (current_cpu, abuf); |
b8a9943d | 1711 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1712 | } |
1713 | #endif | |
b8a9943d | 1714 | |
646c6f2b DE |
1715 | return new_pc; |
1716 | #undef FLD | |
1717 | } | |
1718 | ||
1719 | /* Perform mvtachi: mvtachi $src1. */ | |
1720 | CIA | |
9d70630e | 1721 | SEM_FN_NAME (m32r,mvtachi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1722 | { |
970a8fd6 | 1723 | #define FLD(f) abuf->fields.fmt_mvtachi.f |
646c6f2b | 1724 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1725 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1726 | |
970a8fd6 DE |
1727 | m32r_h_accum_set (current_cpu, ORDI (ANDDI (m32r_h_accum_get (current_cpu), MAKEDI (0, 0xffffffff)), SLLDI (EXTSIDI (* FLD (f_r1)), 32))); |
1728 | TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu)); | |
b8a9943d | 1729 | |
646c6f2b DE |
1730 | #if WITH_PROFILE_MODEL_P |
1731 | if (PROFILE_MODEL_P (current_cpu)) | |
1732 | { | |
9d70630e | 1733 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 1734 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1735 | } |
1736 | #endif | |
b8a9943d | 1737 | |
646c6f2b DE |
1738 | return new_pc; |
1739 | #undef FLD | |
1740 | } | |
1741 | ||
1742 | /* Perform mvtaclo: mvtaclo $src1. */ | |
1743 | CIA | |
9d70630e | 1744 | SEM_FN_NAME (m32r,mvtaclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1745 | { |
970a8fd6 | 1746 | #define FLD(f) abuf->fields.fmt_mvtachi.f |
646c6f2b | 1747 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1748 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1749 | |
970a8fd6 DE |
1750 | m32r_h_accum_set (current_cpu, ORDI (ANDDI (m32r_h_accum_get (current_cpu), MAKEDI (0xffffffff, 0)), ZEXTSIDI (* FLD (f_r1)))); |
1751 | TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu)); | |
b8a9943d | 1752 | |
646c6f2b DE |
1753 | #if WITH_PROFILE_MODEL_P |
1754 | if (PROFILE_MODEL_P (current_cpu)) | |
1755 | { | |
9d70630e | 1756 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 1757 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1758 | } |
1759 | #endif | |
b8a9943d | 1760 | |
646c6f2b DE |
1761 | return new_pc; |
1762 | #undef FLD | |
1763 | } | |
1764 | ||
1765 | /* Perform mvtc: mvtc $sr,$dcr. */ | |
1766 | CIA | |
9d70630e | 1767 | SEM_FN_NAME (m32r,mvtc) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1768 | { |
970a8fd6 | 1769 | #define FLD(f) abuf->fields.fmt_mvtc.f |
646c6f2b | 1770 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1771 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1772 | |
9d70630e DE |
1773 | m32r_h_cr_set (current_cpu, FLD (f_r1), * FLD (f_r2)); |
1774 | TRACE_RESULT (current_cpu, "dcr", 'x', m32r_h_cr_get (current_cpu, FLD (f_r1))); | |
b8a9943d | 1775 | |
646c6f2b DE |
1776 | #if WITH_PROFILE_MODEL_P |
1777 | if (PROFILE_MODEL_P (current_cpu)) | |
1778 | { | |
9d70630e | 1779 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 1780 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1781 | } |
1782 | #endif | |
b8a9943d | 1783 | |
646c6f2b DE |
1784 | return new_pc; |
1785 | #undef FLD | |
1786 | } | |
1787 | ||
1788 | /* Perform neg: neg $dr,$sr. */ | |
1789 | CIA | |
9d70630e | 1790 | SEM_FN_NAME (m32r,neg) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1791 | { |
970a8fd6 | 1792 | #define FLD(f) abuf->fields.fmt_mv.f |
646c6f2b | 1793 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1794 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1795 | |
646c6f2b DE |
1796 | * FLD (f_r1) = NEGSI (* FLD (f_r2)); |
1797 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 1798 | |
646c6f2b DE |
1799 | #if WITH_PROFILE_MODEL_P |
1800 | if (PROFILE_MODEL_P (current_cpu)) | |
1801 | { | |
9d70630e DE |
1802 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
1803 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 1804 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1805 | } |
1806 | #endif | |
b8a9943d | 1807 | |
646c6f2b DE |
1808 | return new_pc; |
1809 | #undef FLD | |
1810 | } | |
1811 | ||
1812 | /* Perform nop: nop. */ | |
1813 | CIA | |
9d70630e | 1814 | SEM_FN_NAME (m32r,nop) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1815 | { |
970a8fd6 | 1816 | #define FLD(f) abuf->fields.fmt_nop.f |
646c6f2b | 1817 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1818 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1819 | |
646c6f2b | 1820 | PROFILE_COUNT_FILLNOPS (current_cpu, abuf->addr); |
b8a9943d | 1821 | |
646c6f2b DE |
1822 | #if WITH_PROFILE_MODEL_P |
1823 | if (PROFILE_MODEL_P (current_cpu)) | |
1824 | { | |
b8a9943d | 1825 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1826 | } |
1827 | #endif | |
b8a9943d | 1828 | |
646c6f2b DE |
1829 | return new_pc; |
1830 | #undef FLD | |
1831 | } | |
1832 | ||
1833 | /* Perform not: not $dr,$sr. */ | |
1834 | CIA | |
9d70630e | 1835 | SEM_FN_NAME (m32r,not) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1836 | { |
970a8fd6 | 1837 | #define FLD(f) abuf->fields.fmt_mv.f |
646c6f2b | 1838 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1839 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1840 | |
646c6f2b DE |
1841 | * FLD (f_r1) = INVSI (* FLD (f_r2)); |
1842 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 1843 | |
646c6f2b DE |
1844 | #if WITH_PROFILE_MODEL_P |
1845 | if (PROFILE_MODEL_P (current_cpu)) | |
1846 | { | |
9d70630e DE |
1847 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
1848 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 1849 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1850 | } |
1851 | #endif | |
b8a9943d | 1852 | |
646c6f2b DE |
1853 | return new_pc; |
1854 | #undef FLD | |
1855 | } | |
1856 | ||
1857 | /* Perform rac: rac. */ | |
1858 | CIA | |
9d70630e | 1859 | SEM_FN_NAME (m32r,rac) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1860 | { |
970a8fd6 | 1861 | #define FLD(f) abuf->fields.fmt_rac.f |
646c6f2b | 1862 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1863 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1864 | |
9d70630e | 1865 | do { |
646c6f2b | 1866 | DI tmp_tmp1; |
970a8fd6 | 1867 | tmp_tmp1 = SLLDI (m32r_h_accum_get (current_cpu), 1); |
e0bd6e18 | 1868 | tmp_tmp1 = ADDDI (tmp_tmp1, MAKEDI (0, 32768)); |
970a8fd6 DE |
1869 | m32r_h_accum_set (current_cpu, (GTDI (tmp_tmp1, MAKEDI (32767, 0xffff0000))) ? (MAKEDI (32767, 0xffff0000)) : (LTDI (tmp_tmp1, MAKEDI (0xffff8000, 0))) ? (MAKEDI (0xffff8000, 0)) : (ANDDI (tmp_tmp1, MAKEDI (0xffffffff, 0xffff0000)))); |
1870 | TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu)); | |
9d70630e | 1871 | } while (0); |
b8a9943d | 1872 | |
646c6f2b DE |
1873 | #if WITH_PROFILE_MODEL_P |
1874 | if (PROFILE_MODEL_P (current_cpu)) | |
1875 | { | |
b8a9943d | 1876 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1877 | } |
1878 | #endif | |
b8a9943d | 1879 | |
646c6f2b DE |
1880 | return new_pc; |
1881 | #undef FLD | |
1882 | } | |
1883 | ||
1884 | /* Perform rach: rach. */ | |
1885 | CIA | |
9d70630e | 1886 | SEM_FN_NAME (m32r,rach) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1887 | { |
970a8fd6 | 1888 | #define FLD(f) abuf->fields.fmt_rac.f |
646c6f2b | 1889 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1890 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1891 | |
9d70630e | 1892 | do { |
646c6f2b | 1893 | DI tmp_tmp1; |
970a8fd6 | 1894 | tmp_tmp1 = ANDDI (m32r_h_accum_get (current_cpu), MAKEDI (16777215, 0xffffffff)); |
9d70630e | 1895 | if (ANDIFSI (GEDI (tmp_tmp1, MAKEDI (16383, 0x80000000)), LEDI (tmp_tmp1, MAKEDI (8388607, 0xffffffff)))) { |
646c6f2b DE |
1896 | tmp_tmp1 = MAKEDI (16383, 0x80000000); |
1897 | } else { | |
9d70630e | 1898 | if (ANDIFSI (GEDI (tmp_tmp1, MAKEDI (8388608, 0)), LEDI (tmp_tmp1, MAKEDI (16760832, 0)))) { |
646c6f2b DE |
1899 | tmp_tmp1 = MAKEDI (16760832, 0); |
1900 | } else { | |
970a8fd6 | 1901 | tmp_tmp1 = ANDDI (ADDDI (m32r_h_accum_get (current_cpu), MAKEDI (0, 1073741824)), MAKEDI (0xffffffff, 0x80000000)); |
646c6f2b DE |
1902 | } |
1903 | } | |
9d70630e | 1904 | tmp_tmp1 = SLLDI (tmp_tmp1, 1); |
970a8fd6 DE |
1905 | m32r_h_accum_set (current_cpu, SRADI (SLLDI (tmp_tmp1, 7), 7)); |
1906 | TRACE_RESULT (current_cpu, "accum", 'D', m32r_h_accum_get (current_cpu)); | |
9d70630e | 1907 | } while (0); |
b8a9943d | 1908 | |
646c6f2b DE |
1909 | #if WITH_PROFILE_MODEL_P |
1910 | if (PROFILE_MODEL_P (current_cpu)) | |
1911 | { | |
b8a9943d | 1912 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1913 | } |
1914 | #endif | |
b8a9943d | 1915 | |
646c6f2b DE |
1916 | return new_pc; |
1917 | #undef FLD | |
1918 | } | |
1919 | ||
1920 | /* Perform rte: rte. */ | |
1921 | CIA | |
9d70630e | 1922 | SEM_FN_NAME (m32r,rte) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1923 | { |
970a8fd6 | 1924 | #define FLD(f) abuf->fields.fmt_rte.f |
646c6f2b | 1925 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1926 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
646c6f2b | 1927 | int taken_p = 0; |
b8a9943d | 1928 | |
9d70630e DE |
1929 | do { |
1930 | CPU (h_sm) = CPU (h_bsm); | |
b8a9943d | 1931 | TRACE_RESULT (current_cpu, "h-sm-0", 'x', CPU (h_sm)); |
9d70630e | 1932 | CPU (h_ie) = CPU (h_bie); |
b8a9943d | 1933 | TRACE_RESULT (current_cpu, "h-ie-0", 'x', CPU (h_ie)); |
9d70630e DE |
1934 | CPU (h_cond) = CPU (h_bcond); |
1935 | TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); | |
970a8fd6 | 1936 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, ANDSI (CPU (h_bpc), -4))); |
646c6f2b | 1937 | taken_p = 1; |
9d70630e DE |
1938 | TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); |
1939 | } while (0); | |
b8a9943d | 1940 | |
646c6f2b DE |
1941 | #if WITH_PROFILE_MODEL_P |
1942 | if (PROFILE_MODEL_P (current_cpu)) | |
1943 | { | |
b8a9943d | 1944 | m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
1945 | } |
1946 | #endif | |
b8a9943d | 1947 | |
646c6f2b DE |
1948 | return new_pc; |
1949 | #undef FLD | |
1950 | } | |
1951 | ||
970a8fd6 | 1952 | /* Perform seth: seth $dr,$hash$hi16. */ |
646c6f2b | 1953 | CIA |
9d70630e | 1954 | SEM_FN_NAME (m32r,seth) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1955 | { |
970a8fd6 | 1956 | #define FLD(f) abuf->fields.fmt_seth.f |
646c6f2b | 1957 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1958 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 1959 | |
9d70630e | 1960 | * FLD (f_r1) = SLLSI (FLD (f_hi16), 16); |
646c6f2b | 1961 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); |
b8a9943d | 1962 | |
646c6f2b DE |
1963 | #if WITH_PROFILE_MODEL_P |
1964 | if (PROFILE_MODEL_P (current_cpu)) | |
1965 | { | |
9d70630e | 1966 | m32r_model_mark_set_h_gr (current_cpu, abuf); |
b8a9943d | 1967 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1968 | } |
1969 | #endif | |
b8a9943d | 1970 | |
646c6f2b DE |
1971 | return new_pc; |
1972 | #undef FLD | |
1973 | } | |
1974 | ||
1975 | /* Perform sll: sll $dr,$sr. */ | |
1976 | CIA | |
9d70630e | 1977 | SEM_FN_NAME (m32r,sll) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 1978 | { |
970a8fd6 | 1979 | #define FLD(f) abuf->fields.fmt_add.f |
646c6f2b | 1980 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 1981 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 1982 | |
9d70630e | 1983 | * FLD (f_r1) = SLLSI (* FLD (f_r1), ANDSI (* FLD (f_r2), 31)); |
646c6f2b | 1984 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); |
b8a9943d | 1985 | |
646c6f2b DE |
1986 | #if WITH_PROFILE_MODEL_P |
1987 | if (PROFILE_MODEL_P (current_cpu)) | |
1988 | { | |
9d70630e DE |
1989 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
1990 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 1991 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
1992 | } |
1993 | #endif | |
b8a9943d | 1994 | |
646c6f2b DE |
1995 | return new_pc; |
1996 | #undef FLD | |
1997 | } | |
1998 | ||
970a8fd6 | 1999 | /* Perform sll3: sll3 $dr,$sr,$simm16. */ |
646c6f2b | 2000 | CIA |
9d70630e | 2001 | SEM_FN_NAME (m32r,sll3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2002 | { |
970a8fd6 | 2003 | #define FLD(f) abuf->fields.fmt_sll3.f |
646c6f2b | 2004 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2005 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 2006 | |
9d70630e | 2007 | * FLD (f_r1) = SLLSI (* FLD (f_r2), ANDSI (FLD (f_simm16), 31)); |
646c6f2b | 2008 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); |
b8a9943d | 2009 | |
646c6f2b DE |
2010 | #if WITH_PROFILE_MODEL_P |
2011 | if (PROFILE_MODEL_P (current_cpu)) | |
2012 | { | |
9d70630e DE |
2013 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
2014 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 2015 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2016 | } |
2017 | #endif | |
b8a9943d | 2018 | |
646c6f2b DE |
2019 | return new_pc; |
2020 | #undef FLD | |
2021 | } | |
2022 | ||
970a8fd6 | 2023 | /* Perform slli: slli $dr,$uimm5. */ |
646c6f2b | 2024 | CIA |
9d70630e | 2025 | SEM_FN_NAME (m32r,slli) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2026 | { |
970a8fd6 | 2027 | #define FLD(f) abuf->fields.fmt_slli.f |
646c6f2b | 2028 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2029 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2030 | |
9d70630e | 2031 | * FLD (f_r1) = SLLSI (* FLD (f_r1), FLD (f_uimm5)); |
646c6f2b | 2032 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); |
b8a9943d | 2033 | |
646c6f2b DE |
2034 | #if WITH_PROFILE_MODEL_P |
2035 | if (PROFILE_MODEL_P (current_cpu)) | |
2036 | { | |
9d70630e DE |
2037 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
2038 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 2039 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2040 | } |
2041 | #endif | |
b8a9943d | 2042 | |
646c6f2b DE |
2043 | return new_pc; |
2044 | #undef FLD | |
2045 | } | |
2046 | ||
2047 | /* Perform sra: sra $dr,$sr. */ | |
2048 | CIA | |
9d70630e | 2049 | SEM_FN_NAME (m32r,sra) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2050 | { |
970a8fd6 | 2051 | #define FLD(f) abuf->fields.fmt_add.f |
646c6f2b | 2052 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2053 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2054 | |
646c6f2b DE |
2055 | * FLD (f_r1) = SRASI (* FLD (f_r1), ANDSI (* FLD (f_r2), 31)); |
2056 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 2057 | |
646c6f2b DE |
2058 | #if WITH_PROFILE_MODEL_P |
2059 | if (PROFILE_MODEL_P (current_cpu)) | |
2060 | { | |
9d70630e DE |
2061 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
2062 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 2063 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2064 | } |
2065 | #endif | |
b8a9943d | 2066 | |
646c6f2b DE |
2067 | return new_pc; |
2068 | #undef FLD | |
2069 | } | |
2070 | ||
970a8fd6 | 2071 | /* Perform sra3: sra3 $dr,$sr,$simm16. */ |
646c6f2b | 2072 | CIA |
9d70630e | 2073 | SEM_FN_NAME (m32r,sra3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2074 | { |
970a8fd6 | 2075 | #define FLD(f) abuf->fields.fmt_sll3.f |
646c6f2b | 2076 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2077 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 2078 | |
646c6f2b DE |
2079 | * FLD (f_r1) = SRASI (* FLD (f_r2), ANDSI (FLD (f_simm16), 31)); |
2080 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 2081 | |
646c6f2b DE |
2082 | #if WITH_PROFILE_MODEL_P |
2083 | if (PROFILE_MODEL_P (current_cpu)) | |
2084 | { | |
9d70630e DE |
2085 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
2086 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 2087 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2088 | } |
2089 | #endif | |
b8a9943d | 2090 | |
646c6f2b DE |
2091 | return new_pc; |
2092 | #undef FLD | |
2093 | } | |
2094 | ||
970a8fd6 | 2095 | /* Perform srai: srai $dr,$uimm5. */ |
646c6f2b | 2096 | CIA |
9d70630e | 2097 | SEM_FN_NAME (m32r,srai) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2098 | { |
970a8fd6 | 2099 | #define FLD(f) abuf->fields.fmt_slli.f |
646c6f2b | 2100 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2101 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2102 | |
646c6f2b DE |
2103 | * FLD (f_r1) = SRASI (* FLD (f_r1), FLD (f_uimm5)); |
2104 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 2105 | |
646c6f2b DE |
2106 | #if WITH_PROFILE_MODEL_P |
2107 | if (PROFILE_MODEL_P (current_cpu)) | |
2108 | { | |
9d70630e DE |
2109 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
2110 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 2111 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2112 | } |
2113 | #endif | |
b8a9943d | 2114 | |
646c6f2b DE |
2115 | return new_pc; |
2116 | #undef FLD | |
2117 | } | |
2118 | ||
2119 | /* Perform srl: srl $dr,$sr. */ | |
2120 | CIA | |
9d70630e | 2121 | SEM_FN_NAME (m32r,srl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2122 | { |
970a8fd6 | 2123 | #define FLD(f) abuf->fields.fmt_add.f |
646c6f2b | 2124 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2125 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2126 | |
646c6f2b DE |
2127 | * FLD (f_r1) = SRLSI (* FLD (f_r1), ANDSI (* FLD (f_r2), 31)); |
2128 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 2129 | |
646c6f2b DE |
2130 | #if WITH_PROFILE_MODEL_P |
2131 | if (PROFILE_MODEL_P (current_cpu)) | |
2132 | { | |
9d70630e DE |
2133 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
2134 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 2135 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2136 | } |
2137 | #endif | |
b8a9943d | 2138 | |
646c6f2b DE |
2139 | return new_pc; |
2140 | #undef FLD | |
2141 | } | |
2142 | ||
970a8fd6 | 2143 | /* Perform srl3: srl3 $dr,$sr,$simm16. */ |
646c6f2b | 2144 | CIA |
9d70630e | 2145 | SEM_FN_NAME (m32r,srl3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2146 | { |
970a8fd6 | 2147 | #define FLD(f) abuf->fields.fmt_sll3.f |
646c6f2b | 2148 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2149 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 2150 | |
646c6f2b DE |
2151 | * FLD (f_r1) = SRLSI (* FLD (f_r2), ANDSI (FLD (f_simm16), 31)); |
2152 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 2153 | |
646c6f2b DE |
2154 | #if WITH_PROFILE_MODEL_P |
2155 | if (PROFILE_MODEL_P (current_cpu)) | |
2156 | { | |
9d70630e DE |
2157 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
2158 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 2159 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2160 | } |
2161 | #endif | |
b8a9943d | 2162 | |
646c6f2b DE |
2163 | return new_pc; |
2164 | #undef FLD | |
2165 | } | |
2166 | ||
970a8fd6 | 2167 | /* Perform srli: srli $dr,$uimm5. */ |
646c6f2b | 2168 | CIA |
9d70630e | 2169 | SEM_FN_NAME (m32r,srli) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2170 | { |
970a8fd6 | 2171 | #define FLD(f) abuf->fields.fmt_slli.f |
646c6f2b | 2172 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2173 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2174 | |
646c6f2b DE |
2175 | * FLD (f_r1) = SRLSI (* FLD (f_r1), FLD (f_uimm5)); |
2176 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 2177 | |
646c6f2b DE |
2178 | #if WITH_PROFILE_MODEL_P |
2179 | if (PROFILE_MODEL_P (current_cpu)) | |
2180 | { | |
9d70630e DE |
2181 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
2182 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 2183 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2184 | } |
2185 | #endif | |
b8a9943d | 2186 | |
646c6f2b DE |
2187 | return new_pc; |
2188 | #undef FLD | |
2189 | } | |
2190 | ||
2191 | /* Perform st: st $src1,@$src2. */ | |
2192 | CIA | |
9d70630e | 2193 | SEM_FN_NAME (m32r,st) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2194 | { |
970a8fd6 | 2195 | #define FLD(f) abuf->fields.fmt_st.f |
646c6f2b | 2196 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2197 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2198 | |
646c6f2b | 2199 | SETMEMSI (current_cpu, * FLD (f_r2), * FLD (f_r1)); |
b8a9943d DE |
2200 | TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMSI (current_cpu, * FLD (f_r2))); |
2201 | ||
646c6f2b DE |
2202 | #if WITH_PROFILE_MODEL_P |
2203 | if (PROFILE_MODEL_P (current_cpu)) | |
2204 | { | |
9d70630e | 2205 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 2206 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2207 | } |
2208 | #endif | |
b8a9943d | 2209 | |
646c6f2b DE |
2210 | return new_pc; |
2211 | #undef FLD | |
2212 | } | |
2213 | ||
2214 | /* Perform st-d: st $src1,@($slo16,$src2). */ | |
2215 | CIA | |
9d70630e | 2216 | SEM_FN_NAME (m32r,st_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2217 | { |
970a8fd6 | 2218 | #define FLD(f) abuf->fields.fmt_st_d.f |
646c6f2b | 2219 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2220 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 2221 | |
646c6f2b | 2222 | SETMEMSI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), * FLD (f_r1)); |
b8a9943d DE |
2223 | TRACE_RESULT (current_cpu, "h-memory-add-WI-src2-slo16", 'x', GETMEMSI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); |
2224 | ||
646c6f2b DE |
2225 | #if WITH_PROFILE_MODEL_P |
2226 | if (PROFILE_MODEL_P (current_cpu)) | |
2227 | { | |
9d70630e | 2228 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 2229 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2230 | } |
2231 | #endif | |
b8a9943d | 2232 | |
646c6f2b DE |
2233 | return new_pc; |
2234 | #undef FLD | |
2235 | } | |
2236 | ||
2237 | /* Perform stb: stb $src1,@$src2. */ | |
2238 | CIA | |
9d70630e | 2239 | SEM_FN_NAME (m32r,stb) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2240 | { |
970a8fd6 | 2241 | #define FLD(f) abuf->fields.fmt_stb.f |
646c6f2b | 2242 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2243 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2244 | |
646c6f2b | 2245 | SETMEMQI (current_cpu, * FLD (f_r2), * FLD (f_r1)); |
b8a9943d DE |
2246 | TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMQI (current_cpu, * FLD (f_r2))); |
2247 | ||
646c6f2b DE |
2248 | #if WITH_PROFILE_MODEL_P |
2249 | if (PROFILE_MODEL_P (current_cpu)) | |
2250 | { | |
9d70630e | 2251 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 2252 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2253 | } |
2254 | #endif | |
b8a9943d | 2255 | |
646c6f2b DE |
2256 | return new_pc; |
2257 | #undef FLD | |
2258 | } | |
2259 | ||
2260 | /* Perform stb-d: stb $src1,@($slo16,$src2). */ | |
2261 | CIA | |
9d70630e | 2262 | SEM_FN_NAME (m32r,stb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2263 | { |
970a8fd6 | 2264 | #define FLD(f) abuf->fields.fmt_stb_d.f |
646c6f2b | 2265 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2266 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 2267 | |
646c6f2b | 2268 | SETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), * FLD (f_r1)); |
b8a9943d DE |
2269 | TRACE_RESULT (current_cpu, "h-memory-add-WI-src2-slo16", 'x', GETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); |
2270 | ||
646c6f2b DE |
2271 | #if WITH_PROFILE_MODEL_P |
2272 | if (PROFILE_MODEL_P (current_cpu)) | |
2273 | { | |
9d70630e | 2274 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 2275 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2276 | } |
2277 | #endif | |
b8a9943d | 2278 | |
646c6f2b DE |
2279 | return new_pc; |
2280 | #undef FLD | |
2281 | } | |
2282 | ||
2283 | /* Perform sth: sth $src1,@$src2. */ | |
2284 | CIA | |
9d70630e | 2285 | SEM_FN_NAME (m32r,sth) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2286 | { |
970a8fd6 | 2287 | #define FLD(f) abuf->fields.fmt_sth.f |
646c6f2b | 2288 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2289 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2290 | |
646c6f2b | 2291 | SETMEMHI (current_cpu, * FLD (f_r2), * FLD (f_r1)); |
b8a9943d DE |
2292 | TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMHI (current_cpu, * FLD (f_r2))); |
2293 | ||
646c6f2b DE |
2294 | #if WITH_PROFILE_MODEL_P |
2295 | if (PROFILE_MODEL_P (current_cpu)) | |
2296 | { | |
9d70630e | 2297 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 2298 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2299 | } |
2300 | #endif | |
b8a9943d | 2301 | |
646c6f2b DE |
2302 | return new_pc; |
2303 | #undef FLD | |
2304 | } | |
2305 | ||
2306 | /* Perform sth-d: sth $src1,@($slo16,$src2). */ | |
2307 | CIA | |
9d70630e | 2308 | SEM_FN_NAME (m32r,sth_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2309 | { |
970a8fd6 | 2310 | #define FLD(f) abuf->fields.fmt_sth_d.f |
646c6f2b | 2311 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2312 | CIA new_pc = SEM_NEXT_PC (sem_arg, 4); |
b8a9943d | 2313 | |
646c6f2b | 2314 | SETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), * FLD (f_r1)); |
b8a9943d DE |
2315 | TRACE_RESULT (current_cpu, "h-memory-add-WI-src2-slo16", 'x', GETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); |
2316 | ||
646c6f2b DE |
2317 | #if WITH_PROFILE_MODEL_P |
2318 | if (PROFILE_MODEL_P (current_cpu)) | |
2319 | { | |
9d70630e | 2320 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 2321 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2322 | } |
2323 | #endif | |
b8a9943d | 2324 | |
646c6f2b DE |
2325 | return new_pc; |
2326 | #undef FLD | |
2327 | } | |
2328 | ||
2329 | /* Perform st-plus: st $src1,@+$src2. */ | |
2330 | CIA | |
9d70630e | 2331 | SEM_FN_NAME (m32r,st_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2332 | { |
970a8fd6 | 2333 | #define FLD(f) abuf->fields.fmt_st_plus.f |
646c6f2b | 2334 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2335 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2336 | |
9d70630e | 2337 | do { |
02310b01 DE |
2338 | SI tmp_new_src2; |
2339 | tmp_new_src2 = ADDSI (* FLD (f_r2), 4); | |
2340 | SETMEMSI (current_cpu, tmp_new_src2, * FLD (f_r1)); | |
2341 | TRACE_RESULT (current_cpu, "h-memory-new-src2", 'x', GETMEMSI (current_cpu, tmp_new_src2)); | |
2342 | * FLD (f_r2) = tmp_new_src2; | |
646c6f2b | 2343 | TRACE_RESULT (current_cpu, "src2", 'x', * FLD (f_r2)); |
9d70630e | 2344 | } while (0); |
b8a9943d | 2345 | |
646c6f2b DE |
2346 | #if WITH_PROFILE_MODEL_P |
2347 | if (PROFILE_MODEL_P (current_cpu)) | |
2348 | { | |
9d70630e | 2349 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
cab58155 | 2350 | m32r_model_mark_set_h_gr (current_cpu, abuf); |
b8a9943d | 2351 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2352 | } |
2353 | #endif | |
b8a9943d | 2354 | |
646c6f2b DE |
2355 | return new_pc; |
2356 | #undef FLD | |
2357 | } | |
2358 | ||
2359 | /* Perform st-minus: st $src1,@-$src2. */ | |
2360 | CIA | |
9d70630e | 2361 | SEM_FN_NAME (m32r,st_minus) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2362 | { |
970a8fd6 | 2363 | #define FLD(f) abuf->fields.fmt_st_plus.f |
646c6f2b | 2364 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2365 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2366 | |
9d70630e | 2367 | do { |
02310b01 DE |
2368 | SI tmp_new_src2; |
2369 | tmp_new_src2 = SUBSI (* FLD (f_r2), 4); | |
2370 | SETMEMSI (current_cpu, tmp_new_src2, * FLD (f_r1)); | |
2371 | TRACE_RESULT (current_cpu, "h-memory-new-src2", 'x', GETMEMSI (current_cpu, tmp_new_src2)); | |
2372 | * FLD (f_r2) = tmp_new_src2; | |
646c6f2b | 2373 | TRACE_RESULT (current_cpu, "src2", 'x', * FLD (f_r2)); |
9d70630e | 2374 | } while (0); |
b8a9943d | 2375 | |
646c6f2b DE |
2376 | #if WITH_PROFILE_MODEL_P |
2377 | if (PROFILE_MODEL_P (current_cpu)) | |
2378 | { | |
9d70630e | 2379 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
cab58155 | 2380 | m32r_model_mark_set_h_gr (current_cpu, abuf); |
b8a9943d | 2381 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2382 | } |
2383 | #endif | |
b8a9943d | 2384 | |
646c6f2b DE |
2385 | return new_pc; |
2386 | #undef FLD | |
2387 | } | |
2388 | ||
2389 | /* Perform sub: sub $dr,$sr. */ | |
2390 | CIA | |
9d70630e | 2391 | SEM_FN_NAME (m32r,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2392 | { |
970a8fd6 | 2393 | #define FLD(f) abuf->fields.fmt_add.f |
646c6f2b | 2394 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2395 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2396 | |
646c6f2b DE |
2397 | * FLD (f_r1) = SUBSI (* FLD (f_r1), * FLD (f_r2)); |
2398 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
b8a9943d | 2399 | |
646c6f2b DE |
2400 | #if WITH_PROFILE_MODEL_P |
2401 | if (PROFILE_MODEL_P (current_cpu)) | |
2402 | { | |
9d70630e DE |
2403 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
2404 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 2405 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2406 | } |
2407 | #endif | |
b8a9943d | 2408 | |
646c6f2b DE |
2409 | return new_pc; |
2410 | #undef FLD | |
2411 | } | |
2412 | ||
2413 | /* Perform subv: subv $dr,$sr. */ | |
2414 | CIA | |
9d70630e | 2415 | SEM_FN_NAME (m32r,subv) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2416 | { |
970a8fd6 | 2417 | #define FLD(f) abuf->fields.fmt_addv.f |
646c6f2b | 2418 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2419 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2420 | |
646c6f2b DE |
2421 | do { |
2422 | BI temp1;SI temp0; | |
9d70630e DE |
2423 | temp0 = SUBSI (* FLD (f_r1), * FLD (f_r2)); |
2424 | temp1 = SUBOFSI (* FLD (f_r1), * FLD (f_r2), 0); | |
646c6f2b DE |
2425 | * FLD (f_r1) = temp0; |
2426 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
9d70630e DE |
2427 | CPU (h_cond) = temp1; |
2428 | TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); | |
646c6f2b | 2429 | } while (0); |
b8a9943d | 2430 | |
646c6f2b DE |
2431 | #if WITH_PROFILE_MODEL_P |
2432 | if (PROFILE_MODEL_P (current_cpu)) | |
2433 | { | |
9d70630e DE |
2434 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
2435 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 2436 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2437 | } |
2438 | #endif | |
b8a9943d | 2439 | |
646c6f2b DE |
2440 | return new_pc; |
2441 | #undef FLD | |
2442 | } | |
2443 | ||
2444 | /* Perform subx: subx $dr,$sr. */ | |
2445 | CIA | |
9d70630e | 2446 | SEM_FN_NAME (m32r,subx) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2447 | { |
970a8fd6 | 2448 | #define FLD(f) abuf->fields.fmt_addx.f |
646c6f2b | 2449 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2450 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2451 | |
646c6f2b DE |
2452 | do { |
2453 | BI temp1;SI temp0; | |
9d70630e DE |
2454 | temp0 = SUBCSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond)); |
2455 | temp1 = SUBCFSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond)); | |
646c6f2b DE |
2456 | * FLD (f_r1) = temp0; |
2457 | TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); | |
9d70630e DE |
2458 | CPU (h_cond) = temp1; |
2459 | TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); | |
646c6f2b | 2460 | } while (0); |
b8a9943d | 2461 | |
646c6f2b DE |
2462 | #if WITH_PROFILE_MODEL_P |
2463 | if (PROFILE_MODEL_P (current_cpu)) | |
2464 | { | |
9d70630e DE |
2465 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
2466 | m32r_model_mark_set_h_gr (current_cpu, abuf); | |
b8a9943d | 2467 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2468 | } |
2469 | #endif | |
b8a9943d | 2470 | |
646c6f2b DE |
2471 | return new_pc; |
2472 | #undef FLD | |
2473 | } | |
2474 | ||
970a8fd6 | 2475 | /* Perform trap: trap $uimm4. */ |
646c6f2b | 2476 | CIA |
9d70630e | 2477 | SEM_FN_NAME (m32r,trap) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2478 | { |
970a8fd6 | 2479 | #define FLD(f) abuf->fields.fmt_trap.f |
646c6f2b | 2480 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2481 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
646c6f2b | 2482 | int taken_p = 0; |
b8a9943d | 2483 | |
cab58155 DE |
2484 | do { |
2485 | m32r_h_cr_set (current_cpu, 6, ADDSI (CPU (h_pc), 4)); | |
2486 | TRACE_RESULT (current_cpu, "h-cr-6", 'x', m32r_h_cr_get (current_cpu, 6)); | |
970a8fd6 | 2487 | m32r_h_cr_set (current_cpu, 0, ANDSI (SLLSI (m32r_h_cr_get (current_cpu, 0), 8), 65408)); |
cab58155 | 2488 | TRACE_RESULT (current_cpu, "h-cr-0", 'x', m32r_h_cr_get (current_cpu, 0)); |
970a8fd6 DE |
2489 | BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, do_trap (current_cpu, FLD (f_uimm4)))); |
2490 | taken_p = 1; | |
2491 | TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); | |
cab58155 | 2492 | } while (0); |
b8a9943d | 2493 | |
646c6f2b DE |
2494 | #if WITH_PROFILE_MODEL_P |
2495 | if (PROFILE_MODEL_P (current_cpu)) | |
2496 | { | |
b8a9943d | 2497 | m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); |
646c6f2b DE |
2498 | } |
2499 | #endif | |
b8a9943d | 2500 | |
646c6f2b DE |
2501 | return new_pc; |
2502 | #undef FLD | |
2503 | } | |
2504 | ||
2505 | /* Perform unlock: unlock $src1,@$src2. */ | |
2506 | CIA | |
9d70630e | 2507 | SEM_FN_NAME (m32r,unlock) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
646c6f2b | 2508 | { |
970a8fd6 | 2509 | #define FLD(f) abuf->fields.fmt_unlock.f |
646c6f2b | 2510 | ARGBUF *abuf = SEM_ARGBUF (sem_arg); |
02310b01 | 2511 | CIA new_pc = SEM_NEXT_PC (sem_arg, 2); |
b8a9943d | 2512 | |
cab58155 DE |
2513 | do { |
2514 | if (CPU (h_lock)) { | |
2515 | SETMEMSI (current_cpu, * FLD (f_r2), * FLD (f_r1)); | |
2516 | TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMSI (current_cpu, * FLD (f_r2))); | |
2517 | } | |
2518 | CPU (h_lock) = 0; | |
2519 | TRACE_RESULT (current_cpu, "h-lock-0", 'x', CPU (h_lock)); | |
2520 | } while (0); | |
b8a9943d | 2521 | |
646c6f2b DE |
2522 | #if WITH_PROFILE_MODEL_P |
2523 | if (PROFILE_MODEL_P (current_cpu)) | |
2524 | { | |
9d70630e | 2525 | m32r_model_mark_get_h_gr (current_cpu, abuf); |
b8a9943d | 2526 | m32r_model_profile_insn (current_cpu, abuf); |
646c6f2b DE |
2527 | } |
2528 | #endif | |
b8a9943d | 2529 | |
646c6f2b DE |
2530 | return new_pc; |
2531 | #undef FLD | |
2532 | } | |
2533 | ||
e0bd6e18 | 2534 | CIA |
9d70630e DE |
2535 | SEM_FN_NAME (m32r,illegal) (SIM_CPU *current_cpu, SEM_ARG sem_arg) |
2536 | { | |
2537 | sim_engine_illegal_insn (current_cpu, NULL_CIA /*FIXME*/); | |
2538 | return 0; | |
2539 | } | |
2540 | ||
2541 | #endif /* ! defined (SCACHE_P) || (defined (SCACHE_P) && WITH_SCACHE) */ |