1 1.1 christos /* Simulator instruction semantics for lm32bf. 2 1.1 christos 3 1.1 christos THIS FILE IS MACHINE GENERATED WITH CGEN. 4 1.1 christos 5 1.11 christos Copyright (C) 1996-2024 Free Software Foundation, Inc. 6 1.1 christos 7 1.1 christos This file is part of the GNU simulators. 8 1.1 christos 9 1.1 christos This file is free software; you can redistribute it and/or modify 10 1.1 christos it under the terms of the GNU General Public License as published by 11 1.1 christos the Free Software Foundation; either version 3, or (at your option) 12 1.1 christos any later version. 13 1.1 christos 14 1.1 christos It is distributed in the hope that it will be useful, but WITHOUT 15 1.1 christos ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 16 1.1 christos or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 17 1.1 christos License for more details. 18 1.1 christos 19 1.1 christos You should have received a copy of the GNU General Public License along 20 1.11 christos with this program; if not, write to the Free Software Foundation, Inc., 21 1.11 christos 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. 22 1.1 christos 23 1.1 christos */ 24 1.1 christos 25 1.1 christos #define WANT_CPU lm32bf 26 1.1 christos #define WANT_CPU_LM32BF 27 1.1 christos 28 1.1 christos #include "sim-main.h" 29 1.1 christos #include "cgen-mem.h" 30 1.1 christos #include "cgen-ops.h" 31 1.1 christos 32 1.1 christos #undef GET_ATTR 33 1.1 christos #define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr) 34 1.1 christos 35 1.1 christos /* This is used so that we can compile two copies of the semantic code, 36 1.1 christos one with full feature support and one without that runs fast(er). 37 1.1 christos FAST_P, when desired, is defined on the command line, -DFAST_P=1. */ 38 1.1 christos #if FAST_P 39 1.1 christos #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_semf_,fn) 40 1.5 christos #undef CGEN_TRACE_RESULT 41 1.5 christos #define CGEN_TRACE_RESULT(cpu, abuf, name, type, val) 42 1.1 christos #else 43 1.1 christos #define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_sem_,fn) 44 1.1 christos #endif 45 1.1 christos 46 1.1 christos /* x-invalid: --invalid-- */ 47 1.1 christos 48 1.1 christos static SEM_PC 49 1.1 christos SEM_FN_NAME (lm32bf,x_invalid) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 50 1.1 christos { 51 1.1 christos #define FLD(f) abuf->fields.sfmt_empty.f 52 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 53 1.1 christos int UNUSED written = 0; 54 1.1 christos IADDR UNUSED pc = abuf->addr; 55 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); 56 1.1 christos 57 1.1 christos { 58 1.1 christos /* Update the recorded pc in the cpu state struct. 59 1.1 christos Only necessary for WITH_SCACHE case, but to avoid the 60 1.1 christos conditional compilation .... */ 61 1.1 christos SET_H_PC (pc); 62 1.1 christos /* Virtual insns have zero size. Overwrite vpc with address of next insn 63 1.1 christos using the default-insn-bitsize spec. When executing insns in parallel 64 1.1 christos we may want to queue the fault and continue execution. */ 65 1.1 christos vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 66 1.1 christos vpc = sim_engine_invalid_insn (current_cpu, pc, vpc); 67 1.1 christos } 68 1.1 christos 69 1.1 christos return vpc; 70 1.1 christos #undef FLD 71 1.1 christos } 72 1.1 christos 73 1.1 christos /* x-after: --after-- */ 74 1.1 christos 75 1.1 christos static SEM_PC 76 1.1 christos SEM_FN_NAME (lm32bf,x_after) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 77 1.1 christos { 78 1.1 christos #define FLD(f) abuf->fields.sfmt_empty.f 79 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 80 1.1 christos int UNUSED written = 0; 81 1.1 christos IADDR UNUSED pc = abuf->addr; 82 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); 83 1.1 christos 84 1.1 christos { 85 1.1 christos #if WITH_SCACHE_PBB_LM32BF 86 1.1 christos lm32bf_pbb_after (current_cpu, sem_arg); 87 1.1 christos #endif 88 1.1 christos } 89 1.1 christos 90 1.1 christos return vpc; 91 1.1 christos #undef FLD 92 1.1 christos } 93 1.1 christos 94 1.1 christos /* x-before: --before-- */ 95 1.1 christos 96 1.1 christos static SEM_PC 97 1.1 christos SEM_FN_NAME (lm32bf,x_before) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 98 1.1 christos { 99 1.1 christos #define FLD(f) abuf->fields.sfmt_empty.f 100 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 101 1.1 christos int UNUSED written = 0; 102 1.1 christos IADDR UNUSED pc = abuf->addr; 103 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); 104 1.1 christos 105 1.1 christos { 106 1.1 christos #if WITH_SCACHE_PBB_LM32BF 107 1.1 christos lm32bf_pbb_before (current_cpu, sem_arg); 108 1.1 christos #endif 109 1.1 christos } 110 1.1 christos 111 1.1 christos return vpc; 112 1.1 christos #undef FLD 113 1.1 christos } 114 1.1 christos 115 1.1 christos /* x-cti-chain: --cti-chain-- */ 116 1.1 christos 117 1.1 christos static SEM_PC 118 1.1 christos SEM_FN_NAME (lm32bf,x_cti_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 119 1.1 christos { 120 1.1 christos #define FLD(f) abuf->fields.sfmt_empty.f 121 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 122 1.1 christos int UNUSED written = 0; 123 1.1 christos IADDR UNUSED pc = abuf->addr; 124 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); 125 1.1 christos 126 1.1 christos { 127 1.1 christos #if WITH_SCACHE_PBB_LM32BF 128 1.1 christos #ifdef DEFINE_SWITCH 129 1.1 christos vpc = lm32bf_pbb_cti_chain (current_cpu, sem_arg, 130 1.1 christos pbb_br_type, pbb_br_npc); 131 1.1 christos BREAK (sem); 132 1.1 christos #else 133 1.1 christos /* FIXME: Allow provision of explicit ifmt spec in insn spec. */ 134 1.1 christos vpc = lm32bf_pbb_cti_chain (current_cpu, sem_arg, 135 1.1 christos CPU_PBB_BR_TYPE (current_cpu), 136 1.1 christos CPU_PBB_BR_NPC (current_cpu)); 137 1.1 christos #endif 138 1.1 christos #endif 139 1.1 christos } 140 1.1 christos 141 1.1 christos return vpc; 142 1.1 christos #undef FLD 143 1.1 christos } 144 1.1 christos 145 1.1 christos /* x-chain: --chain-- */ 146 1.1 christos 147 1.1 christos static SEM_PC 148 1.1 christos SEM_FN_NAME (lm32bf,x_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 149 1.1 christos { 150 1.1 christos #define FLD(f) abuf->fields.sfmt_empty.f 151 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 152 1.1 christos int UNUSED written = 0; 153 1.1 christos IADDR UNUSED pc = abuf->addr; 154 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); 155 1.1 christos 156 1.1 christos { 157 1.1 christos #if WITH_SCACHE_PBB_LM32BF 158 1.1 christos vpc = lm32bf_pbb_chain (current_cpu, sem_arg); 159 1.1 christos #ifdef DEFINE_SWITCH 160 1.1 christos BREAK (sem); 161 1.1 christos #endif 162 1.1 christos #endif 163 1.1 christos } 164 1.1 christos 165 1.1 christos return vpc; 166 1.1 christos #undef FLD 167 1.1 christos } 168 1.1 christos 169 1.1 christos /* x-begin: --begin-- */ 170 1.1 christos 171 1.1 christos static SEM_PC 172 1.1 christos SEM_FN_NAME (lm32bf,x_begin) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 173 1.1 christos { 174 1.1 christos #define FLD(f) abuf->fields.sfmt_empty.f 175 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 176 1.1 christos int UNUSED written = 0; 177 1.1 christos IADDR UNUSED pc = abuf->addr; 178 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0); 179 1.1 christos 180 1.1 christos { 181 1.1 christos #if WITH_SCACHE_PBB_LM32BF 182 1.1 christos #if defined DEFINE_SWITCH || defined FAST_P 183 1.1 christos /* In the switch case FAST_P is a constant, allowing several optimizations 184 1.1 christos in any called inline functions. */ 185 1.1 christos vpc = lm32bf_pbb_begin (current_cpu, FAST_P); 186 1.1 christos #else 187 1.1 christos #if 0 /* cgen engine can't handle dynamic fast/full switching yet. */ 188 1.1 christos vpc = lm32bf_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu))); 189 1.1 christos #else 190 1.1 christos vpc = lm32bf_pbb_begin (current_cpu, 0); 191 1.1 christos #endif 192 1.1 christos #endif 193 1.1 christos #endif 194 1.1 christos } 195 1.1 christos 196 1.1 christos return vpc; 197 1.1 christos #undef FLD 198 1.1 christos } 199 1.1 christos 200 1.1 christos /* add: add $r2,$r0,$r1 */ 201 1.1 christos 202 1.1 christos static SEM_PC 203 1.1 christos SEM_FN_NAME (lm32bf,add) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 204 1.1 christos { 205 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 206 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 207 1.1 christos int UNUSED written = 0; 208 1.1 christos IADDR UNUSED pc = abuf->addr; 209 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 210 1.1 christos 211 1.1 christos { 212 1.1 christos SI opval = ADDSI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)])); 213 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 214 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 215 1.1 christos } 216 1.1 christos 217 1.1 christos return vpc; 218 1.1 christos #undef FLD 219 1.1 christos } 220 1.1 christos 221 1.1 christos /* addi: addi $r1,$r0,$imm */ 222 1.1 christos 223 1.1 christos static SEM_PC 224 1.1 christos SEM_FN_NAME (lm32bf,addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 225 1.1 christos { 226 1.1 christos #define FLD(f) abuf->fields.sfmt_addi.f 227 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 228 1.1 christos int UNUSED written = 0; 229 1.1 christos IADDR UNUSED pc = abuf->addr; 230 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 231 1.1 christos 232 1.1 christos { 233 1.1 christos SI opval = ADDSI (CPU (h_gr[FLD (f_r0)]), EXTHISI (TRUNCSIHI (FLD (f_imm)))); 234 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 235 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 236 1.1 christos } 237 1.1 christos 238 1.1 christos return vpc; 239 1.1 christos #undef FLD 240 1.1 christos } 241 1.1 christos 242 1.1 christos /* and: and $r2,$r0,$r1 */ 243 1.1 christos 244 1.1 christos static SEM_PC 245 1.1 christos SEM_FN_NAME (lm32bf,and) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 246 1.1 christos { 247 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 248 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 249 1.1 christos int UNUSED written = 0; 250 1.1 christos IADDR UNUSED pc = abuf->addr; 251 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 252 1.1 christos 253 1.1 christos { 254 1.1 christos SI opval = ANDSI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)])); 255 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 256 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 257 1.1 christos } 258 1.1 christos 259 1.1 christos return vpc; 260 1.1 christos #undef FLD 261 1.1 christos } 262 1.1 christos 263 1.1 christos /* andi: andi $r1,$r0,$uimm */ 264 1.1 christos 265 1.1 christos static SEM_PC 266 1.1 christos SEM_FN_NAME (lm32bf,andi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 267 1.1 christos { 268 1.1 christos #define FLD(f) abuf->fields.sfmt_andi.f 269 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 270 1.1 christos int UNUSED written = 0; 271 1.1 christos IADDR UNUSED pc = abuf->addr; 272 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 273 1.1 christos 274 1.1 christos { 275 1.1 christos SI opval = ANDSI (CPU (h_gr[FLD (f_r0)]), ZEXTSISI (FLD (f_uimm))); 276 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 277 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 278 1.1 christos } 279 1.1 christos 280 1.1 christos return vpc; 281 1.1 christos #undef FLD 282 1.1 christos } 283 1.1 christos 284 1.1 christos /* andhii: andhi $r1,$r0,$hi16 */ 285 1.1 christos 286 1.1 christos static SEM_PC 287 1.1 christos SEM_FN_NAME (lm32bf,andhii) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 288 1.1 christos { 289 1.1 christos #define FLD(f) abuf->fields.sfmt_andi.f 290 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 291 1.1 christos int UNUSED written = 0; 292 1.1 christos IADDR UNUSED pc = abuf->addr; 293 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 294 1.1 christos 295 1.1 christos { 296 1.1 christos SI opval = ANDSI (CPU (h_gr[FLD (f_r0)]), SLLSI (FLD (f_uimm), 16)); 297 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 298 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 299 1.1 christos } 300 1.1 christos 301 1.1 christos return vpc; 302 1.1 christos #undef FLD 303 1.1 christos } 304 1.1 christos 305 1.1 christos /* b: b $r0 */ 306 1.1 christos 307 1.1 christos static SEM_PC 308 1.1 christos SEM_FN_NAME (lm32bf,b) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 309 1.1 christos { 310 1.1 christos #define FLD(f) abuf->fields.sfmt_be.f 311 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 312 1.1 christos int UNUSED written = 0; 313 1.1 christos IADDR UNUSED pc = abuf->addr; 314 1.1 christos SEM_BRANCH_INIT 315 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 316 1.1 christos 317 1.1 christos { 318 1.1 christos USI opval = lm32bf_b_insn (current_cpu, CPU (h_gr[FLD (f_r0)]), FLD (f_r0)); 319 1.1 christos SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); 320 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval); 321 1.1 christos } 322 1.1 christos 323 1.1 christos SEM_BRANCH_FINI (vpc); 324 1.1 christos return vpc; 325 1.1 christos #undef FLD 326 1.1 christos } 327 1.1 christos 328 1.1 christos /* bi: bi $call */ 329 1.1 christos 330 1.1 christos static SEM_PC 331 1.1 christos SEM_FN_NAME (lm32bf,bi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 332 1.1 christos { 333 1.1 christos #define FLD(f) abuf->fields.sfmt_bi.f 334 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 335 1.1 christos int UNUSED written = 0; 336 1.1 christos IADDR UNUSED pc = abuf->addr; 337 1.1 christos SEM_BRANCH_INIT 338 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 339 1.1 christos 340 1.1 christos { 341 1.1 christos USI opval = EXTSISI (FLD (i_call)); 342 1.1 christos SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); 343 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval); 344 1.1 christos } 345 1.1 christos 346 1.1 christos SEM_BRANCH_FINI (vpc); 347 1.1 christos return vpc; 348 1.1 christos #undef FLD 349 1.1 christos } 350 1.1 christos 351 1.1 christos /* be: be $r0,$r1,$branch */ 352 1.1 christos 353 1.1 christos static SEM_PC 354 1.1 christos SEM_FN_NAME (lm32bf,be) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 355 1.1 christos { 356 1.1 christos #define FLD(f) abuf->fields.sfmt_be.f 357 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 358 1.1 christos int UNUSED written = 0; 359 1.1 christos IADDR UNUSED pc = abuf->addr; 360 1.1 christos SEM_BRANCH_INIT 361 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 362 1.1 christos 363 1.1 christos if (EQSI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)]))) { 364 1.1 christos { 365 1.1 christos USI opval = FLD (i_branch); 366 1.1 christos SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc); 367 1.1 christos written |= (1 << 3); 368 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval); 369 1.1 christos } 370 1.1 christos } 371 1.1 christos 372 1.1 christos abuf->written = written; 373 1.1 christos SEM_BRANCH_FINI (vpc); 374 1.1 christos return vpc; 375 1.1 christos #undef FLD 376 1.1 christos } 377 1.1 christos 378 1.1 christos /* bg: bg $r0,$r1,$branch */ 379 1.1 christos 380 1.1 christos static SEM_PC 381 1.1 christos SEM_FN_NAME (lm32bf,bg) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 382 1.1 christos { 383 1.1 christos #define FLD(f) abuf->fields.sfmt_be.f 384 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 385 1.1 christos int UNUSED written = 0; 386 1.1 christos IADDR UNUSED pc = abuf->addr; 387 1.1 christos SEM_BRANCH_INIT 388 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 389 1.1 christos 390 1.1 christos if (GTSI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)]))) { 391 1.1 christos { 392 1.1 christos USI opval = FLD (i_branch); 393 1.1 christos SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc); 394 1.1 christos written |= (1 << 3); 395 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval); 396 1.1 christos } 397 1.1 christos } 398 1.1 christos 399 1.1 christos abuf->written = written; 400 1.1 christos SEM_BRANCH_FINI (vpc); 401 1.1 christos return vpc; 402 1.1 christos #undef FLD 403 1.1 christos } 404 1.1 christos 405 1.1 christos /* bge: bge $r0,$r1,$branch */ 406 1.1 christos 407 1.1 christos static SEM_PC 408 1.1 christos SEM_FN_NAME (lm32bf,bge) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 409 1.1 christos { 410 1.1 christos #define FLD(f) abuf->fields.sfmt_be.f 411 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 412 1.1 christos int UNUSED written = 0; 413 1.1 christos IADDR UNUSED pc = abuf->addr; 414 1.1 christos SEM_BRANCH_INIT 415 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 416 1.1 christos 417 1.1 christos if (GESI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)]))) { 418 1.1 christos { 419 1.1 christos USI opval = FLD (i_branch); 420 1.1 christos SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc); 421 1.1 christos written |= (1 << 3); 422 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval); 423 1.1 christos } 424 1.1 christos } 425 1.1 christos 426 1.1 christos abuf->written = written; 427 1.1 christos SEM_BRANCH_FINI (vpc); 428 1.1 christos return vpc; 429 1.1 christos #undef FLD 430 1.1 christos } 431 1.1 christos 432 1.1 christos /* bgeu: bgeu $r0,$r1,$branch */ 433 1.1 christos 434 1.1 christos static SEM_PC 435 1.1 christos SEM_FN_NAME (lm32bf,bgeu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 436 1.1 christos { 437 1.1 christos #define FLD(f) abuf->fields.sfmt_be.f 438 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 439 1.1 christos int UNUSED written = 0; 440 1.1 christos IADDR UNUSED pc = abuf->addr; 441 1.1 christos SEM_BRANCH_INIT 442 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 443 1.1 christos 444 1.1 christos if (GEUSI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)]))) { 445 1.1 christos { 446 1.1 christos USI opval = FLD (i_branch); 447 1.1 christos SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc); 448 1.1 christos written |= (1 << 3); 449 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval); 450 1.1 christos } 451 1.1 christos } 452 1.1 christos 453 1.1 christos abuf->written = written; 454 1.1 christos SEM_BRANCH_FINI (vpc); 455 1.1 christos return vpc; 456 1.1 christos #undef FLD 457 1.1 christos } 458 1.1 christos 459 1.1 christos /* bgu: bgu $r0,$r1,$branch */ 460 1.1 christos 461 1.1 christos static SEM_PC 462 1.1 christos SEM_FN_NAME (lm32bf,bgu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 463 1.1 christos { 464 1.1 christos #define FLD(f) abuf->fields.sfmt_be.f 465 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 466 1.1 christos int UNUSED written = 0; 467 1.1 christos IADDR UNUSED pc = abuf->addr; 468 1.1 christos SEM_BRANCH_INIT 469 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 470 1.1 christos 471 1.1 christos if (GTUSI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)]))) { 472 1.1 christos { 473 1.1 christos USI opval = FLD (i_branch); 474 1.1 christos SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc); 475 1.1 christos written |= (1 << 3); 476 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval); 477 1.1 christos } 478 1.1 christos } 479 1.1 christos 480 1.1 christos abuf->written = written; 481 1.1 christos SEM_BRANCH_FINI (vpc); 482 1.1 christos return vpc; 483 1.1 christos #undef FLD 484 1.1 christos } 485 1.1 christos 486 1.1 christos /* bne: bne $r0,$r1,$branch */ 487 1.1 christos 488 1.1 christos static SEM_PC 489 1.1 christos SEM_FN_NAME (lm32bf,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 490 1.1 christos { 491 1.1 christos #define FLD(f) abuf->fields.sfmt_be.f 492 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 493 1.1 christos int UNUSED written = 0; 494 1.1 christos IADDR UNUSED pc = abuf->addr; 495 1.1 christos SEM_BRANCH_INIT 496 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 497 1.1 christos 498 1.1 christos if (NESI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)]))) { 499 1.1 christos { 500 1.1 christos USI opval = FLD (i_branch); 501 1.1 christos SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc); 502 1.1 christos written |= (1 << 3); 503 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval); 504 1.1 christos } 505 1.1 christos } 506 1.1 christos 507 1.1 christos abuf->written = written; 508 1.1 christos SEM_BRANCH_FINI (vpc); 509 1.1 christos return vpc; 510 1.1 christos #undef FLD 511 1.1 christos } 512 1.1 christos 513 1.1 christos /* call: call $r0 */ 514 1.1 christos 515 1.1 christos static SEM_PC 516 1.1 christos SEM_FN_NAME (lm32bf,call) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 517 1.1 christos { 518 1.1 christos #define FLD(f) abuf->fields.sfmt_be.f 519 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 520 1.1 christos int UNUSED written = 0; 521 1.1 christos IADDR UNUSED pc = abuf->addr; 522 1.1 christos SEM_BRANCH_INIT 523 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 524 1.1 christos 525 1.1 christos { 526 1.1 christos { 527 1.1 christos SI opval = ADDSI (pc, 4); 528 1.1 christos CPU (h_gr[((UINT) 29)]) = opval; 529 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 530 1.1 christos } 531 1.1 christos { 532 1.1 christos USI opval = CPU (h_gr[FLD (f_r0)]); 533 1.1 christos SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); 534 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval); 535 1.1 christos } 536 1.1 christos } 537 1.1 christos 538 1.1 christos SEM_BRANCH_FINI (vpc); 539 1.1 christos return vpc; 540 1.1 christos #undef FLD 541 1.1 christos } 542 1.1 christos 543 1.1 christos /* calli: calli $call */ 544 1.1 christos 545 1.1 christos static SEM_PC 546 1.1 christos SEM_FN_NAME (lm32bf,calli) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 547 1.1 christos { 548 1.1 christos #define FLD(f) abuf->fields.sfmt_bi.f 549 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 550 1.1 christos int UNUSED written = 0; 551 1.1 christos IADDR UNUSED pc = abuf->addr; 552 1.1 christos SEM_BRANCH_INIT 553 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 554 1.1 christos 555 1.1 christos { 556 1.1 christos { 557 1.1 christos SI opval = ADDSI (pc, 4); 558 1.1 christos CPU (h_gr[((UINT) 29)]) = opval; 559 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 560 1.1 christos } 561 1.1 christos { 562 1.1 christos USI opval = EXTSISI (FLD (i_call)); 563 1.1 christos SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); 564 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval); 565 1.1 christos } 566 1.1 christos } 567 1.1 christos 568 1.1 christos SEM_BRANCH_FINI (vpc); 569 1.1 christos return vpc; 570 1.1 christos #undef FLD 571 1.1 christos } 572 1.1 christos 573 1.1 christos /* cmpe: cmpe $r2,$r0,$r1 */ 574 1.1 christos 575 1.1 christos static SEM_PC 576 1.1 christos SEM_FN_NAME (lm32bf,cmpe) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 577 1.1 christos { 578 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 579 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 580 1.1 christos int UNUSED written = 0; 581 1.1 christos IADDR UNUSED pc = abuf->addr; 582 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 583 1.1 christos 584 1.1 christos { 585 1.1 christos SI opval = EQSI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)])); 586 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 587 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 588 1.1 christos } 589 1.1 christos 590 1.1 christos return vpc; 591 1.1 christos #undef FLD 592 1.1 christos } 593 1.1 christos 594 1.1 christos /* cmpei: cmpei $r1,$r0,$imm */ 595 1.1 christos 596 1.1 christos static SEM_PC 597 1.1 christos SEM_FN_NAME (lm32bf,cmpei) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 598 1.1 christos { 599 1.1 christos #define FLD(f) abuf->fields.sfmt_addi.f 600 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 601 1.1 christos int UNUSED written = 0; 602 1.1 christos IADDR UNUSED pc = abuf->addr; 603 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 604 1.1 christos 605 1.1 christos { 606 1.1 christos SI opval = EQSI (CPU (h_gr[FLD (f_r0)]), EXTHISI (TRUNCSIHI (FLD (f_imm)))); 607 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 608 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 609 1.1 christos } 610 1.1 christos 611 1.1 christos return vpc; 612 1.1 christos #undef FLD 613 1.1 christos } 614 1.1 christos 615 1.1 christos /* cmpg: cmpg $r2,$r0,$r1 */ 616 1.1 christos 617 1.1 christos static SEM_PC 618 1.1 christos SEM_FN_NAME (lm32bf,cmpg) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 619 1.1 christos { 620 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 621 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 622 1.1 christos int UNUSED written = 0; 623 1.1 christos IADDR UNUSED pc = abuf->addr; 624 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 625 1.1 christos 626 1.1 christos { 627 1.1 christos SI opval = GTSI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)])); 628 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 629 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 630 1.1 christos } 631 1.1 christos 632 1.1 christos return vpc; 633 1.1 christos #undef FLD 634 1.1 christos } 635 1.1 christos 636 1.1 christos /* cmpgi: cmpgi $r1,$r0,$imm */ 637 1.1 christos 638 1.1 christos static SEM_PC 639 1.1 christos SEM_FN_NAME (lm32bf,cmpgi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 640 1.1 christos { 641 1.1 christos #define FLD(f) abuf->fields.sfmt_addi.f 642 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 643 1.1 christos int UNUSED written = 0; 644 1.1 christos IADDR UNUSED pc = abuf->addr; 645 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 646 1.1 christos 647 1.1 christos { 648 1.1 christos SI opval = GTSI (CPU (h_gr[FLD (f_r0)]), EXTHISI (TRUNCSIHI (FLD (f_imm)))); 649 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 650 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 651 1.1 christos } 652 1.1 christos 653 1.1 christos return vpc; 654 1.1 christos #undef FLD 655 1.1 christos } 656 1.1 christos 657 1.1 christos /* cmpge: cmpge $r2,$r0,$r1 */ 658 1.1 christos 659 1.1 christos static SEM_PC 660 1.1 christos SEM_FN_NAME (lm32bf,cmpge) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 661 1.1 christos { 662 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 663 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 664 1.1 christos int UNUSED written = 0; 665 1.1 christos IADDR UNUSED pc = abuf->addr; 666 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 667 1.1 christos 668 1.1 christos { 669 1.1 christos SI opval = GESI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)])); 670 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 671 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 672 1.1 christos } 673 1.1 christos 674 1.1 christos return vpc; 675 1.1 christos #undef FLD 676 1.1 christos } 677 1.1 christos 678 1.1 christos /* cmpgei: cmpgei $r1,$r0,$imm */ 679 1.1 christos 680 1.1 christos static SEM_PC 681 1.1 christos SEM_FN_NAME (lm32bf,cmpgei) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 682 1.1 christos { 683 1.1 christos #define FLD(f) abuf->fields.sfmt_addi.f 684 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 685 1.1 christos int UNUSED written = 0; 686 1.1 christos IADDR UNUSED pc = abuf->addr; 687 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 688 1.1 christos 689 1.1 christos { 690 1.1 christos SI opval = GESI (CPU (h_gr[FLD (f_r0)]), EXTHISI (TRUNCSIHI (FLD (f_imm)))); 691 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 692 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 693 1.1 christos } 694 1.1 christos 695 1.1 christos return vpc; 696 1.1 christos #undef FLD 697 1.1 christos } 698 1.1 christos 699 1.1 christos /* cmpgeu: cmpgeu $r2,$r0,$r1 */ 700 1.1 christos 701 1.1 christos static SEM_PC 702 1.1 christos SEM_FN_NAME (lm32bf,cmpgeu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 703 1.1 christos { 704 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 705 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 706 1.1 christos int UNUSED written = 0; 707 1.1 christos IADDR UNUSED pc = abuf->addr; 708 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 709 1.1 christos 710 1.1 christos { 711 1.1 christos SI opval = GEUSI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)])); 712 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 713 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 714 1.1 christos } 715 1.1 christos 716 1.1 christos return vpc; 717 1.1 christos #undef FLD 718 1.1 christos } 719 1.1 christos 720 1.1 christos /* cmpgeui: cmpgeui $r1,$r0,$uimm */ 721 1.1 christos 722 1.1 christos static SEM_PC 723 1.1 christos SEM_FN_NAME (lm32bf,cmpgeui) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 724 1.1 christos { 725 1.1 christos #define FLD(f) abuf->fields.sfmt_andi.f 726 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 727 1.1 christos int UNUSED written = 0; 728 1.1 christos IADDR UNUSED pc = abuf->addr; 729 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 730 1.1 christos 731 1.1 christos { 732 1.1 christos SI opval = GEUSI (CPU (h_gr[FLD (f_r0)]), ZEXTSISI (FLD (f_uimm))); 733 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 734 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 735 1.1 christos } 736 1.1 christos 737 1.1 christos return vpc; 738 1.1 christos #undef FLD 739 1.1 christos } 740 1.1 christos 741 1.1 christos /* cmpgu: cmpgu $r2,$r0,$r1 */ 742 1.1 christos 743 1.1 christos static SEM_PC 744 1.1 christos SEM_FN_NAME (lm32bf,cmpgu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 745 1.1 christos { 746 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 747 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 748 1.1 christos int UNUSED written = 0; 749 1.1 christos IADDR UNUSED pc = abuf->addr; 750 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 751 1.1 christos 752 1.1 christos { 753 1.1 christos SI opval = GTUSI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)])); 754 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 755 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 756 1.1 christos } 757 1.1 christos 758 1.1 christos return vpc; 759 1.1 christos #undef FLD 760 1.1 christos } 761 1.1 christos 762 1.1 christos /* cmpgui: cmpgui $r1,$r0,$uimm */ 763 1.1 christos 764 1.1 christos static SEM_PC 765 1.1 christos SEM_FN_NAME (lm32bf,cmpgui) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 766 1.1 christos { 767 1.1 christos #define FLD(f) abuf->fields.sfmt_andi.f 768 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 769 1.1 christos int UNUSED written = 0; 770 1.1 christos IADDR UNUSED pc = abuf->addr; 771 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 772 1.1 christos 773 1.1 christos { 774 1.1 christos SI opval = GTUSI (CPU (h_gr[FLD (f_r0)]), ZEXTSISI (FLD (f_uimm))); 775 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 776 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 777 1.1 christos } 778 1.1 christos 779 1.1 christos return vpc; 780 1.1 christos #undef FLD 781 1.1 christos } 782 1.1 christos 783 1.1 christos /* cmpne: cmpne $r2,$r0,$r1 */ 784 1.1 christos 785 1.1 christos static SEM_PC 786 1.1 christos SEM_FN_NAME (lm32bf,cmpne) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 787 1.1 christos { 788 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 789 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 790 1.1 christos int UNUSED written = 0; 791 1.1 christos IADDR UNUSED pc = abuf->addr; 792 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 793 1.1 christos 794 1.1 christos { 795 1.1 christos SI opval = NESI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)])); 796 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 797 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 798 1.1 christos } 799 1.1 christos 800 1.1 christos return vpc; 801 1.1 christos #undef FLD 802 1.1 christos } 803 1.1 christos 804 1.1 christos /* cmpnei: cmpnei $r1,$r0,$imm */ 805 1.1 christos 806 1.1 christos static SEM_PC 807 1.1 christos SEM_FN_NAME (lm32bf,cmpnei) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 808 1.1 christos { 809 1.1 christos #define FLD(f) abuf->fields.sfmt_addi.f 810 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 811 1.1 christos int UNUSED written = 0; 812 1.1 christos IADDR UNUSED pc = abuf->addr; 813 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 814 1.1 christos 815 1.1 christos { 816 1.1 christos SI opval = NESI (CPU (h_gr[FLD (f_r0)]), EXTHISI (TRUNCSIHI (FLD (f_imm)))); 817 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 818 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 819 1.1 christos } 820 1.1 christos 821 1.1 christos return vpc; 822 1.1 christos #undef FLD 823 1.1 christos } 824 1.1 christos 825 1.1 christos /* divu: divu $r2,$r0,$r1 */ 826 1.1 christos 827 1.1 christos static SEM_PC 828 1.1 christos SEM_FN_NAME (lm32bf,divu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 829 1.1 christos { 830 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 831 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 832 1.1 christos int UNUSED written = 0; 833 1.1 christos IADDR UNUSED pc = abuf->addr; 834 1.1 christos SEM_BRANCH_INIT 835 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 836 1.1 christos 837 1.1 christos { 838 1.1 christos USI opval = lm32bf_divu_insn (current_cpu, pc, FLD (f_r0), FLD (f_r1), FLD (f_r2)); 839 1.1 christos SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); 840 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval); 841 1.1 christos } 842 1.1 christos 843 1.1 christos SEM_BRANCH_FINI (vpc); 844 1.1 christos return vpc; 845 1.1 christos #undef FLD 846 1.1 christos } 847 1.1 christos 848 1.1 christos /* lb: lb $r1,($r0+$imm) */ 849 1.1 christos 850 1.1 christos static SEM_PC 851 1.1 christos SEM_FN_NAME (lm32bf,lb) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 852 1.1 christos { 853 1.1 christos #define FLD(f) abuf->fields.sfmt_addi.f 854 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 855 1.1 christos int UNUSED written = 0; 856 1.1 christos IADDR UNUSED pc = abuf->addr; 857 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 858 1.1 christos 859 1.1 christos { 860 1.1 christos SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (CPU (h_gr[FLD (f_r0)]), EXTHISI (TRUNCSIHI (FLD (f_imm)))))); 861 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 862 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 863 1.1 christos } 864 1.1 christos 865 1.1 christos return vpc; 866 1.1 christos #undef FLD 867 1.1 christos } 868 1.1 christos 869 1.1 christos /* lbu: lbu $r1,($r0+$imm) */ 870 1.1 christos 871 1.1 christos static SEM_PC 872 1.1 christos SEM_FN_NAME (lm32bf,lbu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 873 1.1 christos { 874 1.1 christos #define FLD(f) abuf->fields.sfmt_addi.f 875 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 876 1.1 christos int UNUSED written = 0; 877 1.1 christos IADDR UNUSED pc = abuf->addr; 878 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 879 1.1 christos 880 1.1 christos { 881 1.1 christos SI opval = ZEXTQISI (GETMEMQI (current_cpu, pc, ADDSI (CPU (h_gr[FLD (f_r0)]), EXTHISI (TRUNCSIHI (FLD (f_imm)))))); 882 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 883 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 884 1.1 christos } 885 1.1 christos 886 1.1 christos return vpc; 887 1.1 christos #undef FLD 888 1.1 christos } 889 1.1 christos 890 1.1 christos /* lh: lh $r1,($r0+$imm) */ 891 1.1 christos 892 1.1 christos static SEM_PC 893 1.1 christos SEM_FN_NAME (lm32bf,lh) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 894 1.1 christos { 895 1.1 christos #define FLD(f) abuf->fields.sfmt_addi.f 896 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 897 1.1 christos int UNUSED written = 0; 898 1.1 christos IADDR UNUSED pc = abuf->addr; 899 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 900 1.1 christos 901 1.1 christos { 902 1.1 christos SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (CPU (h_gr[FLD (f_r0)]), EXTHISI (TRUNCSIHI (FLD (f_imm)))))); 903 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 904 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 905 1.1 christos } 906 1.1 christos 907 1.1 christos return vpc; 908 1.1 christos #undef FLD 909 1.1 christos } 910 1.1 christos 911 1.1 christos /* lhu: lhu $r1,($r0+$imm) */ 912 1.1 christos 913 1.1 christos static SEM_PC 914 1.1 christos SEM_FN_NAME (lm32bf,lhu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 915 1.1 christos { 916 1.1 christos #define FLD(f) abuf->fields.sfmt_addi.f 917 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 918 1.1 christos int UNUSED written = 0; 919 1.1 christos IADDR UNUSED pc = abuf->addr; 920 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 921 1.1 christos 922 1.1 christos { 923 1.1 christos SI opval = ZEXTHISI (GETMEMHI (current_cpu, pc, ADDSI (CPU (h_gr[FLD (f_r0)]), EXTHISI (TRUNCSIHI (FLD (f_imm)))))); 924 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 925 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 926 1.1 christos } 927 1.1 christos 928 1.1 christos return vpc; 929 1.1 christos #undef FLD 930 1.1 christos } 931 1.1 christos 932 1.1 christos /* lw: lw $r1,($r0+$imm) */ 933 1.1 christos 934 1.1 christos static SEM_PC 935 1.1 christos SEM_FN_NAME (lm32bf,lw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 936 1.1 christos { 937 1.1 christos #define FLD(f) abuf->fields.sfmt_addi.f 938 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 939 1.1 christos int UNUSED written = 0; 940 1.1 christos IADDR UNUSED pc = abuf->addr; 941 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 942 1.1 christos 943 1.1 christos { 944 1.1 christos SI opval = GETMEMSI (current_cpu, pc, ADDSI (CPU (h_gr[FLD (f_r0)]), EXTHISI (TRUNCSIHI (FLD (f_imm))))); 945 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 946 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 947 1.1 christos } 948 1.1 christos 949 1.1 christos return vpc; 950 1.1 christos #undef FLD 951 1.1 christos } 952 1.1 christos 953 1.1 christos /* modu: modu $r2,$r0,$r1 */ 954 1.1 christos 955 1.1 christos static SEM_PC 956 1.1 christos SEM_FN_NAME (lm32bf,modu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 957 1.1 christos { 958 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 959 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 960 1.1 christos int UNUSED written = 0; 961 1.1 christos IADDR UNUSED pc = abuf->addr; 962 1.1 christos SEM_BRANCH_INIT 963 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 964 1.1 christos 965 1.1 christos { 966 1.1 christos USI opval = lm32bf_modu_insn (current_cpu, pc, FLD (f_r0), FLD (f_r1), FLD (f_r2)); 967 1.1 christos SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); 968 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval); 969 1.1 christos } 970 1.1 christos 971 1.1 christos SEM_BRANCH_FINI (vpc); 972 1.1 christos return vpc; 973 1.1 christos #undef FLD 974 1.1 christos } 975 1.1 christos 976 1.1 christos /* mul: mul $r2,$r0,$r1 */ 977 1.1 christos 978 1.1 christos static SEM_PC 979 1.1 christos SEM_FN_NAME (lm32bf,mul) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 980 1.1 christos { 981 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 982 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 983 1.1 christos int UNUSED written = 0; 984 1.1 christos IADDR UNUSED pc = abuf->addr; 985 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 986 1.1 christos 987 1.1 christos { 988 1.1 christos SI opval = MULSI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)])); 989 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 990 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 991 1.1 christos } 992 1.1 christos 993 1.1 christos return vpc; 994 1.1 christos #undef FLD 995 1.1 christos } 996 1.1 christos 997 1.1 christos /* muli: muli $r1,$r0,$imm */ 998 1.1 christos 999 1.1 christos static SEM_PC 1000 1.1 christos SEM_FN_NAME (lm32bf,muli) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1001 1.1 christos { 1002 1.1 christos #define FLD(f) abuf->fields.sfmt_addi.f 1003 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1004 1.1 christos int UNUSED written = 0; 1005 1.1 christos IADDR UNUSED pc = abuf->addr; 1006 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1007 1.1 christos 1008 1.1 christos { 1009 1.1 christos SI opval = MULSI (CPU (h_gr[FLD (f_r0)]), EXTHISI (TRUNCSIHI (FLD (f_imm)))); 1010 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 1011 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1012 1.1 christos } 1013 1.1 christos 1014 1.1 christos return vpc; 1015 1.1 christos #undef FLD 1016 1.1 christos } 1017 1.1 christos 1018 1.1 christos /* nor: nor $r2,$r0,$r1 */ 1019 1.1 christos 1020 1.1 christos static SEM_PC 1021 1.1 christos SEM_FN_NAME (lm32bf,nor) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1022 1.1 christos { 1023 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 1024 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1025 1.1 christos int UNUSED written = 0; 1026 1.1 christos IADDR UNUSED pc = abuf->addr; 1027 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1028 1.1 christos 1029 1.1 christos { 1030 1.1 christos SI opval = INVSI (ORSI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)]))); 1031 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 1032 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1033 1.1 christos } 1034 1.1 christos 1035 1.1 christos return vpc; 1036 1.1 christos #undef FLD 1037 1.1 christos } 1038 1.1 christos 1039 1.1 christos /* nori: nori $r1,$r0,$uimm */ 1040 1.1 christos 1041 1.1 christos static SEM_PC 1042 1.1 christos SEM_FN_NAME (lm32bf,nori) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1043 1.1 christos { 1044 1.1 christos #define FLD(f) abuf->fields.sfmt_andi.f 1045 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1046 1.1 christos int UNUSED written = 0; 1047 1.1 christos IADDR UNUSED pc = abuf->addr; 1048 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1049 1.1 christos 1050 1.1 christos { 1051 1.1 christos SI opval = INVSI (ORSI (CPU (h_gr[FLD (f_r0)]), ZEXTSISI (FLD (f_uimm)))); 1052 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 1053 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1054 1.1 christos } 1055 1.1 christos 1056 1.1 christos return vpc; 1057 1.1 christos #undef FLD 1058 1.1 christos } 1059 1.1 christos 1060 1.1 christos /* or: or $r2,$r0,$r1 */ 1061 1.1 christos 1062 1.1 christos static SEM_PC 1063 1.1 christos SEM_FN_NAME (lm32bf,or) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1064 1.1 christos { 1065 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 1066 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1067 1.1 christos int UNUSED written = 0; 1068 1.1 christos IADDR UNUSED pc = abuf->addr; 1069 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1070 1.1 christos 1071 1.1 christos { 1072 1.1 christos SI opval = ORSI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)])); 1073 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 1074 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1075 1.1 christos } 1076 1.1 christos 1077 1.1 christos return vpc; 1078 1.1 christos #undef FLD 1079 1.1 christos } 1080 1.1 christos 1081 1.1 christos /* ori: ori $r1,$r0,$lo16 */ 1082 1.1 christos 1083 1.1 christos static SEM_PC 1084 1.1 christos SEM_FN_NAME (lm32bf,ori) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1085 1.1 christos { 1086 1.1 christos #define FLD(f) abuf->fields.sfmt_andi.f 1087 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1088 1.1 christos int UNUSED written = 0; 1089 1.1 christos IADDR UNUSED pc = abuf->addr; 1090 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1091 1.1 christos 1092 1.1 christos { 1093 1.1 christos SI opval = ORSI (CPU (h_gr[FLD (f_r0)]), ZEXTSISI (FLD (f_uimm))); 1094 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 1095 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1096 1.1 christos } 1097 1.1 christos 1098 1.1 christos return vpc; 1099 1.1 christos #undef FLD 1100 1.1 christos } 1101 1.1 christos 1102 1.1 christos /* orhii: orhi $r1,$r0,$hi16 */ 1103 1.1 christos 1104 1.1 christos static SEM_PC 1105 1.1 christos SEM_FN_NAME (lm32bf,orhii) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1106 1.1 christos { 1107 1.1 christos #define FLD(f) abuf->fields.sfmt_andi.f 1108 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1109 1.1 christos int UNUSED written = 0; 1110 1.1 christos IADDR UNUSED pc = abuf->addr; 1111 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1112 1.1 christos 1113 1.1 christos { 1114 1.1 christos SI opval = ORSI (CPU (h_gr[FLD (f_r0)]), SLLSI (FLD (f_uimm), 16)); 1115 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 1116 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1117 1.1 christos } 1118 1.1 christos 1119 1.1 christos return vpc; 1120 1.1 christos #undef FLD 1121 1.1 christos } 1122 1.1 christos 1123 1.1 christos /* rcsr: rcsr $r2,$csr */ 1124 1.1 christos 1125 1.1 christos static SEM_PC 1126 1.1 christos SEM_FN_NAME (lm32bf,rcsr) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1127 1.1 christos { 1128 1.1 christos #define FLD(f) abuf->fields.sfmt_rcsr.f 1129 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1130 1.1 christos int UNUSED written = 0; 1131 1.1 christos IADDR UNUSED pc = abuf->addr; 1132 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1133 1.1 christos 1134 1.1 christos { 1135 1.1 christos SI opval = CPU (h_csr[FLD (f_csr)]); 1136 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 1137 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1138 1.1 christos } 1139 1.1 christos 1140 1.1 christos return vpc; 1141 1.1 christos #undef FLD 1142 1.1 christos } 1143 1.1 christos 1144 1.1 christos /* sb: sb ($r0+$imm),$r1 */ 1145 1.1 christos 1146 1.1 christos static SEM_PC 1147 1.1 christos SEM_FN_NAME (lm32bf,sb) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1148 1.1 christos { 1149 1.1 christos #define FLD(f) abuf->fields.sfmt_addi.f 1150 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1151 1.1 christos int UNUSED written = 0; 1152 1.1 christos IADDR UNUSED pc = abuf->addr; 1153 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1154 1.1 christos 1155 1.1 christos { 1156 1.1 christos QI opval = CPU (h_gr[FLD (f_r1)]); 1157 1.1 christos SETMEMQI (current_cpu, pc, ADDSI (CPU (h_gr[FLD (f_r0)]), EXTHISI (TRUNCSIHI (FLD (f_imm)))), opval); 1158 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); 1159 1.1 christos } 1160 1.1 christos 1161 1.1 christos return vpc; 1162 1.1 christos #undef FLD 1163 1.1 christos } 1164 1.1 christos 1165 1.1 christos /* sextb: sextb $r2,$r0 */ 1166 1.1 christos 1167 1.1 christos static SEM_PC 1168 1.1 christos SEM_FN_NAME (lm32bf,sextb) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1169 1.1 christos { 1170 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 1171 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1172 1.1 christos int UNUSED written = 0; 1173 1.1 christos IADDR UNUSED pc = abuf->addr; 1174 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1175 1.1 christos 1176 1.1 christos { 1177 1.1 christos SI opval = EXTQISI (TRUNCSIQI (CPU (h_gr[FLD (f_r0)]))); 1178 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 1179 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1180 1.1 christos } 1181 1.1 christos 1182 1.1 christos return vpc; 1183 1.1 christos #undef FLD 1184 1.1 christos } 1185 1.1 christos 1186 1.1 christos /* sexth: sexth $r2,$r0 */ 1187 1.1 christos 1188 1.1 christos static SEM_PC 1189 1.1 christos SEM_FN_NAME (lm32bf,sexth) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1190 1.1 christos { 1191 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 1192 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1193 1.1 christos int UNUSED written = 0; 1194 1.1 christos IADDR UNUSED pc = abuf->addr; 1195 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1196 1.1 christos 1197 1.1 christos { 1198 1.1 christos SI opval = EXTHISI (TRUNCSIHI (CPU (h_gr[FLD (f_r0)]))); 1199 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 1200 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1201 1.1 christos } 1202 1.1 christos 1203 1.1 christos return vpc; 1204 1.1 christos #undef FLD 1205 1.1 christos } 1206 1.1 christos 1207 1.1 christos /* sh: sh ($r0+$imm),$r1 */ 1208 1.1 christos 1209 1.1 christos static SEM_PC 1210 1.1 christos SEM_FN_NAME (lm32bf,sh) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1211 1.1 christos { 1212 1.1 christos #define FLD(f) abuf->fields.sfmt_addi.f 1213 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1214 1.1 christos int UNUSED written = 0; 1215 1.1 christos IADDR UNUSED pc = abuf->addr; 1216 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1217 1.1 christos 1218 1.1 christos { 1219 1.1 christos HI opval = CPU (h_gr[FLD (f_r1)]); 1220 1.1 christos SETMEMHI (current_cpu, pc, ADDSI (CPU (h_gr[FLD (f_r0)]), EXTHISI (TRUNCSIHI (FLD (f_imm)))), opval); 1221 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); 1222 1.1 christos } 1223 1.1 christos 1224 1.1 christos return vpc; 1225 1.1 christos #undef FLD 1226 1.1 christos } 1227 1.1 christos 1228 1.1 christos /* sl: sl $r2,$r0,$r1 */ 1229 1.1 christos 1230 1.1 christos static SEM_PC 1231 1.1 christos SEM_FN_NAME (lm32bf,sl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1232 1.1 christos { 1233 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 1234 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1235 1.1 christos int UNUSED written = 0; 1236 1.1 christos IADDR UNUSED pc = abuf->addr; 1237 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1238 1.1 christos 1239 1.1 christos { 1240 1.1 christos SI opval = SLLSI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)])); 1241 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 1242 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1243 1.1 christos } 1244 1.1 christos 1245 1.1 christos return vpc; 1246 1.1 christos #undef FLD 1247 1.1 christos } 1248 1.1 christos 1249 1.1 christos /* sli: sli $r1,$r0,$imm */ 1250 1.1 christos 1251 1.1 christos static SEM_PC 1252 1.1 christos SEM_FN_NAME (lm32bf,sli) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1253 1.1 christos { 1254 1.1 christos #define FLD(f) abuf->fields.sfmt_addi.f 1255 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1256 1.1 christos int UNUSED written = 0; 1257 1.1 christos IADDR UNUSED pc = abuf->addr; 1258 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1259 1.1 christos 1260 1.1 christos { 1261 1.1 christos SI opval = SLLSI (CPU (h_gr[FLD (f_r0)]), FLD (f_imm)); 1262 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 1263 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1264 1.1 christos } 1265 1.1 christos 1266 1.1 christos return vpc; 1267 1.1 christos #undef FLD 1268 1.1 christos } 1269 1.1 christos 1270 1.1 christos /* sr: sr $r2,$r0,$r1 */ 1271 1.1 christos 1272 1.1 christos static SEM_PC 1273 1.1 christos SEM_FN_NAME (lm32bf,sr) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1274 1.1 christos { 1275 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 1276 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1277 1.1 christos int UNUSED written = 0; 1278 1.1 christos IADDR UNUSED pc = abuf->addr; 1279 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1280 1.1 christos 1281 1.1 christos { 1282 1.1 christos SI opval = SRASI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)])); 1283 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 1284 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1285 1.1 christos } 1286 1.1 christos 1287 1.1 christos return vpc; 1288 1.1 christos #undef FLD 1289 1.1 christos } 1290 1.1 christos 1291 1.1 christos /* sri: sri $r1,$r0,$imm */ 1292 1.1 christos 1293 1.1 christos static SEM_PC 1294 1.1 christos SEM_FN_NAME (lm32bf,sri) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1295 1.1 christos { 1296 1.1 christos #define FLD(f) abuf->fields.sfmt_addi.f 1297 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1298 1.1 christos int UNUSED written = 0; 1299 1.1 christos IADDR UNUSED pc = abuf->addr; 1300 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1301 1.1 christos 1302 1.1 christos { 1303 1.1 christos SI opval = SRASI (CPU (h_gr[FLD (f_r0)]), FLD (f_imm)); 1304 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 1305 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1306 1.1 christos } 1307 1.1 christos 1308 1.1 christos return vpc; 1309 1.1 christos #undef FLD 1310 1.1 christos } 1311 1.1 christos 1312 1.1 christos /* sru: sru $r2,$r0,$r1 */ 1313 1.1 christos 1314 1.1 christos static SEM_PC 1315 1.1 christos SEM_FN_NAME (lm32bf,sru) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1316 1.1 christos { 1317 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 1318 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1319 1.1 christos int UNUSED written = 0; 1320 1.1 christos IADDR UNUSED pc = abuf->addr; 1321 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1322 1.1 christos 1323 1.1 christos { 1324 1.1 christos SI opval = SRLSI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)])); 1325 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 1326 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1327 1.1 christos } 1328 1.1 christos 1329 1.1 christos return vpc; 1330 1.1 christos #undef FLD 1331 1.1 christos } 1332 1.1 christos 1333 1.1 christos /* srui: srui $r1,$r0,$imm */ 1334 1.1 christos 1335 1.1 christos static SEM_PC 1336 1.1 christos SEM_FN_NAME (lm32bf,srui) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1337 1.1 christos { 1338 1.1 christos #define FLD(f) abuf->fields.sfmt_addi.f 1339 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1340 1.1 christos int UNUSED written = 0; 1341 1.1 christos IADDR UNUSED pc = abuf->addr; 1342 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1343 1.1 christos 1344 1.1 christos { 1345 1.1 christos SI opval = SRLSI (CPU (h_gr[FLD (f_r0)]), FLD (f_imm)); 1346 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 1347 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1348 1.1 christos } 1349 1.1 christos 1350 1.1 christos return vpc; 1351 1.1 christos #undef FLD 1352 1.1 christos } 1353 1.1 christos 1354 1.1 christos /* sub: sub $r2,$r0,$r1 */ 1355 1.1 christos 1356 1.1 christos static SEM_PC 1357 1.1 christos SEM_FN_NAME (lm32bf,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1358 1.1 christos { 1359 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 1360 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1361 1.1 christos int UNUSED written = 0; 1362 1.1 christos IADDR UNUSED pc = abuf->addr; 1363 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1364 1.1 christos 1365 1.1 christos { 1366 1.1 christos SI opval = SUBSI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)])); 1367 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 1368 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1369 1.1 christos } 1370 1.1 christos 1371 1.1 christos return vpc; 1372 1.1 christos #undef FLD 1373 1.1 christos } 1374 1.1 christos 1375 1.1 christos /* sw: sw ($r0+$imm),$r1 */ 1376 1.1 christos 1377 1.1 christos static SEM_PC 1378 1.1 christos SEM_FN_NAME (lm32bf,sw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1379 1.1 christos { 1380 1.1 christos #define FLD(f) abuf->fields.sfmt_addi.f 1381 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1382 1.1 christos int UNUSED written = 0; 1383 1.1 christos IADDR UNUSED pc = abuf->addr; 1384 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1385 1.1 christos 1386 1.1 christos { 1387 1.1 christos SI opval = CPU (h_gr[FLD (f_r1)]); 1388 1.1 christos SETMEMSI (current_cpu, pc, ADDSI (CPU (h_gr[FLD (f_r0)]), EXTHISI (TRUNCSIHI (FLD (f_imm)))), opval); 1389 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); 1390 1.1 christos } 1391 1.1 christos 1392 1.1 christos return vpc; 1393 1.1 christos #undef FLD 1394 1.1 christos } 1395 1.1 christos 1396 1.1 christos /* user: user $r2,$r0,$r1,$user */ 1397 1.1 christos 1398 1.1 christos static SEM_PC 1399 1.1 christos SEM_FN_NAME (lm32bf,user) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1400 1.1 christos { 1401 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 1402 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1403 1.1 christos int UNUSED written = 0; 1404 1.1 christos IADDR UNUSED pc = abuf->addr; 1405 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1406 1.1 christos 1407 1.1 christos { 1408 1.1 christos SI opval = lm32bf_user_insn (current_cpu, CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)]), FLD (f_user)); 1409 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 1410 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1411 1.1 christos } 1412 1.1 christos 1413 1.1 christos return vpc; 1414 1.1 christos #undef FLD 1415 1.1 christos } 1416 1.1 christos 1417 1.1 christos /* wcsr: wcsr $csr,$r1 */ 1418 1.1 christos 1419 1.1 christos static SEM_PC 1420 1.1 christos SEM_FN_NAME (lm32bf,wcsr) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1421 1.1 christos { 1422 1.1 christos #define FLD(f) abuf->fields.sfmt_wcsr.f 1423 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1424 1.1 christos int UNUSED written = 0; 1425 1.1 christos IADDR UNUSED pc = abuf->addr; 1426 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1427 1.1 christos 1428 1.1 christos lm32bf_wcsr_insn (current_cpu, FLD (f_csr), CPU (h_gr[FLD (f_r1)])); 1429 1.1 christos 1430 1.1 christos return vpc; 1431 1.1 christos #undef FLD 1432 1.1 christos } 1433 1.1 christos 1434 1.1 christos /* xor: xor $r2,$r0,$r1 */ 1435 1.1 christos 1436 1.1 christos static SEM_PC 1437 1.1 christos SEM_FN_NAME (lm32bf,xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1438 1.1 christos { 1439 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 1440 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1441 1.1 christos int UNUSED written = 0; 1442 1.1 christos IADDR UNUSED pc = abuf->addr; 1443 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1444 1.1 christos 1445 1.1 christos { 1446 1.1 christos SI opval = XORSI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)])); 1447 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 1448 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1449 1.1 christos } 1450 1.1 christos 1451 1.1 christos return vpc; 1452 1.1 christos #undef FLD 1453 1.1 christos } 1454 1.1 christos 1455 1.1 christos /* xori: xori $r1,$r0,$uimm */ 1456 1.1 christos 1457 1.1 christos static SEM_PC 1458 1.1 christos SEM_FN_NAME (lm32bf,xori) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1459 1.1 christos { 1460 1.1 christos #define FLD(f) abuf->fields.sfmt_andi.f 1461 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1462 1.1 christos int UNUSED written = 0; 1463 1.1 christos IADDR UNUSED pc = abuf->addr; 1464 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1465 1.1 christos 1466 1.1 christos { 1467 1.1 christos SI opval = XORSI (CPU (h_gr[FLD (f_r0)]), ZEXTSISI (FLD (f_uimm))); 1468 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 1469 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1470 1.1 christos } 1471 1.1 christos 1472 1.1 christos return vpc; 1473 1.1 christos #undef FLD 1474 1.1 christos } 1475 1.1 christos 1476 1.1 christos /* xnor: xnor $r2,$r0,$r1 */ 1477 1.1 christos 1478 1.1 christos static SEM_PC 1479 1.1 christos SEM_FN_NAME (lm32bf,xnor) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1480 1.1 christos { 1481 1.1 christos #define FLD(f) abuf->fields.sfmt_user.f 1482 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1483 1.1 christos int UNUSED written = 0; 1484 1.1 christos IADDR UNUSED pc = abuf->addr; 1485 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1486 1.1 christos 1487 1.1 christos { 1488 1.1 christos SI opval = INVSI (XORSI (CPU (h_gr[FLD (f_r0)]), CPU (h_gr[FLD (f_r1)]))); 1489 1.1 christos CPU (h_gr[FLD (f_r2)]) = opval; 1490 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1491 1.1 christos } 1492 1.1 christos 1493 1.1 christos return vpc; 1494 1.1 christos #undef FLD 1495 1.1 christos } 1496 1.1 christos 1497 1.1 christos /* xnori: xnori $r1,$r0,$uimm */ 1498 1.1 christos 1499 1.1 christos static SEM_PC 1500 1.1 christos SEM_FN_NAME (lm32bf,xnori) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1501 1.1 christos { 1502 1.1 christos #define FLD(f) abuf->fields.sfmt_andi.f 1503 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1504 1.1 christos int UNUSED written = 0; 1505 1.1 christos IADDR UNUSED pc = abuf->addr; 1506 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1507 1.1 christos 1508 1.1 christos { 1509 1.1 christos SI opval = INVSI (XORSI (CPU (h_gr[FLD (f_r0)]), ZEXTSISI (FLD (f_uimm)))); 1510 1.1 christos CPU (h_gr[FLD (f_r1)]) = opval; 1511 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); 1512 1.1 christos } 1513 1.1 christos 1514 1.1 christos return vpc; 1515 1.1 christos #undef FLD 1516 1.1 christos } 1517 1.1 christos 1518 1.1 christos /* break: break */ 1519 1.1 christos 1520 1.1 christos static SEM_PC 1521 1.1 christos SEM_FN_NAME (lm32bf,break) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1522 1.1 christos { 1523 1.1 christos #define FLD(f) abuf->fields.sfmt_empty.f 1524 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1525 1.1 christos int UNUSED written = 0; 1526 1.1 christos IADDR UNUSED pc = abuf->addr; 1527 1.1 christos SEM_BRANCH_INIT 1528 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1529 1.1 christos 1530 1.1 christos { 1531 1.1 christos USI opval = lm32bf_break_insn (current_cpu, pc); 1532 1.1 christos SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); 1533 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval); 1534 1.1 christos } 1535 1.1 christos 1536 1.1 christos SEM_BRANCH_FINI (vpc); 1537 1.1 christos return vpc; 1538 1.1 christos #undef FLD 1539 1.1 christos } 1540 1.1 christos 1541 1.1 christos /* scall: scall */ 1542 1.1 christos 1543 1.1 christos static SEM_PC 1544 1.1 christos SEM_FN_NAME (lm32bf,scall) (SIM_CPU *current_cpu, SEM_ARG sem_arg) 1545 1.1 christos { 1546 1.1 christos #define FLD(f) abuf->fields.sfmt_empty.f 1547 1.1 christos ARGBUF *abuf = SEM_ARGBUF (sem_arg); 1548 1.1 christos int UNUSED written = 0; 1549 1.1 christos IADDR UNUSED pc = abuf->addr; 1550 1.1 christos SEM_BRANCH_INIT 1551 1.1 christos SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); 1552 1.1 christos 1553 1.1 christos { 1554 1.1 christos USI opval = lm32bf_scall_insn (current_cpu, pc); 1555 1.1 christos SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc); 1556 1.5 christos CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval); 1557 1.1 christos } 1558 1.1 christos 1559 1.1 christos SEM_BRANCH_FINI (vpc); 1560 1.1 christos return vpc; 1561 1.1 christos #undef FLD 1562 1.1 christos } 1563 1.1 christos 1564 1.1 christos /* Table of all semantic fns. */ 1565 1.1 christos 1566 1.1 christos static const struct sem_fn_desc sem_fns[] = { 1567 1.1 christos { LM32BF_INSN_X_INVALID, SEM_FN_NAME (lm32bf,x_invalid) }, 1568 1.1 christos { LM32BF_INSN_X_AFTER, SEM_FN_NAME (lm32bf,x_after) }, 1569 1.1 christos { LM32BF_INSN_X_BEFORE, SEM_FN_NAME (lm32bf,x_before) }, 1570 1.1 christos { LM32BF_INSN_X_CTI_CHAIN, SEM_FN_NAME (lm32bf,x_cti_chain) }, 1571 1.1 christos { LM32BF_INSN_X_CHAIN, SEM_FN_NAME (lm32bf,x_chain) }, 1572 1.1 christos { LM32BF_INSN_X_BEGIN, SEM_FN_NAME (lm32bf,x_begin) }, 1573 1.1 christos { LM32BF_INSN_ADD, SEM_FN_NAME (lm32bf,add) }, 1574 1.1 christos { LM32BF_INSN_ADDI, SEM_FN_NAME (lm32bf,addi) }, 1575 1.1 christos { LM32BF_INSN_AND, SEM_FN_NAME (lm32bf,and) }, 1576 1.1 christos { LM32BF_INSN_ANDI, SEM_FN_NAME (lm32bf,andi) }, 1577 1.1 christos { LM32BF_INSN_ANDHII, SEM_FN_NAME (lm32bf,andhii) }, 1578 1.1 christos { LM32BF_INSN_B, SEM_FN_NAME (lm32bf,b) }, 1579 1.1 christos { LM32BF_INSN_BI, SEM_FN_NAME (lm32bf,bi) }, 1580 1.1 christos { LM32BF_INSN_BE, SEM_FN_NAME (lm32bf,be) }, 1581 1.1 christos { LM32BF_INSN_BG, SEM_FN_NAME (lm32bf,bg) }, 1582 1.1 christos { LM32BF_INSN_BGE, SEM_FN_NAME (lm32bf,bge) }, 1583 1.1 christos { LM32BF_INSN_BGEU, SEM_FN_NAME (lm32bf,bgeu) }, 1584 1.1 christos { LM32BF_INSN_BGU, SEM_FN_NAME (lm32bf,bgu) }, 1585 1.1 christos { LM32BF_INSN_BNE, SEM_FN_NAME (lm32bf,bne) }, 1586 1.1 christos { LM32BF_INSN_CALL, SEM_FN_NAME (lm32bf,call) }, 1587 1.1 christos { LM32BF_INSN_CALLI, SEM_FN_NAME (lm32bf,calli) }, 1588 1.1 christos { LM32BF_INSN_CMPE, SEM_FN_NAME (lm32bf,cmpe) }, 1589 1.1 christos { LM32BF_INSN_CMPEI, SEM_FN_NAME (lm32bf,cmpei) }, 1590 1.1 christos { LM32BF_INSN_CMPG, SEM_FN_NAME (lm32bf,cmpg) }, 1591 1.1 christos { LM32BF_INSN_CMPGI, SEM_FN_NAME (lm32bf,cmpgi) }, 1592 1.1 christos { LM32BF_INSN_CMPGE, SEM_FN_NAME (lm32bf,cmpge) }, 1593 1.1 christos { LM32BF_INSN_CMPGEI, SEM_FN_NAME (lm32bf,cmpgei) }, 1594 1.1 christos { LM32BF_INSN_CMPGEU, SEM_FN_NAME (lm32bf,cmpgeu) }, 1595 1.1 christos { LM32BF_INSN_CMPGEUI, SEM_FN_NAME (lm32bf,cmpgeui) }, 1596 1.1 christos { LM32BF_INSN_CMPGU, SEM_FN_NAME (lm32bf,cmpgu) }, 1597 1.1 christos { LM32BF_INSN_CMPGUI, SEM_FN_NAME (lm32bf,cmpgui) }, 1598 1.1 christos { LM32BF_INSN_CMPNE, SEM_FN_NAME (lm32bf,cmpne) }, 1599 1.1 christos { LM32BF_INSN_CMPNEI, SEM_FN_NAME (lm32bf,cmpnei) }, 1600 1.1 christos { LM32BF_INSN_DIVU, SEM_FN_NAME (lm32bf,divu) }, 1601 1.1 christos { LM32BF_INSN_LB, SEM_FN_NAME (lm32bf,lb) }, 1602 1.1 christos { LM32BF_INSN_LBU, SEM_FN_NAME (lm32bf,lbu) }, 1603 1.1 christos { LM32BF_INSN_LH, SEM_FN_NAME (lm32bf,lh) }, 1604 1.1 christos { LM32BF_INSN_LHU, SEM_FN_NAME (lm32bf,lhu) }, 1605 1.1 christos { LM32BF_INSN_LW, SEM_FN_NAME (lm32bf,lw) }, 1606 1.1 christos { LM32BF_INSN_MODU, SEM_FN_NAME (lm32bf,modu) }, 1607 1.1 christos { LM32BF_INSN_MUL, SEM_FN_NAME (lm32bf,mul) }, 1608 1.1 christos { LM32BF_INSN_MULI, SEM_FN_NAME (lm32bf,muli) }, 1609 1.1 christos { LM32BF_INSN_NOR, SEM_FN_NAME (lm32bf,nor) }, 1610 1.1 christos { LM32BF_INSN_NORI, SEM_FN_NAME (lm32bf,nori) }, 1611 1.1 christos { LM32BF_INSN_OR, SEM_FN_NAME (lm32bf,or) }, 1612 1.1 christos { LM32BF_INSN_ORI, SEM_FN_NAME (lm32bf,ori) }, 1613 1.1 christos { LM32BF_INSN_ORHII, SEM_FN_NAME (lm32bf,orhii) }, 1614 1.1 christos { LM32BF_INSN_RCSR, SEM_FN_NAME (lm32bf,rcsr) }, 1615 1.1 christos { LM32BF_INSN_SB, SEM_FN_NAME (lm32bf,sb) }, 1616 1.1 christos { LM32BF_INSN_SEXTB, SEM_FN_NAME (lm32bf,sextb) }, 1617 1.1 christos { LM32BF_INSN_SEXTH, SEM_FN_NAME (lm32bf,sexth) }, 1618 1.1 christos { LM32BF_INSN_SH, SEM_FN_NAME (lm32bf,sh) }, 1619 1.1 christos { LM32BF_INSN_SL, SEM_FN_NAME (lm32bf,sl) }, 1620 1.1 christos { LM32BF_INSN_SLI, SEM_FN_NAME (lm32bf,sli) }, 1621 1.1 christos { LM32BF_INSN_SR, SEM_FN_NAME (lm32bf,sr) }, 1622 1.1 christos { LM32BF_INSN_SRI, SEM_FN_NAME (lm32bf,sri) }, 1623 1.1 christos { LM32BF_INSN_SRU, SEM_FN_NAME (lm32bf,sru) }, 1624 1.1 christos { LM32BF_INSN_SRUI, SEM_FN_NAME (lm32bf,srui) }, 1625 1.1 christos { LM32BF_INSN_SUB, SEM_FN_NAME (lm32bf,sub) }, 1626 1.1 christos { LM32BF_INSN_SW, SEM_FN_NAME (lm32bf,sw) }, 1627 1.1 christos { LM32BF_INSN_USER, SEM_FN_NAME (lm32bf,user) }, 1628 1.1 christos { LM32BF_INSN_WCSR, SEM_FN_NAME (lm32bf,wcsr) }, 1629 1.1 christos { LM32BF_INSN_XOR, SEM_FN_NAME (lm32bf,xor) }, 1630 1.1 christos { LM32BF_INSN_XORI, SEM_FN_NAME (lm32bf,xori) }, 1631 1.1 christos { LM32BF_INSN_XNOR, SEM_FN_NAME (lm32bf,xnor) }, 1632 1.1 christos { LM32BF_INSN_XNORI, SEM_FN_NAME (lm32bf,xnori) }, 1633 1.1 christos { LM32BF_INSN_BREAK, SEM_FN_NAME (lm32bf,break) }, 1634 1.1 christos { LM32BF_INSN_SCALL, SEM_FN_NAME (lm32bf,scall) }, 1635 1.1 christos { 0, 0 } 1636 1.1 christos }; 1637 1.1 christos 1638 1.1 christos /* Add the semantic fns to IDESC_TABLE. */ 1639 1.1 christos 1640 1.1 christos void 1641 1.1 christos SEM_FN_NAME (lm32bf,init_idesc_table) (SIM_CPU *current_cpu) 1642 1.1 christos { 1643 1.1 christos IDESC *idesc_table = CPU_IDESC (current_cpu); 1644 1.1 christos const struct sem_fn_desc *sf; 1645 1.1 christos int mach_num = MACH_NUM (CPU_MACH (current_cpu)); 1646 1.1 christos 1647 1.1 christos for (sf = &sem_fns[0]; sf->fn != 0; ++sf) 1648 1.1 christos { 1649 1.1 christos const CGEN_INSN *insn = idesc_table[sf->index].idata; 1650 1.1 christos int valid_p = (CGEN_INSN_VIRTUAL_P (insn) 1651 1.1 christos || CGEN_INSN_MACH_HAS_P (insn, mach_num)); 1652 1.1 christos #if FAST_P 1653 1.1 christos if (valid_p) 1654 1.1 christos idesc_table[sf->index].sem_fast = sf->fn; 1655 1.1 christos else 1656 1.1 christos idesc_table[sf->index].sem_fast = SEM_FN_NAME (lm32bf,x_invalid); 1657 1.1 christos #else 1658 1.1 christos if (valid_p) 1659 1.1 christos idesc_table[sf->index].sem_full = sf->fn; 1660 1.1 christos else 1661 1.1 christos idesc_table[sf->index].sem_full = SEM_FN_NAME (lm32bf,x_invalid); 1662 1.1 christos #endif 1663 1.1 christos } 1664 1.1 christos } 1665 1.1 christos 1666