diff options
Diffstat (limited to 'sim/m32r/sem-switch.c')
-rw-r--r-- | sim/m32r/sem-switch.c | 414 |
1 files changed, 359 insertions, 55 deletions
diff --git a/sim/m32r/sem-switch.c b/sim/m32r/sem-switch.c index 773a6fa..d944096 100644 --- a/sim/m32r/sem-switch.c +++ b/sim/m32r/sem-switch.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. @@ -23,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifdef DEFINE_LABELS #undef DEFINE_LABELS - /* The labels have the case they have because the enum of insn types is all uppercase and in the non-stdc case the insn symbol is built into the enum name. @@ -68,6 +69,7 @@ with this program; if not, write to the Free Software Foundation, Inc., && case_sem_INSN_DIVU, && case_sem_INSN_REM, && case_sem_INSN_REMU, + && case_sem_INSN_DIVH, && case_sem_INSN_JL, && case_sem_INSN_JMP, && case_sem_INSN_LD, @@ -160,7 +162,7 @@ with this program; if not, write to the Free Software Foundation, Inc., { SEM_ARG sem_arg = sc; ARGBUF *abuf = SEM_ARGBUF (sem_arg); - CIA new_pc = SEM_NEXT_PC (sem_arg); + CIA new_pc; SWITCH (sem, sem_arg->semantic.sem_case) { @@ -175,17 +177,23 @@ with this program; if not, write to the Free Software Foundation, Inc., CASE (sem, INSN_ADD) : /* add $dr,$sr */ { #define FLD(f) abuf->fields.fmt_0_add.f + 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)); + #undef FLD } BREAK (sem); - CASE (sem, INSN_ADD3) : /* add3 $dr,$sr,$slo16 */ + CASE (sem, INSN_ADD3) : /* add3 $dr,$sr,#$slo16 */ { #define FLD(f) abuf->fields.fmt_1_add3.f + 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)); + #undef FLD } BREAK (sem); @@ -193,17 +201,23 @@ with this program; if not, write to the Free Software Foundation, Inc., CASE (sem, INSN_AND) : /* and $dr,$sr */ { #define FLD(f) abuf->fields.fmt_0_add.f + 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)); + #undef FLD } BREAK (sem); - CASE (sem, INSN_AND3) : /* and3 $dr,$sr,$uimm16 */ + CASE (sem, INSN_AND3) : /* and3 $dr,$sr,#$uimm16 */ { #define FLD(f) abuf->fields.fmt_2_and3.f + 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)); + #undef FLD } BREAK (sem); @@ -211,17 +225,23 @@ with this program; if not, write to the Free Software Foundation, Inc., CASE (sem, INSN_OR) : /* or $dr,$sr */ { #define FLD(f) abuf->fields.fmt_0_add.f + 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)); + #undef FLD } BREAK (sem); - CASE (sem, INSN_OR3) : /* or3 $dr,$sr,$ulo16 */ + CASE (sem, INSN_OR3) : /* or3 $dr,$sr,#$ulo16 */ { #define FLD(f) abuf->fields.fmt_3_or3.f + 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)); + #undef FLD } BREAK (sem); @@ -229,26 +249,35 @@ with this program; if not, write to the Free Software Foundation, Inc., CASE (sem, INSN_XOR) : /* xor $dr,$sr */ { #define FLD(f) abuf->fields.fmt_0_add.f + 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)); + #undef FLD } BREAK (sem); - CASE (sem, INSN_XOR3) : /* xor3 $dr,$sr,$uimm16 */ + CASE (sem, INSN_XOR3) : /* xor3 $dr,$sr,#$uimm16 */ { #define FLD(f) abuf->fields.fmt_2_and3.f + 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)); + #undef FLD } BREAK (sem); - CASE (sem, INSN_ADDI) : /* addi $dr,$simm8 */ + CASE (sem, INSN_ADDI) : /* addi $dr,#$simm8 */ { #define FLD(f) abuf->fields.fmt_4_addi.f + 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)); + #undef FLD } BREAK (sem); @@ -256,6 +285,8 @@ with this program; if not, write to the Free Software Foundation, Inc., CASE (sem, INSN_ADDV) : /* addv $dr,$sr */ { #define FLD(f) abuf->fields.fmt_0_add.f + new_pc = SEM_NEXT_PC (sem_arg); + do { BI temp1;SI temp0; temp0 = ADDSI (* FLD (f_r1), * FLD (f_r2)); @@ -265,13 +296,16 @@ do { CPU (h_cond) = temp1; TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); } while (0); + #undef FLD } BREAK (sem); - CASE (sem, INSN_ADDV3) : /* addv3 $dr,$sr,$simm16 */ + CASE (sem, INSN_ADDV3) : /* addv3 $dr,$sr,#$simm16 */ { #define FLD(f) abuf->fields.fmt_5_addv3.f + new_pc = SEM_NEXT_PC (sem_arg); + do { BI temp1;SI temp0; temp0 = ADDSI (* FLD (f_r2), FLD (f_simm16)); @@ -281,6 +315,7 @@ do { CPU (h_cond) = temp1; TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); } while (0); + #undef FLD } BREAK (sem); @@ -288,6 +323,8 @@ do { CASE (sem, INSN_ADDX) : /* addx $dr,$sr */ { #define FLD(f) abuf->fields.fmt_6_addx.f + new_pc = SEM_NEXT_PC (sem_arg); + do { BI temp1;SI temp0; temp0 = ADDCSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond)); @@ -297,6 +334,7 @@ do { CPU (h_cond) = temp1; TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); } while (0); + #undef FLD } BREAK (sem); @@ -304,9 +342,12 @@ do { CASE (sem, INSN_BC8) : /* bc $disp8 */ { #define FLD(f) abuf->fields.fmt_7_bc8.f + new_pc = SEM_NEXT_PC (sem_arg); + if (CPU (h_cond)) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp8))); } + #undef FLD } BREAK (sem); @@ -314,9 +355,12 @@ if (CPU (h_cond)) { CASE (sem, INSN_BC24) : /* bc $disp24 */ { #define FLD(f) abuf->fields.fmt_8_bc24.f + new_pc = SEM_NEXT_PC (sem_arg); + if (CPU (h_cond)) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp24))); } + #undef FLD } BREAK (sem); @@ -324,9 +368,12 @@ if (CPU (h_cond)) { CASE (sem, INSN_BEQ) : /* beq $src1,$src2,$disp16 */ { #define FLD(f) abuf->fields.fmt_9_beq.f + new_pc = SEM_NEXT_PC (sem_arg); + if (EQSI (* FLD (f_r1), * FLD (f_r2))) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); } + #undef FLD } BREAK (sem); @@ -334,9 +381,12 @@ if (EQSI (* FLD (f_r1), * FLD (f_r2))) { CASE (sem, INSN_BEQZ) : /* beqz $src2,$disp16 */ { #define FLD(f) abuf->fields.fmt_10_beqz.f + new_pc = SEM_NEXT_PC (sem_arg); + if (EQSI (* FLD (f_r2), 0)) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); } + #undef FLD } BREAK (sem); @@ -344,9 +394,12 @@ if (EQSI (* FLD (f_r2), 0)) { CASE (sem, INSN_BGEZ) : /* bgez $src2,$disp16 */ { #define FLD(f) abuf->fields.fmt_10_beqz.f + new_pc = SEM_NEXT_PC (sem_arg); + if (GESI (* FLD (f_r2), 0)) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); } + #undef FLD } BREAK (sem); @@ -354,9 +407,12 @@ if (GESI (* FLD (f_r2), 0)) { CASE (sem, INSN_BGTZ) : /* bgtz $src2,$disp16 */ { #define FLD(f) abuf->fields.fmt_10_beqz.f + new_pc = SEM_NEXT_PC (sem_arg); + if (GTSI (* FLD (f_r2), 0)) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); } + #undef FLD } BREAK (sem); @@ -364,9 +420,12 @@ if (GTSI (* FLD (f_r2), 0)) { CASE (sem, INSN_BLEZ) : /* blez $src2,$disp16 */ { #define FLD(f) abuf->fields.fmt_10_beqz.f + new_pc = SEM_NEXT_PC (sem_arg); + if (LESI (* FLD (f_r2), 0)) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); } + #undef FLD } BREAK (sem); @@ -374,9 +433,12 @@ if (LESI (* FLD (f_r2), 0)) { CASE (sem, INSN_BLTZ) : /* bltz $src2,$disp16 */ { #define FLD(f) abuf->fields.fmt_10_beqz.f + new_pc = SEM_NEXT_PC (sem_arg); + if (LTSI (* FLD (f_r2), 0)) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); } + #undef FLD } BREAK (sem); @@ -384,9 +446,12 @@ if (LTSI (* FLD (f_r2), 0)) { CASE (sem, INSN_BNEZ) : /* bnez $src2,$disp16 */ { #define FLD(f) abuf->fields.fmt_10_beqz.f + new_pc = SEM_NEXT_PC (sem_arg); + if (NESI (* FLD (f_r2), 0)) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); } + #undef FLD } BREAK (sem); @@ -394,11 +459,14 @@ if (NESI (* FLD (f_r2), 0)) { CASE (sem, INSN_BL8) : /* bl $disp8 */ { #define FLD(f) abuf->fields.fmt_11_bl8.f + new_pc = SEM_NEXT_PC (sem_arg); + 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))); } while (0); + #undef FLD } BREAK (sem); @@ -406,11 +474,14 @@ do { CASE (sem, INSN_BL24) : /* bl $disp24 */ { #define FLD(f) abuf->fields.fmt_12_bl24.f + new_pc = SEM_NEXT_PC (sem_arg); + 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))); } while (0); + #undef FLD } BREAK (sem); @@ -418,9 +489,12 @@ do { CASE (sem, INSN_BNC8) : /* bnc $disp8 */ { #define FLD(f) abuf->fields.fmt_7_bc8.f + new_pc = SEM_NEXT_PC (sem_arg); + if (NOTBI (CPU (h_cond))) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp8))); } + #undef FLD } BREAK (sem); @@ -428,9 +502,12 @@ if (NOTBI (CPU (h_cond))) { CASE (sem, INSN_BNC24) : /* bnc $disp24 */ { #define FLD(f) abuf->fields.fmt_8_bc24.f + new_pc = SEM_NEXT_PC (sem_arg); + if (NOTBI (CPU (h_cond))) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp24))); } + #undef FLD } BREAK (sem); @@ -438,9 +515,12 @@ if (NOTBI (CPU (h_cond))) { CASE (sem, INSN_BNE) : /* bne $src1,$src2,$disp16 */ { #define FLD(f) abuf->fields.fmt_9_beq.f + new_pc = SEM_NEXT_PC (sem_arg); + if (NESI (* FLD (f_r1), * FLD (f_r2))) { BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp16))); } + #undef FLD } BREAK (sem); @@ -448,7 +528,10 @@ if (NESI (* FLD (f_r1), * FLD (f_r2))) { CASE (sem, INSN_BRA8) : /* bra $disp8 */ { #define FLD(f) abuf->fields.fmt_13_bra8.f + new_pc = SEM_NEXT_PC (sem_arg); + BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp8))); + #undef FLD } BREAK (sem); @@ -456,7 +539,10 @@ if (NESI (* FLD (f_r1), * FLD (f_r2))) { CASE (sem, INSN_BRA24) : /* bra $disp24 */ { #define FLD(f) abuf->fields.fmt_14_bra24.f + new_pc = SEM_NEXT_PC (sem_arg); + BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, FLD (f_disp24))); + #undef FLD } BREAK (sem); @@ -464,17 +550,23 @@ if (NESI (* FLD (f_r1), * FLD (f_r2))) { CASE (sem, INSN_CMP) : /* cmp $src1,$src2 */ { #define FLD(f) abuf->fields.fmt_15_cmp.f + 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)); + #undef FLD } BREAK (sem); - CASE (sem, INSN_CMPI) : /* cmpi $src2,$simm16 */ + CASE (sem, INSN_CMPI) : /* cmpi $src2,#$simm16 */ { #define FLD(f) abuf->fields.fmt_16_cmpi.f + 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)); + #undef FLD } BREAK (sem); @@ -482,17 +574,23 @@ if (NESI (* FLD (f_r1), * FLD (f_r2))) { CASE (sem, INSN_CMPU) : /* cmpu $src1,$src2 */ { #define FLD(f) abuf->fields.fmt_15_cmp.f + 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)); + #undef FLD } BREAK (sem); - CASE (sem, INSN_CMPUI) : /* cmpui $src2,$uimm16 */ + CASE (sem, INSN_CMPUI) : /* cmpui $src2,#$uimm16 */ { #define FLD(f) abuf->fields.fmt_17_cmpui.f + 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)); + #undef FLD } BREAK (sem); @@ -500,10 +598,13 @@ if (NESI (* FLD (f_r1), * FLD (f_r2))) { CASE (sem, INSN_DIV) : /* div $dr,$sr */ { #define FLD(f) abuf->fields.fmt_18_div.f + 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)); } + #undef FLD } BREAK (sem); @@ -511,10 +612,13 @@ if (NESI (* FLD (f_r2), 0)) { CASE (sem, INSN_DIVU) : /* divu $dr,$sr */ { #define FLD(f) abuf->fields.fmt_18_div.f + 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)); } + #undef FLD } BREAK (sem); @@ -522,10 +626,13 @@ if (NESI (* FLD (f_r2), 0)) { CASE (sem, INSN_REM) : /* rem $dr,$sr */ { #define FLD(f) abuf->fields.fmt_18_div.f + 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)); } + #undef FLD } BREAK (sem); @@ -533,10 +640,27 @@ if (NESI (* FLD (f_r2), 0)) { CASE (sem, INSN_REMU) : /* remu $dr,$sr */ { #define FLD(f) abuf->fields.fmt_18_div.f + 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)); } + +#undef FLD +} + BREAK (sem); + + CASE (sem, INSN_DIVH) : /* divh $dr,$sr */ +{ +#define FLD(f) abuf->fields.fmt_18_div.f + new_pc = SEM_NEXT_PC (sem_arg); + +if (NESI (* FLD (f_r2), 0)) { +* FLD (f_r1) = DIVSI (EXTHISI (TRUNCSIHI (* FLD (f_r1))), * FLD (f_r2)); + TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); +} + #undef FLD } BREAK (sem); @@ -544,14 +668,17 @@ if (NESI (* FLD (f_r2), 0)) { CASE (sem, INSN_JL) : /* jl $sr */ { #define FLD(f) abuf->fields.fmt_19_jl.f + new_pc = SEM_NEXT_PC (sem_arg); + do { - USI temp1;SI temp0; + SI 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)); } while (0); + #undef FLD } BREAK (sem); @@ -559,7 +686,10 @@ do { CASE (sem, INSN_JMP) : /* jmp $sr */ { #define FLD(f) abuf->fields.fmt_20_jmp.f + new_pc = SEM_NEXT_PC (sem_arg); + BRANCH_NEW_PC (current_cpu, new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, * FLD (f_r2))); + #undef FLD } BREAK (sem); @@ -567,8 +697,11 @@ do { CASE (sem, INSN_LD) : /* ld $dr,@$sr */ { #define FLD(f) abuf->fields.fmt_21_ld.f + 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)); + #undef FLD } BREAK (sem); @@ -576,8 +709,11 @@ do { CASE (sem, INSN_LD_D) : /* ld $dr,@($slo16,$sr) */ { #define FLD(f) abuf->fields.fmt_22_ld_d.f + 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)); + #undef FLD } BREAK (sem); @@ -585,8 +721,11 @@ do { CASE (sem, INSN_LDB) : /* ldb $dr,@$sr */ { #define FLD(f) abuf->fields.fmt_23_ldb.f + 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)); + #undef FLD } BREAK (sem); @@ -594,8 +733,11 @@ do { CASE (sem, INSN_LDB_D) : /* ldb $dr,@($slo16,$sr) */ { #define FLD(f) abuf->fields.fmt_24_ldb_d.f + 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)); + #undef FLD } BREAK (sem); @@ -603,8 +745,11 @@ do { CASE (sem, INSN_LDH) : /* ldh $dr,@$sr */ { #define FLD(f) abuf->fields.fmt_25_ldh.f + 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)); + #undef FLD } BREAK (sem); @@ -612,8 +757,11 @@ do { CASE (sem, INSN_LDH_D) : /* ldh $dr,@($slo16,$sr) */ { #define FLD(f) abuf->fields.fmt_26_ldh_d.f + 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)); + #undef FLD } BREAK (sem); @@ -621,8 +769,11 @@ do { CASE (sem, INSN_LDUB) : /* ldub $dr,@$sr */ { #define FLD(f) abuf->fields.fmt_23_ldb.f + 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)); + #undef FLD } BREAK (sem); @@ -630,8 +781,11 @@ do { CASE (sem, INSN_LDUB_D) : /* ldub $dr,@($slo16,$sr) */ { #define FLD(f) abuf->fields.fmt_24_ldb_d.f + 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)); + #undef FLD } BREAK (sem); @@ -639,8 +793,11 @@ do { CASE (sem, INSN_LDUH) : /* lduh $dr,@$sr */ { #define FLD(f) abuf->fields.fmt_25_ldh.f + 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)); + #undef FLD } BREAK (sem); @@ -648,8 +805,11 @@ do { CASE (sem, INSN_LDUH_D) : /* lduh $dr,@($slo16,$sr) */ { #define FLD(f) abuf->fields.fmt_26_ldh_d.f + 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)); + #undef FLD } BREAK (sem); @@ -657,6 +817,8 @@ do { CASE (sem, INSN_LD_PLUS) : /* ld $dr,@$sr+ */ { #define FLD(f) abuf->fields.fmt_21_ld.f + new_pc = SEM_NEXT_PC (sem_arg); + do { SI temp1;SI temp0; temp0 = GETMEMSI (current_cpu, * FLD (f_r2)); @@ -666,24 +828,31 @@ do { * FLD (f_r2) = temp1; TRACE_RESULT (current_cpu, "sr", 'x', * FLD (f_r2)); } while (0); + #undef FLD } BREAK (sem); - CASE (sem, INSN_LD24) : /* ld24 $dr,$uimm24 */ + CASE (sem, INSN_LD24) : /* ld24 $dr,#$uimm24 */ { #define FLD(f) abuf->fields.fmt_27_ld24.f + new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = FLD (f_uimm24); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #undef FLD } BREAK (sem); - CASE (sem, INSN_LDI8) : /* ldi $dr,$simm8 */ + CASE (sem, INSN_LDI8) : /* ldi $dr,#$simm8 */ { #define FLD(f) abuf->fields.fmt_28_ldi8.f + new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = FLD (f_simm8); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #undef FLD } BREAK (sem); @@ -691,8 +860,11 @@ do { CASE (sem, INSN_LDI16) : /* ldi $dr,$slo16 */ { #define FLD(f) abuf->fields.fmt_29_ldi16.f + new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = FLD (f_simm16); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #undef FLD } BREAK (sem); @@ -700,7 +872,10 @@ do { CASE (sem, INSN_LOCK) : /* lock $dr,@$sr */ { #define FLD(f) abuf->fields.fmt_0_add.f + new_pc = SEM_NEXT_PC (sem_arg); + do_lock (current_cpu, * FLD (f_r1), * FLD (f_r2)); + #undef FLD } BREAK (sem); @@ -708,8 +883,11 @@ do_lock (current_cpu, * FLD (f_r1), * FLD (f_r2)); CASE (sem, INSN_MACHI) : /* machi $src1,$src2 */ { #define FLD(f) abuf->fields.fmt_30_machi.f + 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)); + #undef FLD } BREAK (sem); @@ -717,8 +895,11 @@ do_lock (current_cpu, * FLD (f_r1), * FLD (f_r2)); CASE (sem, INSN_MACLO) : /* maclo $src1,$src2 */ { #define FLD(f) abuf->fields.fmt_30_machi.f + 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)); + #undef FLD } BREAK (sem); @@ -726,8 +907,11 @@ do_lock (current_cpu, * FLD (f_r1), * FLD (f_r2)); CASE (sem, INSN_MACWHI) : /* macwhi $src1,$src2 */ { #define FLD(f) abuf->fields.fmt_30_machi.f + 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)); + #undef FLD } BREAK (sem); @@ -735,8 +919,11 @@ do_lock (current_cpu, * FLD (f_r1), * FLD (f_r2)); CASE (sem, INSN_MACWLO) : /* macwlo $src1,$src2 */ { #define FLD(f) abuf->fields.fmt_30_machi.f + 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)); + #undef FLD } BREAK (sem); @@ -744,8 +931,11 @@ do_lock (current_cpu, * FLD (f_r1), * FLD (f_r2)); CASE (sem, INSN_MUL) : /* mul $dr,$sr */ { #define FLD(f) abuf->fields.fmt_0_add.f + 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)); + #undef FLD } BREAK (sem); @@ -753,8 +943,11 @@ do_lock (current_cpu, * FLD (f_r1), * FLD (f_r2)); CASE (sem, INSN_MULHI) : /* mulhi $src1,$src2 */ { #define FLD(f) abuf->fields.fmt_15_cmp.f + 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)); + #undef FLD } BREAK (sem); @@ -762,8 +955,11 @@ do_lock (current_cpu, * FLD (f_r1), * FLD (f_r2)); CASE (sem, INSN_MULLO) : /* mullo $src1,$src2 */ { #define FLD(f) abuf->fields.fmt_15_cmp.f + 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)); + #undef FLD } BREAK (sem); @@ -771,8 +967,11 @@ do_lock (current_cpu, * FLD (f_r1), * FLD (f_r2)); CASE (sem, INSN_MULWHI) : /* mulwhi $src1,$src2 */ { #define FLD(f) abuf->fields.fmt_15_cmp.f + 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)); + #undef FLD } BREAK (sem); @@ -780,8 +979,11 @@ do_lock (current_cpu, * FLD (f_r1), * FLD (f_r2)); CASE (sem, INSN_MULWLO) : /* mulwlo $src1,$src2 */ { #define FLD(f) abuf->fields.fmt_15_cmp.f + 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)); + #undef FLD } BREAK (sem); @@ -789,8 +991,11 @@ do_lock (current_cpu, * FLD (f_r1), * FLD (f_r2)); CASE (sem, INSN_MV) : /* mv $dr,$sr */ { #define FLD(f) abuf->fields.fmt_31_mv.f + new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = * FLD (f_r2); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #undef FLD } BREAK (sem); @@ -798,8 +1003,11 @@ do_lock (current_cpu, * FLD (f_r1), * FLD (f_r2)); CASE (sem, INSN_MVFACHI) : /* mvfachi $dr */ { #define FLD(f) abuf->fields.fmt_32_mvfachi.f + 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)); + #undef FLD } BREAK (sem); @@ -807,8 +1015,11 @@ do_lock (current_cpu, * FLD (f_r1), * FLD (f_r2)); CASE (sem, INSN_MVFACLO) : /* mvfaclo $dr */ { #define FLD(f) abuf->fields.fmt_32_mvfachi.f + new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = TRUNCDISI (CPU (h_accum)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #undef FLD } BREAK (sem); @@ -816,8 +1027,11 @@ do_lock (current_cpu, * FLD (f_r1), * FLD (f_r2)); CASE (sem, INSN_MVFACMI) : /* mvfacmi $dr */ { #define FLD(f) abuf->fields.fmt_32_mvfachi.f + 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)); + #undef FLD } BREAK (sem); @@ -825,8 +1039,11 @@ do_lock (current_cpu, * FLD (f_r1), * FLD (f_r2)); CASE (sem, INSN_MVFC) : /* mvfc $dr,$scr */ { #define FLD(f) abuf->fields.fmt_33_mvfc.f + 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)); + #undef FLD } BREAK (sem); @@ -834,8 +1051,11 @@ do_lock (current_cpu, * FLD (f_r1), * FLD (f_r2)); CASE (sem, INSN_MVTACHI) : /* mvtachi $src1 */ { #define FLD(f) abuf->fields.fmt_34_mvtachi.f + 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)); + #undef FLD } BREAK (sem); @@ -843,8 +1063,11 @@ do_lock (current_cpu, * FLD (f_r1), * FLD (f_r2)); CASE (sem, INSN_MVTACLO) : /* mvtaclo $src1 */ { #define FLD(f) abuf->fields.fmt_34_mvtachi.f + 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)); + #undef FLD } BREAK (sem); @@ -852,8 +1075,11 @@ do_lock (current_cpu, * FLD (f_r1), * FLD (f_r2)); CASE (sem, INSN_MVTC) : /* mvtc $sr,$dcr */ { #define FLD(f) abuf->fields.fmt_35_mvtc.f + 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))); + #undef FLD } BREAK (sem); @@ -861,8 +1087,11 @@ m32r_h_cr_set (current_cpu, FLD (f_r1), * FLD (f_r2)); CASE (sem, INSN_NEG) : /* neg $dr,$sr */ { #define FLD(f) abuf->fields.fmt_31_mv.f + new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = NEGSI (* FLD (f_r2)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #undef FLD } BREAK (sem); @@ -870,7 +1099,10 @@ m32r_h_cr_set (current_cpu, FLD (f_r1), * FLD (f_r2)); CASE (sem, INSN_NOP) : /* nop */ { #define FLD(f) abuf->fields.fmt_36_nop.f + new_pc = SEM_NEXT_PC (sem_arg); + PROFILE_COUNT_FILLNOPS (current_cpu, abuf->addr); + #undef FLD } BREAK (sem); @@ -878,8 +1110,11 @@ PROFILE_COUNT_FILLNOPS (current_cpu, abuf->addr); CASE (sem, INSN_NOT) : /* not $dr,$sr */ { #define FLD(f) abuf->fields.fmt_31_mv.f + new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = INVSI (* FLD (f_r2)); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #undef FLD } BREAK (sem); @@ -887,22 +1122,16 @@ PROFILE_COUNT_FILLNOPS (current_cpu, abuf->addr); CASE (sem, INSN_RAC) : /* rac */ { #define FLD(f) abuf->fields.fmt_37_rac.f + new_pc = SEM_NEXT_PC (sem_arg); + do { DI tmp_tmp1; - tmp_tmp1 = ANDDI (CPU (h_accum), MAKEDI (16777215, 0xffffffff)); -if (ANDIFSI (GEDI (tmp_tmp1, MAKEDI (16383, 0xffff8000)), LEDI (tmp_tmp1, MAKEDI (8388607, 0xffffffff)))) { - tmp_tmp1 = MAKEDI (16383, 0xffff8000); -} else { -if (ANDIFSI (GEDI (tmp_tmp1, MAKEDI (8388608, 0)), LEDI (tmp_tmp1, MAKEDI (16760832, 0)))) { - tmp_tmp1 = MAKEDI (16760832, 0); -} else { - tmp_tmp1 = ANDDI (ADDDI (CPU (h_accum), MAKEDI (0, 16384)), MAKEDI (16777215, 0xffff8000)); -} -} - tmp_tmp1 = SLLDI (tmp_tmp1, 1); - CPU (h_accum) = SRADI (SLLDI (tmp_tmp1, 7), 7); + tmp_tmp1 = SLLDI (CPU (h_accum), 1); + tmp_tmp1 = ADDDI (tmp_tmp1, MAKEDI (0, 32768)); + CPU (h_accum) = (GTDI (tmp_tmp1, MAKEDI (32767, 0xffff0000))) ? (MAKEDI (32767, 0xffff0000)) : (LTDI (tmp_tmp1, MAKEDI (0xffff8000, 0))) ? (MAKEDI (0xffff8000, 0)) : (ANDDI (tmp_tmp1, MAKEDI (0xffffffff, 0xffff0000))); TRACE_RESULT (current_cpu, "accum", 'D', CPU (h_accum)); } while (0); + #undef FLD } BREAK (sem); @@ -910,6 +1139,8 @@ if (ANDIFSI (GEDI (tmp_tmp1, MAKEDI (8388608, 0)), LEDI (tmp_tmp1, MAKEDI (16760 CASE (sem, INSN_RACH) : /* rach */ { #define FLD(f) abuf->fields.fmt_37_rac.f + new_pc = SEM_NEXT_PC (sem_arg); + do { DI tmp_tmp1; tmp_tmp1 = ANDDI (CPU (h_accum), MAKEDI (16777215, 0xffffffff)); @@ -926,32 +1157,39 @@ 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); + #undef FLD } BREAK (sem); CASE (sem, INSN_RTE) : /* rte */ { -#define FLD(f) abuf->fields.fmt_36_nop.f +#define FLD(f) abuf->fields.fmt_38_rte.f + new_pc = SEM_NEXT_PC (sem_arg); + 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))); TRACE_RESULT (current_cpu, "pc", 'x', CPU (h_pc)); } while (0); + #undef FLD } BREAK (sem); - CASE (sem, INSN_SETH) : /* seth $dr,$hi16 */ + CASE (sem, INSN_SETH) : /* seth $dr,#$hi16 */ { -#define FLD(f) abuf->fields.fmt_38_seth.f +#define FLD(f) abuf->fields.fmt_39_seth.f + new_pc = SEM_NEXT_PC (sem_arg); + * FLD (f_r1) = SLLSI (FLD (f_hi16), 16); TRACE_RESULT (current_cpu, "dr", 'x', * FLD (f_r1)); + #undef FLD } BREAK (sem); @@ -959,26 +1197,35 @@ do { CASE (sem, INSN_SLL) : /* sll $dr,$sr */ { #define FLD(f) abuf->fields.fmt_0_add.f + 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)); + #undef FLD } BREAK (sem); - CASE (sem, INSN_SLL3) : /* sll3 $dr,$sr,$simm16 */ + CASE (sem, INSN_SLL3) : /* sll3 $dr,$sr,#$simm16 */ { #define FLD(f) abuf->fields.fmt_5_addv3.f + 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)); + #undef FLD } BREAK (sem); - CASE (sem, INSN_SLLI) : /* slli $dr,$uimm5 */ + CASE (sem, INSN_SLLI) : /* slli $dr,#$uimm5 */ { -#define FLD(f) abuf->fields.fmt_39_slli.f +#define FLD(f) abuf->fields.fmt_40_slli.f + 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)); + #undef FLD } BREAK (sem); @@ -986,26 +1233,35 @@ do { CASE (sem, INSN_SRA) : /* sra $dr,$sr */ { #define FLD(f) abuf->fields.fmt_0_add.f + 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)); + #undef FLD } BREAK (sem); - CASE (sem, INSN_SRA3) : /* sra3 $dr,$sr,$simm16 */ + CASE (sem, INSN_SRA3) : /* sra3 $dr,$sr,#$simm16 */ { #define FLD(f) abuf->fields.fmt_5_addv3.f + 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)); + #undef FLD } BREAK (sem); - CASE (sem, INSN_SRAI) : /* srai $dr,$uimm5 */ + CASE (sem, INSN_SRAI) : /* srai $dr,#$uimm5 */ { -#define FLD(f) abuf->fields.fmt_39_slli.f +#define FLD(f) abuf->fields.fmt_40_slli.f + 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)); + #undef FLD } BREAK (sem); @@ -1013,26 +1269,35 @@ do { CASE (sem, INSN_SRL) : /* srl $dr,$sr */ { #define FLD(f) abuf->fields.fmt_0_add.f + 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)); + #undef FLD } BREAK (sem); - CASE (sem, INSN_SRL3) : /* srl3 $dr,$sr,$simm16 */ + CASE (sem, INSN_SRL3) : /* srl3 $dr,$sr,#$simm16 */ { #define FLD(f) abuf->fields.fmt_5_addv3.f + 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)); + #undef FLD } BREAK (sem); - CASE (sem, INSN_SRLI) : /* srli $dr,$uimm5 */ + CASE (sem, INSN_SRLI) : /* srli $dr,#$uimm5 */ { -#define FLD(f) abuf->fields.fmt_39_slli.f +#define FLD(f) abuf->fields.fmt_40_slli.f + 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)); + #undef FLD } BREAK (sem); @@ -1040,17 +1305,23 @@ do { CASE (sem, INSN_ST) : /* st $src1,@$src2 */ { #define FLD(f) abuf->fields.fmt_15_cmp.f + 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))); + #undef FLD } BREAK (sem); CASE (sem, INSN_ST_D) : /* st $src1,@($slo16,$src2) */ { -#define FLD(f) abuf->fields.fmt_40_st_d.f +#define FLD(f) abuf->fields.fmt_41_st_d.f + 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)))); + #undef FLD } BREAK (sem); @@ -1058,17 +1329,23 @@ SETMEMSI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), * FLD (f_r1)); CASE (sem, INSN_STB) : /* stb $src1,@$src2 */ { #define FLD(f) abuf->fields.fmt_15_cmp.f + 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))); + #undef FLD } BREAK (sem); CASE (sem, INSN_STB_D) : /* stb $src1,@($slo16,$src2) */ { -#define FLD(f) abuf->fields.fmt_40_st_d.f +#define FLD(f) abuf->fields.fmt_41_st_d.f + 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)))); + #undef FLD } BREAK (sem); @@ -1076,17 +1353,23 @@ SETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), * FLD (f_r1)); CASE (sem, INSN_STH) : /* sth $src1,@$src2 */ { #define FLD(f) abuf->fields.fmt_15_cmp.f + 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))); + #undef FLD } BREAK (sem); CASE (sem, INSN_STH_D) : /* sth $src1,@($slo16,$src2) */ { -#define FLD(f) abuf->fields.fmt_40_st_d.f +#define FLD(f) abuf->fields.fmt_41_st_d.f + 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)))); + #undef FLD } BREAK (sem); @@ -1094,12 +1377,15 @@ SETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), * FLD (f_r1)); CASE (sem, INSN_ST_PLUS) : /* st $src1,@+$src2 */ { #define FLD(f) abuf->fields.fmt_15_cmp.f + 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); + #undef FLD } BREAK (sem); @@ -1107,12 +1393,15 @@ SETMEMSI (current_cpu, * FLD (f_r2), * FLD (f_r1)); CASE (sem, INSN_ST_MINUS) : /* st $src1,@-$src2 */ { #define FLD(f) abuf->fields.fmt_15_cmp.f + 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); + #undef FLD } BREAK (sem); @@ -1120,8 +1409,11 @@ SETMEMSI (current_cpu, * FLD (f_r2), * FLD (f_r1)); CASE (sem, INSN_SUB) : /* sub $dr,$sr */ { #define FLD(f) abuf->fields.fmt_0_add.f + 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)); + #undef FLD } BREAK (sem); @@ -1129,6 +1421,8 @@ SETMEMSI (current_cpu, * FLD (f_r2), * FLD (f_r1)); CASE (sem, INSN_SUBV) : /* subv $dr,$sr */ { #define FLD(f) abuf->fields.fmt_0_add.f + new_pc = SEM_NEXT_PC (sem_arg); + do { BI temp1;SI temp0; temp0 = SUBSI (* FLD (f_r1), * FLD (f_r2)); @@ -1138,6 +1432,7 @@ do { CPU (h_cond) = temp1; TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); } while (0); + #undef FLD } BREAK (sem); @@ -1145,6 +1440,8 @@ do { CASE (sem, INSN_SUBX) : /* subx $dr,$sr */ { #define FLD(f) abuf->fields.fmt_6_addx.f + new_pc = SEM_NEXT_PC (sem_arg); + do { BI temp1;SI temp0; temp0 = SUBCSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond)); @@ -1154,14 +1451,18 @@ do { CPU (h_cond) = temp1; TRACE_RESULT (current_cpu, "condbit", 'x', CPU (h_cond)); } while (0); + #undef FLD } BREAK (sem); - CASE (sem, INSN_TRAP) : /* trap $uimm4 */ + CASE (sem, INSN_TRAP) : /* trap #$uimm4 */ { -#define FLD(f) abuf->fields.fmt_41_trap.f +#define FLD(f) abuf->fields.fmt_42_trap.f + new_pc = SEM_NEXT_PC (sem_arg); + do_trap (current_cpu, FLD (f_uimm4)); + #undef FLD } BREAK (sem); @@ -1169,7 +1470,10 @@ do_trap (current_cpu, FLD (f_uimm4)); CASE (sem, INSN_UNLOCK) : /* unlock $src1,@$src2 */ { #define FLD(f) abuf->fields.fmt_15_cmp.f + new_pc = SEM_NEXT_PC (sem_arg); + do_unlock (current_cpu, * FLD (f_r1), * FLD (f_r2)); + #undef FLD } BREAK (sem); |