diff options
author | Doug Evans <dje@google.com> | 1998-02-05 21:01:06 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 1998-02-05 21:01:06 +0000 |
commit | b8a9943dd4f35984507734e2ad21ad60e4f42d4e (patch) | |
tree | 6452099c47e76691f105259bc6149a2e99886110 /sim/m32r/sem.c | |
parent | 5bd5a5c7a2647a21aa0662e56c323ac5f76bdbcd (diff) | |
download | gdb-b8a9943dd4f35984507734e2ad21ad60e4f42d4e.zip gdb-b8a9943dd4f35984507734e2ad21ad60e4f42d4e.tar.gz gdb-b8a9943dd4f35984507734e2ad21ad60e4f42d4e.tar.bz2 |
* Makefile.in (m32r.o): Depend on cpu.h
(extract.o): Pass -DSCACHE_P.
* mloop.in (extract{16,32}): Update call to m32r_decode.
* arch.h,cpu.h,cpuall.h,decode.[ch]: Regenerate.
* extract.c,model.c,sem-switch.c,sem.c: Regenerate.
* sim-main.h: #include "ansidecl.h".
Don't include cpu-opc.h, done by arch.h.
start-sanitize-m32rx
* Makefile.in (M32RX_OBJS): Build m32rx support now.
(m32rx.o): New rule.
* m32r-sim.h (m32rx_h_cr_[gs]et): Define.
* m32rx.c (m32rx_{fetch,store}_register): Update {get,set} of PC.
(m32rx_h_accums_get): New function.
* mloopx.in: Update call to m32rx_decode. Rewrite exec loop.
* cpux.h,decodex.[ch],modelx.c,readx.c,semx.c: Regenerate.
end-sanitize-m32rx
Diffstat (limited to 'sim/m32r/sem.c')
-rw-r--r-- | sim/m32r/sem.c | 580 |
1 files changed, 441 insertions, 139 deletions
diff --git a/sim/m32r/sem.c b/sim/m32r/sem.c index 1bee915..3e5d4db 100644 --- a/sim/m32r/sem.c +++ b/sim/m32r/sem.c @@ -1,5 +1,7 @@ /* Simulator instruction semantics for m32r. +This file is machine generated with CGEN. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU Simulators. @@ -40,37 +42,43 @@ SEM_FN_NAME (m32r,add) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_0_add.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = ADDSI (* FLD (f_r1), * FLD (f_r2)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } -/* Perform add3: add3 $dr,$sr,$slo16. */ +/* Perform add3: add3 $dr,$sr,#$slo16. */ CIA SEM_FN_NAME (m32r,add3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { #define FLD(f) abuf->fields.fmt_1_add3.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = ADDSI (* FLD (f_r2), FLD (f_simm16)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -82,37 +90,43 @@ SEM_FN_NAME (m32r,and) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_0_add.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = ANDSI (* FLD (f_r1), * FLD (f_r2)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } -/* Perform and3: and3 $dr,$sr,$uimm16. */ +/* Perform and3: and3 $dr,$sr,#$uimm16. */ CIA SEM_FN_NAME (m32r,and3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { #define FLD(f) abuf->fields.fmt_2_and3.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = ANDSI (* FLD (f_r2), FLD (f_uimm16)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -124,37 +138,43 @@ SEM_FN_NAME (m32r,or) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_0_add.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = ORSI (* FLD (f_r1), * FLD (f_r2)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } -/* Perform or3: or3 $dr,$sr,$ulo16. */ +/* Perform or3: or3 $dr,$sr,#$ulo16. */ CIA SEM_FN_NAME (m32r,or3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { #define FLD(f) abuf->fields.fmt_3_or3.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = ORSI (* FLD (f_r2), FLD (f_uimm16)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -166,58 +186,67 @@ SEM_FN_NAME (m32r,xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_0_add.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = XORSI (* FLD (f_r1), * FLD (f_r2)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } -/* Perform xor3: xor3 $dr,$sr,$uimm16. */ +/* Perform xor3: xor3 $dr,$sr,#$uimm16. */ CIA SEM_FN_NAME (m32r,xor3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { #define FLD(f) abuf->fields.fmt_2_and3.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = XORSI (* FLD (f_r2), FLD (f_uimm16)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } -/* Perform addi: addi $dr,$simm8. */ +/* Perform addi: addi $dr,#$simm8. */ CIA SEM_FN_NAME (m32r,addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { #define FLD(f) abuf->fields.fmt_4_addi.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = ADDSI (* FLD (f_r1), FLD (f_simm8)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -229,6 +258,7 @@ SEM_FN_NAME (m32r,addv) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_0_add.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + do { BI temp1;SI temp0; temp0 = ADDSI (* FLD (f_r1), * FLD (f_r2)); @@ -238,25 +268,28 @@ do { CPU (h_cond) = temp1; TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); } while (0); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } -/* Perform addv3: addv3 $dr,$sr,$simm16. */ +/* Perform addv3: addv3 $dr,$sr,#$simm16. */ CIA SEM_FN_NAME (m32r,addv3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { #define FLD(f) abuf->fields.fmt_5_addv3.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + do { BI temp1;SI temp0; temp0 = ADDSI (* FLD (f_r2), FLD (f_simm16)); @@ -266,14 +299,16 @@ do { CPU (h_cond) = temp1; TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); } while (0); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -285,6 +320,7 @@ SEM_FN_NAME (m32r,addx) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_6_addx.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + do { BI temp1;SI temp0; temp0 = ADDCSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond)); @@ -294,14 +330,16 @@ do { CPU (h_cond) = temp1; TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); } while (0); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -314,16 +352,19 @@ SEM_FN_NAME (m32r,bc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg) ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); int taken_p = 0; + if (CPU (h_cond)) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp8))); taken_p = 1; } + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { - model_profile_cti_insn (current_cpu, abuf, taken_p); + m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); } #endif + return new_pc; #undef FLD } @@ -336,16 +377,19 @@ SEM_FN_NAME (m32r,bc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg) ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); int taken_p = 0; + if (CPU (h_cond)) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp24))); taken_p = 1; } + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { - model_profile_cti_insn (current_cpu, abuf, taken_p); + m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); } #endif + return new_pc; #undef FLD } @@ -358,17 +402,20 @@ SEM_FN_NAME (m32r,beq) (SIM_CPU *current_cpu, SEM_ARG sem_arg) ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); int taken_p = 0; + if (EQSI (* FLD (f_r1), * FLD (f_r2))) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); taken_p = 1; } + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_cti_insn (current_cpu, abuf, taken_p); + m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); } #endif + return new_pc; #undef FLD } @@ -381,17 +428,20 @@ SEM_FN_NAME (m32r,beqz) (SIM_CPU *current_cpu, SEM_ARG sem_arg) ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); int taken_p = 0; + if (EQSI (* FLD (f_r2), 0)) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); taken_p = 1; } + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_cti_insn (current_cpu, abuf, taken_p); + m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); } #endif + return new_pc; #undef FLD } @@ -404,17 +454,20 @@ SEM_FN_NAME (m32r,bgez) (SIM_CPU *current_cpu, SEM_ARG sem_arg) ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); int taken_p = 0; + if (GESI (* FLD (f_r2), 0)) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); taken_p = 1; } + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_cti_insn (current_cpu, abuf, taken_p); + m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); } #endif + return new_pc; #undef FLD } @@ -427,17 +480,20 @@ SEM_FN_NAME (m32r,bgtz) (SIM_CPU *current_cpu, SEM_ARG sem_arg) ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); int taken_p = 0; + if (GTSI (* FLD (f_r2), 0)) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); taken_p = 1; } + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_cti_insn (current_cpu, abuf, taken_p); + m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); } #endif + return new_pc; #undef FLD } @@ -450,17 +506,20 @@ SEM_FN_NAME (m32r,blez) (SIM_CPU *current_cpu, SEM_ARG sem_arg) ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); int taken_p = 0; + if (LESI (* FLD (f_r2), 0)) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); taken_p = 1; } + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_cti_insn (current_cpu, abuf, taken_p); + m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); } #endif + return new_pc; #undef FLD } @@ -473,17 +532,20 @@ SEM_FN_NAME (m32r,bltz) (SIM_CPU *current_cpu, SEM_ARG sem_arg) ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); int taken_p = 0; + if (LTSI (* FLD (f_r2), 0)) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); taken_p = 1; } + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_cti_insn (current_cpu, abuf, taken_p); + m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); } #endif + return new_pc; #undef FLD } @@ -496,17 +558,20 @@ SEM_FN_NAME (m32r,bnez) (SIM_CPU *current_cpu, SEM_ARG sem_arg) ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); int taken_p = 0; + if (NESI (* FLD (f_r2), 0)) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); taken_p = 1; } + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_cti_insn (current_cpu, abuf, taken_p); + m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); } #endif + return new_pc; #undef FLD } @@ -519,18 +584,22 @@ SEM_FN_NAME (m32r,bl8) (SIM_CPU *current_cpu, SEM_ARG sem_arg) ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); int taken_p = 0; + do { CPU (h_gr[14]) = ADDSI (ANDSI (CPU (h_pc), -4), 4); - TRACE_RESULT (current_cpu, "h-gr", 'x', CPU (h_gr[14])); + TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14])); BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp8))); taken_p = 1; } while (0); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { - model_profile_cti_insn (current_cpu, abuf, taken_p); + m32r_model_mark_set_h_gr (current_cpu, abuf); + m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); } #endif + return new_pc; #undef FLD } @@ -543,18 +612,22 @@ SEM_FN_NAME (m32r,bl24) (SIM_CPU *current_cpu, SEM_ARG sem_arg) ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); int taken_p = 0; + do { CPU (h_gr[14]) = ADDSI (CPU (h_pc), 4); - TRACE_RESULT (current_cpu, "h-gr", 'x', CPU (h_gr[14])); + TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14])); BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp24))); taken_p = 1; } while (0); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { - model_profile_cti_insn (current_cpu, abuf, taken_p); + m32r_model_mark_set_h_gr (current_cpu, abuf); + m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); } #endif + return new_pc; #undef FLD } @@ -567,16 +640,19 @@ SEM_FN_NAME (m32r,bnc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg) ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); int taken_p = 0; + if (NOTBI (CPU (h_cond))) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp8))); taken_p = 1; } + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { - model_profile_cti_insn (current_cpu, abuf, taken_p); + m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); } #endif + return new_pc; #undef FLD } @@ -589,16 +665,19 @@ SEM_FN_NAME (m32r,bnc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg) ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); int taken_p = 0; + if (NOTBI (CPU (h_cond))) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp24))); taken_p = 1; } + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { - model_profile_cti_insn (current_cpu, abuf, taken_p); + m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); } #endif + return new_pc; #undef FLD } @@ -611,17 +690,20 @@ SEM_FN_NAME (m32r,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg) ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); int taken_p = 0; + if (NESI (* FLD (f_r1), * FLD (f_r2))) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); taken_p = 1; } + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_cti_insn (current_cpu, abuf, taken_p); + m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); } #endif + return new_pc; #undef FLD } @@ -634,14 +716,17 @@ SEM_FN_NAME (m32r,bra8) (SIM_CPU *current_cpu, SEM_ARG sem_arg) ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); int taken_p = 0; + BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp8))); taken_p = 1; + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { - model_profile_cti_insn (current_cpu, abuf, taken_p); + m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); } #endif + return new_pc; #undef FLD } @@ -654,14 +739,17 @@ SEM_FN_NAME (m32r,bra24) (SIM_CPU *current_cpu, SEM_ARG sem_arg) ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); int taken_p = 0; + BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp24))); taken_p = 1; + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { - model_profile_cti_insn (current_cpu, abuf, taken_p); + m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); } #endif + return new_pc; #undef FLD } @@ -673,35 +761,41 @@ SEM_FN_NAME (m32r,cmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_15_cmp.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + CPU (h_cond) = LTSI (* FLD (f_r1), * FLD (f_r2)); TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } -/* Perform cmpi: cmpi $src2,$simm16. */ +/* Perform cmpi: cmpi $src2,#$simm16. */ CIA SEM_FN_NAME (m32r,cmpi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { #define FLD(f) abuf->fields.fmt_16_cmpi.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + CPU (h_cond) = LTSI (* FLD (f_r2), FLD (f_simm16)); TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -713,35 +807,41 @@ SEM_FN_NAME (m32r,cmpu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_15_cmp.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + CPU (h_cond) = LTUSI (* FLD (f_r1), * FLD (f_r2)); TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } -/* Perform cmpui: cmpui $src2,$uimm16. */ +/* Perform cmpui: cmpui $src2,#$uimm16. */ CIA SEM_FN_NAME (m32r,cmpui) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { #define FLD(f) abuf->fields.fmt_17_cmpui.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + CPU (h_cond) = LTUSI (* FLD (f_r2), FLD (f_uimm16)); TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -753,18 +853,21 @@ SEM_FN_NAME (m32r,div) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_18_div.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + if (NESI (* FLD (f_r2), 0)) { * FLD (f_r1) = DIVSI (* FLD (f_r1), * FLD (f_r2)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); } + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -776,18 +879,21 @@ SEM_FN_NAME (m32r,divu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_18_div.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + if (NESI (* FLD (f_r2), 0)) { * FLD (f_r1) = UDIVSI (* FLD (f_r1), * FLD (f_r2)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); } + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -799,18 +905,21 @@ SEM_FN_NAME (m32r,rem) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_18_div.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + if (NESI (* FLD (f_r2), 0)) { * FLD (f_r1) = MODSI (* FLD (f_r1), * FLD (f_r2)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); } + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -822,18 +931,21 @@ SEM_FN_NAME (m32r,remu) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_18_div.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + if (NESI (* FLD (f_r2), 0)) { * FLD (f_r1) = UMODSI (* FLD (f_r1), * FLD (f_r2)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); } + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -846,22 +958,26 @@ SEM_FN_NAME (m32r,jl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); int taken_p = 0; + do { USI temp1;SI temp0; temp0 = ADDSI (ANDSI (CPU (h_pc), -4), 4); temp1 = * FLD (f_r2); CPU (h_gr[14]) = temp0; - TRACE_RESULT (current_cpu, "h-gr", 'x', CPU (h_gr[14])); + TRACE_RESULT (current_cpu, "h-gr-14", 'x', CPU (h_gr[14])); BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, temp1)); taken_p = 1; } while (0); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_cti_insn (current_cpu, abuf, taken_p); + m32r_model_mark_set_h_gr (current_cpu, abuf); + m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); } #endif + return new_pc; #undef FLD } @@ -874,15 +990,18 @@ SEM_FN_NAME (m32r,jmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg) ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); int taken_p = 0; + BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, * FLD (f_r2))); taken_p = 1; + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_cti_insn (current_cpu, abuf, taken_p); + m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); } #endif + return new_pc; #undef FLD } @@ -894,16 +1013,19 @@ SEM_FN_NAME (m32r,ld) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_21_ld.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = GETMEMSI (current_cpu, * FLD (f_r2)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -915,16 +1037,19 @@ SEM_FN_NAME (m32r,ld_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_22_ld_d.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = GETMEMSI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -936,16 +1061,19 @@ SEM_FN_NAME (m32r,ldb) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_23_ldb.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = EXTQISI (GETMEMQI (current_cpu, * FLD (f_r2))); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -957,16 +1085,19 @@ SEM_FN_NAME (m32r,ldb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_24_ldb_d.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = EXTQISI (GETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -978,16 +1109,19 @@ SEM_FN_NAME (m32r,ldh) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_25_ldh.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = EXTHISI (GETMEMHI (current_cpu, * FLD (f_r2))); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -999,16 +1133,19 @@ SEM_FN_NAME (m32r,ldh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_26_ldh_d.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = EXTHISI (GETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1020,16 +1157,19 @@ SEM_FN_NAME (m32r,ldub) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_23_ldb.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = ZEXTQISI (GETMEMQI (current_cpu, * FLD (f_r2))); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1041,16 +1181,19 @@ SEM_FN_NAME (m32r,ldub_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_24_ldb_d.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = ZEXTQISI (GETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1062,16 +1205,19 @@ SEM_FN_NAME (m32r,lduh) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_25_ldh.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = ZEXTHISI (GETMEMHI (current_cpu, * FLD (f_r2))); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1083,16 +1229,19 @@ SEM_FN_NAME (m32r,lduh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_26_ldh_d.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = ZEXTHISI (GETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1104,6 +1253,7 @@ SEM_FN_NAME (m32r,ld_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_21_ld.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + do { SI temp1;SI temp0; temp0 = GETMEMSI (current_cpu, * FLD (f_r2)); @@ -1113,54 +1263,62 @@ do { * FLD (f_r2) = temp1; TRACE_RESULT (current_cpu, "sr", 'x', * FLD (f_r2)); } while (0); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } -/* Perform ld24: ld24 $dr,$uimm24. */ +/* Perform ld24: ld24 $dr,#$uimm24. */ CIA SEM_FN_NAME (m32r,ld24) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { #define FLD(f) abuf->fields.fmt_27_ld24.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = FLD (f_uimm24); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } -/* Perform ldi8: ldi $dr,$simm8. */ +/* Perform ldi8: ldi $dr,#$simm8. */ CIA SEM_FN_NAME (m32r,ldi8) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { #define FLD(f) abuf->fields.fmt_28_ldi8.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = FLD (f_simm8); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1172,15 +1330,18 @@ SEM_FN_NAME (m32r,ldi16) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_29_ldi16.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = FLD (f_simm16); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1192,15 +1353,18 @@ SEM_FN_NAME (m32r,lock) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_0_add.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + do_lock (current_cpu, * FLD (f_r1), * FLD (f_r2)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1212,15 +1376,18 @@ SEM_FN_NAME (m32r,machi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_30_machi.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + CPU (h_accum) = SRADI (SLLDI (ADDDI (CPU (h_accum), MULDI (EXTSIDI (ANDSI (* FLD (f_r1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16))))), 8), 8); TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1232,15 +1399,18 @@ SEM_FN_NAME (m32r,maclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_30_machi.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + CPU (h_accum) = SRADI (SLLDI (ADDDI (CPU (h_accum), MULDI (EXTSIDI (SLLSI (* FLD (f_r1), 16)), EXTHIDI (TRUNCSIHI (* FLD (f_r2))))), 8), 8); TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1252,15 +1422,18 @@ SEM_FN_NAME (m32r,macwhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_30_machi.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + CPU (h_accum) = SRADI (SLLDI (ADDDI (CPU (h_accum), MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16))))), 8), 8); TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1272,15 +1445,18 @@ SEM_FN_NAME (m32r,macwlo) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_30_machi.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + CPU (h_accum) = SRADI (SLLDI (ADDDI (CPU (h_accum), MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (* FLD (f_r2))))), 8), 8); TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1292,16 +1468,19 @@ SEM_FN_NAME (m32r,mul) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_0_add.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = MULSI (* FLD (f_r1), * FLD (f_r2)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1313,15 +1492,18 @@ SEM_FN_NAME (m32r,mulhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_15_cmp.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + CPU (h_accum) = SRADI (SLLDI (MULDI (EXTSIDI (ANDSI (* FLD (f_r1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16)))), 16), 16); TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1333,15 +1515,18 @@ SEM_FN_NAME (m32r,mullo) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_15_cmp.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + CPU (h_accum) = SRADI (SLLDI (MULDI (EXTSIDI (SLLSI (* FLD (f_r1), 16)), EXTHIDI (TRUNCSIHI (* FLD (f_r2)))), 16), 16); TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1353,15 +1538,18 @@ SEM_FN_NAME (m32r,mulwhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_15_cmp.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + CPU (h_accum) = SRADI (SLLDI (MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16)))), 8), 8); TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1373,15 +1561,18 @@ SEM_FN_NAME (m32r,mulwlo) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_15_cmp.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + CPU (h_accum) = SRADI (SLLDI (MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (* FLD (f_r2)))), 8), 8); TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1393,16 +1584,19 @@ SEM_FN_NAME (m32r,mv) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_31_mv.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = * FLD (f_r2); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1414,15 +1608,18 @@ SEM_FN_NAME (m32r,mvfachi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_32_mvfachi.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = TRUNCDISI (SRADI (CPU (h_accum), 32)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1434,15 +1631,18 @@ SEM_FN_NAME (m32r,mvfaclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_32_mvfachi.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = TRUNCDISI (CPU (h_accum)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1454,15 +1654,18 @@ SEM_FN_NAME (m32r,mvfacmi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_32_mvfachi.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = TRUNCDISI (SRADI (CPU (h_accum), 16)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1474,15 +1677,18 @@ SEM_FN_NAME (m32r,mvfc) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_33_mvfc.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = m32r_h_cr_get (current_cpu, FLD (f_r2)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1494,15 +1700,18 @@ SEM_FN_NAME (m32r,mvtachi) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_34_mvtachi.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + CPU (h_accum) = ORDI (ANDDI (CPU (h_accum), MAKEDI (0, 0xffffffff)), SLLDI (EXTSIDI (* FLD (f_r1)), 32)); TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1514,15 +1723,18 @@ SEM_FN_NAME (m32r,mvtaclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_34_mvtachi.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + CPU (h_accum) = ORDI (ANDDI (CPU (h_accum), MAKEDI (0xffffffff, 0)), EXTSIDI (* FLD (f_r1))); TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1534,15 +1746,18 @@ SEM_FN_NAME (m32r,mvtc) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_35_mvtc.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + m32r_h_cr_set (current_cpu, FLD (f_r1), * FLD (f_r2)); TRACE_RESULT (current_cpu, "dcr", 'x', m32r_h_cr_get (current_cpu, FLD (f_r1))); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1554,16 +1769,19 @@ SEM_FN_NAME (m32r,neg) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_31_mv.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = NEGSI (* FLD (f_r2)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1575,13 +1793,16 @@ SEM_FN_NAME (m32r,nop) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_36_nop.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + PROFILE_COUNT_FILLNOPS (current_cpu, abuf->addr); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1593,16 +1814,19 @@ SEM_FN_NAME (m32r,not) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_31_mv.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = INVSI (* FLD (f_r2)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1614,6 +1838,7 @@ SEM_FN_NAME (m32r,rac) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_37_rac.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + do { DI tmp_tmp1; tmp_tmp1 = ANDDI (CPU (h_accum), MAKEDI (16777215, 0xffffffff)); @@ -1630,12 +1855,14 @@ if (ANDIFSI (GEDI (tmp_tmp1, MAKEDI (8388608, 0)), LEDI (tmp_tmp1, MAKEDI (16760 CPU (h_accum) = SRADI (SLLDI (tmp_tmp1, 7), 7); TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum)); } while (0); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1647,6 +1874,7 @@ SEM_FN_NAME (m32r,rach) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_37_rac.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + do { DI tmp_tmp1; tmp_tmp1 = ANDDI (CPU (h_accum), MAKEDI (16777215, 0xffffffff)); @@ -1663,12 +1891,14 @@ if (ANDIFSI (GEDI (tmp_tmp1, MAKEDI (8388608, 0)), LEDI (tmp_tmp1, MAKEDI (16760 CPU (h_accum) = SRADI (SLLDI (tmp_tmp1, 7), 7); TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum)); } while (0); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1677,47 +1907,53 @@ if (ANDIFSI (GEDI (tmp_tmp1, MAKEDI (8388608, 0)), LEDI (tmp_tmp1, MAKEDI (16760 CIA SEM_FN_NAME (m32r,rte) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { -#define FLD(f) abuf->fields.fmt_36_nop.f +#define FLD(f) abuf->fields.fmt_38_rte.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); int taken_p = 0; + do { CPU (h_sm) = CPU (h_bsm); - TRACE_RESULT (current_cpu, "h-sm", 'x', CPU (h_sm)); + TRACE_RESULT (current_cpu, "h-sm-0", 'x', CPU (h_sm)); CPU (h_ie) = CPU (h_bie); - TRACE_RESULT (current_cpu, "h-ie", 'x', CPU (h_ie)); + TRACE_RESULT (current_cpu, "h-ie-0", 'x', CPU (h_ie)); CPU (h_cond) = CPU (h_bcond); TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, CPU (h_bpc))); taken_p = 1; TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); } while (0); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { - model_profile_cti_insn (current_cpu, abuf, taken_p); + m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); } #endif + return new_pc; #undef FLD } -/* Perform seth: seth $dr,$hi16. */ +/* Perform seth: seth $dr,#$hi16. */ CIA SEM_FN_NAME (m32r,seth) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { -#define FLD(f) abuf->fields.fmt_38_seth.f +#define FLD(f) abuf->fields.fmt_39_seth.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = SLLSI (FLD (f_hi16), 16); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1729,58 +1965,67 @@ SEM_FN_NAME (m32r,sll) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_0_add.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = SLLSI (* FLD (f_r1), ANDSI (* FLD (f_r2), 31)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } -/* Perform sll3: sll3 $dr,$sr,$simm16. */ +/* Perform sll3: sll3 $dr,$sr,#$simm16. */ CIA SEM_FN_NAME (m32r,sll3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { #define FLD(f) abuf->fields.fmt_5_addv3.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = SLLSI (* FLD (f_r2), ANDSI (FLD (f_simm16), 31)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } -/* Perform slli: slli $dr,$uimm5. */ +/* Perform slli: slli $dr,#$uimm5. */ CIA SEM_FN_NAME (m32r,slli) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { -#define FLD(f) abuf->fields.fmt_39_slli.f +#define FLD(f) abuf->fields.fmt_40_slli.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = SLLSI (* FLD (f_r1), FLD (f_uimm5)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1792,58 +2037,67 @@ SEM_FN_NAME (m32r,sra) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_0_add.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = SRASI (* FLD (f_r1), ANDSI (* FLD (f_r2), 31)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } -/* Perform sra3: sra3 $dr,$sr,$simm16. */ +/* Perform sra3: sra3 $dr,$sr,#$simm16. */ CIA SEM_FN_NAME (m32r,sra3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { #define FLD(f) abuf->fields.fmt_5_addv3.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = SRASI (* FLD (f_r2), ANDSI (FLD (f_simm16), 31)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } -/* Perform srai: srai $dr,$uimm5. */ +/* Perform srai: srai $dr,#$uimm5. */ CIA SEM_FN_NAME (m32r,srai) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { -#define FLD(f) abuf->fields.fmt_39_slli.f +#define FLD(f) abuf->fields.fmt_40_slli.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = SRASI (* FLD (f_r1), FLD (f_uimm5)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1855,58 +2109,67 @@ SEM_FN_NAME (m32r,srl) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_0_add.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = SRLSI (* FLD (f_r1), ANDSI (* FLD (f_r2), 31)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } -/* Perform srl3: srl3 $dr,$sr,$simm16. */ +/* Perform srl3: srl3 $dr,$sr,#$simm16. */ CIA SEM_FN_NAME (m32r,srl3) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { #define FLD(f) abuf->fields.fmt_5_addv3.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = SRLSI (* FLD (f_r2), ANDSI (FLD (f_simm16), 31)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } -/* Perform srli: srli $dr,$uimm5. */ +/* Perform srli: srli $dr,#$uimm5. */ CIA SEM_FN_NAME (m32r,srli) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { -#define FLD(f) abuf->fields.fmt_39_slli.f +#define FLD(f) abuf->fields.fmt_40_slli.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = SRLSI (* FLD (f_r1), FLD (f_uimm5)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1918,15 +2181,18 @@ SEM_FN_NAME (m32r,st) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_15_cmp.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + SETMEMSI (current_cpu, * FLD (f_r2), * FLD (f_r1)); - TRACE_RESULT (current_cpu, "h-memory", 'x', GETMEMSI (current_cpu, * FLD (f_r2))); + TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMSI (current_cpu, * FLD (f_r2))); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1935,18 +2201,21 @@ SETMEMSI (current_cpu, * FLD (f_r2), * FLD (f_r1)); CIA SEM_FN_NAME (m32r,st_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { -#define FLD(f) abuf->fields.fmt_40_st_d.f +#define FLD(f) abuf->fields.fmt_41_st_d.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + SETMEMSI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), * FLD (f_r1)); - TRACE_RESULT (current_cpu, "h-memory", 'x', GETMEMSI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); + TRACE_RESULT (current_cpu, "h-memory-add-WI-src2-slo16", 'x', GETMEMSI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1958,15 +2227,18 @@ SEM_FN_NAME (m32r,stb) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_15_cmp.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + SETMEMQI (current_cpu, * FLD (f_r2), * FLD (f_r1)); - TRACE_RESULT (current_cpu, "h-memory", 'x', GETMEMQI (current_cpu, * FLD (f_r2))); + TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMQI (current_cpu, * FLD (f_r2))); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1975,18 +2247,21 @@ SETMEMQI (current_cpu, * FLD (f_r2), * FLD (f_r1)); CIA SEM_FN_NAME (m32r,stb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { -#define FLD(f) abuf->fields.fmt_40_st_d.f +#define FLD(f) abuf->fields.fmt_41_st_d.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + SETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), * FLD (f_r1)); - TRACE_RESULT (current_cpu, "h-memory", 'x', GETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); + TRACE_RESULT (current_cpu, "h-memory-add-WI-src2-slo16", 'x', GETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -1998,15 +2273,18 @@ SEM_FN_NAME (m32r,sth) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_15_cmp.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + SETMEMHI (current_cpu, * FLD (f_r2), * FLD (f_r1)); - TRACE_RESULT (current_cpu, "h-memory", 'x', GETMEMHI (current_cpu, * FLD (f_r2))); + TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMHI (current_cpu, * FLD (f_r2))); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -2015,18 +2293,21 @@ SETMEMHI (current_cpu, * FLD (f_r2), * FLD (f_r1)); CIA SEM_FN_NAME (m32r,sth_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { -#define FLD(f) abuf->fields.fmt_40_st_d.f +#define FLD(f) abuf->fields.fmt_41_st_d.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + SETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), * FLD (f_r1)); - TRACE_RESULT (current_cpu, "h-memory", 'x', GETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); + TRACE_RESULT (current_cpu, "h-memory-add-WI-src2-slo16", 'x', GETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)))); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -2038,19 +2319,22 @@ SEM_FN_NAME (m32r,st_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_15_cmp.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + do { * FLD (f_r2) = ADDSI (* FLD (f_r2), 4); TRACE_RESULT (current_cpu, "src2", 'x', * FLD (f_r2)); SETMEMSI (current_cpu, * FLD (f_r2), * FLD (f_r1)); - TRACE_RESULT (current_cpu, "h-memory", 'x', GETMEMSI (current_cpu, * FLD (f_r2))); + TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMSI (current_cpu, * FLD (f_r2))); } while (0); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -2062,19 +2346,22 @@ SEM_FN_NAME (m32r,st_minus) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_15_cmp.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + do { * FLD (f_r2) = SUBSI (* FLD (f_r2), 4); TRACE_RESULT (current_cpu, "src2", 'x', * FLD (f_r2)); SETMEMSI (current_cpu, * FLD (f_r2), * FLD (f_r1)); - TRACE_RESULT (current_cpu, "h-memory", 'x', GETMEMSI (current_cpu, * FLD (f_r2))); + TRACE_RESULT (current_cpu, "h-memory-src2", 'x', GETMEMSI (current_cpu, * FLD (f_r2))); } while (0); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -2086,16 +2373,19 @@ SEM_FN_NAME (m32r,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_0_add.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = SUBSI (* FLD (f_r1), * FLD (f_r2)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -2107,6 +2397,7 @@ SEM_FN_NAME (m32r,subv) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_0_add.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + do { BI temp1;SI temp0; temp0 = SUBSI (* FLD (f_r1), * FLD (f_r2)); @@ -2116,14 +2407,16 @@ do { CPU (h_cond) = temp1; TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); } while (0); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } @@ -2135,6 +2428,7 @@ SEM_FN_NAME (m32r,subx) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_6_addx.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + do { BI temp1;SI temp0; temp0 = SUBCSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond)); @@ -2144,33 +2438,38 @@ do { CPU (h_cond) = temp1; TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); } while (0); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); m32r_model_mark_set_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } -/* Perform trap: trap $uimm4. */ +/* Perform trap: trap #$uimm4. */ CIA SEM_FN_NAME (m32r,trap) (SIM_CPU *current_cpu, SEM_ARG sem_arg) { -#define FLD(f) abuf->fields.fmt_41_trap.f +#define FLD(f) abuf->fields.fmt_42_trap.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); int taken_p = 0; + do_trap (current_cpu, FLD (f_uimm4)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { - model_profile_cti_insn (current_cpu, abuf, taken_p); + m32r_model_profile_cti_insn (current_cpu, abuf, taken_p); } #endif + return new_pc; #undef FLD } @@ -2182,14 +2481,17 @@ SEM_FN_NAME (m32r,unlock) (SIM_CPU *current_cpu, SEM_ARG sem_arg) #define FLD(f) abuf->fields.fmt_15_cmp.f ARGBUF *abuf = SEM_ARGBUF (sem_arg); CIA new_pc = SEM_NEXT_PC (sem_arg); + do_unlock (current_cpu, * FLD (f_r1), * FLD (f_r2)); + #if WITH_PROFILE_MODEL_P if (PROFILE_MODEL_P (current_cpu)) { m32r_model_mark_get_h_gr (current_cpu, abuf); - model_profile_insn (current_cpu, abuf); + m32r_model_profile_insn (current_cpu, abuf); } #endif + return new_pc; #undef FLD } |