sim: namespace sim_machs
[binutils-gdb.git] / sim / m32r / sem.c
index 0251a80bf6aba75ddce050a60aa54389c191248e..81c51830beab0d424f93d9f837e46f09c9d0ea4d 100644 (file)
-/* Simulator instruction semantics for m32rb.
+/* Simulator instruction semantics for m32rbf.
 
 THIS FILE IS MACHINE GENERATED WITH CGEN.
 
-Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+Copyright 1996-2021 Free Software Foundation, Inc.
 
-This file is part of the GNU Simulators.
+This file is part of the GNU simulators.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   It is distributed in the hope that it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+   License for more details.
 
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, see <http://www.gnu.org/licenses/>.
 
 */
 
-#define WANT_CPU
-#define WANT_CPU_M32RB
+#define WANT_CPU m32rbf
+#define WANT_CPU_M32RBF
 
 #include "sim-main.h"
 #include "cgen-mem.h"
 #include "cgen-ops.h"
-#include "cpu-sim.h"
-
-#if WITH_SCACHE
 
 #undef GET_ATTR
-#define GET_ATTR(cpu, num, attr) CGEN_INSN_ATTR (abuf->idesc->opcode, CGEN_INSN_##attr)
+#define GET_ATTR(cpu, num, attr) CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr)
+
+/* This is used so that we can compile two copies of the semantic code,
+   one with full feature support and one without that runs fast(er).
+   FAST_P, when desired, is defined on the command line, -DFAST_P=1.  */
+#if FAST_P
+#define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_semf_,fn)
+#undef CGEN_TRACE_RESULT
+#define CGEN_TRACE_RESULT(cpu, abuf, name, type, val)
+#else
+#define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_sem_,fn)
+#endif
 
-/* add: add $dr,$sr.  */
+/* x-invalid: --invalid-- */
 
-CIA
-SEM_FN_NAME (m32rb,add) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,x_invalid) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_add.f
+#define FLD(f) abuf->fields.sfmt_empty.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
 
   {
-    SI opval = ADDSI (* FLD (f_r1), * FLD (f_r2));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    /* Update the recorded pc in the cpu state struct.
+       Only necessary for WITH_SCACHE case, but to avoid the
+       conditional compilation ....  */
+    SET_H_PC (pc);
+    /* Virtual insns have zero size.  Overwrite vpc with address of next insn
+       using the default-insn-bitsize spec.  When executing insns in parallel
+       we may want to queue the fault and continue execution.  */
+    vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
+    vpc = sim_engine_invalid_insn (current_cpu, pc, vpc);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
+  return vpc;
+#undef FLD
+}
+
+/* x-after: --after-- */
 
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
+static SEM_PC
+SEM_FN_NAME (m32rbf,x_after) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+{
+#define FLD(f) abuf->fields.sfmt_empty.f
+  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
+
+  {
+#if WITH_SCACHE_PBB_M32RBF
+    m32rbf_pbb_after (current_cpu, sem_arg);
 #endif
+  }
 
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* add3: add3 $dr,$sr,$hash$slo16.  */
+/* x-before: --before-- */
 
-CIA
-SEM_FN_NAME (m32rb,add3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,x_before) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_add3.f
+#define FLD(f) abuf->fields.sfmt_empty.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
 
   {
-    SI opval = ADDSI (* FLD (f_r2), FLD (f_simm16));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+#if WITH_SCACHE_PBB_M32RBF
+    m32rbf_pbb_before (current_cpu, sem_arg);
+#endif
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
+  return vpc;
+#undef FLD
+}
+
+/* x-cti-chain: --cti-chain-- */
 
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
+static SEM_PC
+SEM_FN_NAME (m32rbf,x_cti_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+{
+#define FLD(f) abuf->fields.sfmt_empty.f
+  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
+
+  {
+#if WITH_SCACHE_PBB_M32RBF
+#ifdef DEFINE_SWITCH
+    vpc = m32rbf_pbb_cti_chain (current_cpu, sem_arg,
+                              pbb_br_type, pbb_br_npc);
+    BREAK (sem);
+#else
+    /* FIXME: Allow provision of explicit ifmt spec in insn spec.  */
+    vpc = m32rbf_pbb_cti_chain (current_cpu, sem_arg,
+                              CPU_PBB_BR_TYPE (current_cpu),
+                              CPU_PBB_BR_NPC (current_cpu));
+#endif
 #endif
+  }
 
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* and: and $dr,$sr.  */
+/* x-chain: --chain-- */
 
-CIA
-SEM_FN_NAME (m32rb,and) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,x_chain) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_add.f
+#define FLD(f) abuf->fields.sfmt_empty.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
 
   {
-    SI opval = ANDSI (* FLD (f_r1), * FLD (f_r2));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+#if WITH_SCACHE_PBB_M32RBF
+    vpc = m32rbf_pbb_chain (current_cpu, sem_arg);
+#ifdef DEFINE_SWITCH
+    BREAK (sem);
+#endif
+#endif
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
+  return vpc;
+#undef FLD
+}
+
+/* x-begin: --begin-- */
 
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
+static SEM_PC
+SEM_FN_NAME (m32rbf,x_begin) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+{
+#define FLD(f) abuf->fields.sfmt_empty.f
+  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 0);
+
+  {
+#if WITH_SCACHE_PBB_M32RBF
+#if defined DEFINE_SWITCH || defined FAST_P
+    /* In the switch case FAST_P is a constant, allowing several optimizations
+       in any called inline functions.  */
+    vpc = m32rbf_pbb_begin (current_cpu, FAST_P);
+#else
+#if 0 /* cgen engine can't handle dynamic fast/full switching yet.  */
+    vpc = m32rbf_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu)));
+#else
+    vpc = m32rbf_pbb_begin (current_cpu, 0);
 #endif
+#endif
+#endif
+  }
 
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* and3: and3 $dr,$sr,$uimm16.  */
+/* add: add $dr,$sr */
 
-CIA
-SEM_FN_NAME (m32rb,and3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,add) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_and3.f
+#define FLD(f) abuf->fields.sfmt_add.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = ANDSI (* FLD (f_r2), FLD (f_uimm16));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = ADDSI (* FLD (i_dr), * FLD (i_sr));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* or: or $dr,$sr.  */
+/* add3: add3 $dr,$sr,$hash$slo16 */
 
-CIA
-SEM_FN_NAME (m32rb,or) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,add3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_add.f
+#define FLD(f) abuf->fields.sfmt_add3.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
-    SI opval = ORSI (* FLD (f_r1), * FLD (f_r2));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = ADDSI (* FLD (i_sr), FLD (f_simm16));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* or3: or3 $dr,$sr,$hash$ulo16.  */
+/* and: and $dr,$sr */
 
-CIA
-SEM_FN_NAME (m32rb,or3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,and) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_or3.f
+#define FLD(f) abuf->fields.sfmt_add.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = ORSI (* FLD (f_r2), FLD (f_uimm16));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = ANDSI (* FLD (i_dr), * FLD (i_sr));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* xor: xor $dr,$sr.  */
+/* and3: and3 $dr,$sr,$uimm16 */
 
-CIA
-SEM_FN_NAME (m32rb,xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,and3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_add.f
+#define FLD(f) abuf->fields.sfmt_and3.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
-    SI opval = XORSI (* FLD (f_r1), * FLD (f_r2));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = ANDSI (* FLD (i_sr), FLD (f_uimm16));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
+  return vpc;
+#undef FLD
+}
+
+/* or: or $dr,$sr */
 
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
+static SEM_PC
+SEM_FN_NAME (m32rbf,or) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+{
+#define FLD(f) abuf->fields.sfmt_add.f
+  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
+
+  {
+    SI opval = ORSI (* FLD (i_dr), * FLD (i_sr));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
+  }
 
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* xor3: xor3 $dr,$sr,$uimm16.  */
+/* or3: or3 $dr,$sr,$hash$ulo16 */
 
-CIA
-SEM_FN_NAME (m32rb,xor3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,or3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_and3.f
+#define FLD(f) abuf->fields.sfmt_and3.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
-    SI opval = XORSI (* FLD (f_r2), FLD (f_uimm16));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = ORSI (* FLD (i_sr), FLD (f_uimm16));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
+  return vpc;
+#undef FLD
+}
 
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
+/* xor: xor $dr,$sr */
+
+static SEM_PC
+SEM_FN_NAME (m32rbf,xor) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+{
+#define FLD(f) abuf->fields.sfmt_add.f
+  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
+
+  {
+    SI opval = XORSI (* FLD (i_dr), * FLD (i_sr));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
+  }
 
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* addi: addi $dr,$simm8.  */
+/* xor3: xor3 $dr,$sr,$uimm16 */
 
-CIA
-SEM_FN_NAME (m32rb,addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,xor3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_addi.f
+#define FLD(f) abuf->fields.sfmt_and3.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
-    SI opval = ADDSI (* FLD (f_r1), FLD (f_simm8));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = XORSI (* FLD (i_sr), FLD (f_uimm16));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
+  return vpc;
+#undef FLD
+}
 
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
+/* addi: addi $dr,$simm8 */
+
+static SEM_PC
+SEM_FN_NAME (m32rbf,addi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+{
+#define FLD(f) abuf->fields.sfmt_addi.f
+  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
-  return new_pc;
+  {
+    SI opval = ADDSI (* FLD (i_dr), FLD (f_simm8));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
+  }
+
+  return vpc;
 #undef FLD
 }
 
-/* addv: addv $dr,$sr */
+/* addv: addv $dr,$sr */
 
-CIA
-SEM_FN_NAME (m32rb,addv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,addv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_addv.f
+#define FLD(f) abuf->fields.sfmt_add.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
-do {
-  UBI temp1;SI temp0;
-  temp0 = ADDSI (* FLD (f_r1), * FLD (f_r2));
-  temp1 = ADDOFSI (* FLD (f_r1), * FLD (f_r2), 0);
+{
+  SI temp0;BI temp1;
+  temp0 = ADDSI (* FLD (i_dr), * FLD (i_sr));
+  temp1 = ADDOFSI (* FLD (i_dr), * FLD (i_sr), 0);
   {
     SI opval = temp0;
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
   {
-    UBI opval = temp1;
+    BI opval = temp1;
     CPU (h_cond) = opval;
-    TRACE_RESULT (current_cpu, "condbit", 'x', opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "cond", 'x', opval);
   }
-} while (0);
-
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
+}
 
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* addv3: addv3 $dr,$sr,$simm16 */
+/* addv3: addv3 $dr,$sr,$simm16 */
 
-CIA
-SEM_FN_NAME (m32rb,addv3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,addv3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_addv3.f
+#define FLD(f) abuf->fields.sfmt_add3.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
-do {
-  UBI temp1;SI temp0;
-  temp0 = ADDSI (* FLD (f_r2), FLD (f_simm16));
-  temp1 = ADDOFSI (* FLD (f_r2), FLD (f_simm16), 0);
+{
+  SI temp0;BI temp1;
+  temp0 = ADDSI (* FLD (i_sr), FLD (f_simm16));
+  temp1 = ADDOFSI (* FLD (i_sr), FLD (f_simm16), 0);
   {
     SI opval = temp0;
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
   {
-    UBI opval = temp1;
+    BI opval = temp1;
     CPU (h_cond) = opval;
-    TRACE_RESULT (current_cpu, "condbit", 'x', opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "cond", 'x', opval);
   }
-} while (0);
-
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
+}
 
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* addx: addx $dr,$sr */
+/* addx: addx $dr,$sr */
 
-CIA
-SEM_FN_NAME (m32rb,addx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,addx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_addx.f
+#define FLD(f) abuf->fields.sfmt_add.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
-do {
-  UBI temp1;SI temp0;
-  temp0 = ADDCSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond));
-  temp1 = ADDCFSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond));
+{
+  SI temp0;BI temp1;
+  temp0 = ADDCSI (* FLD (i_dr), * FLD (i_sr), CPU (h_cond));
+  temp1 = ADDCFSI (* FLD (i_dr), * FLD (i_sr), CPU (h_cond));
   {
     SI opval = temp0;
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
   {
-    UBI opval = temp1;
+    BI opval = temp1;
     CPU (h_cond) = opval;
-    TRACE_RESULT (current_cpu, "condbit", 'x', opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "cond", 'x', opval);
   }
-} while (0);
-
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
+}
 
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* bc8: bc.s $disp8 */
+/* bc8: bc.s $disp8 */
 
-CIA
-SEM_FN_NAME (m32rb,bc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,bc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_bc8.f
+#define FLD(f) abuf->fields.sfmt_bl8.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
-  int taken_p = 0;
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_BRANCH_INIT
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
 if (CPU (h_cond)) {
   {
-    USI opval = FLD (f_disp8);
-    BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval));
-    taken_p = 1;
-    TRACE_RESULT (current_cpu, "pc", 'x', opval);
+    USI opval = FLD (i_disp8);
+    SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
+    written |= (1 << 2);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
   }
 }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p);
-    }
-#endif
-
-  return new_pc;
+  abuf->written = written;
+  SEM_BRANCH_FINI (vpc);
+  return vpc;
 #undef FLD
 }
 
-/* bc24: bc.l $disp24 */
+/* bc24: bc.l $disp24 */
 
-CIA
-SEM_FN_NAME (m32rb,bc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,bc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_bc24.f
+#define FLD(f) abuf->fields.sfmt_bl24.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
-  int taken_p = 0;
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_BRANCH_INIT
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
 if (CPU (h_cond)) {
   {
-    USI opval = FLD (f_disp24);
-    BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval));
-    taken_p = 1;
-    TRACE_RESULT (current_cpu, "pc", 'x', opval);
+    USI opval = FLD (i_disp24);
+    SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
+    written |= (1 << 2);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
   }
 }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p);
-    }
-#endif
-
-  return new_pc;
+  abuf->written = written;
+  SEM_BRANCH_FINI (vpc);
+  return vpc;
 #undef FLD
 }
 
-/* beq: beq $src1,$src2,$disp16 */
+/* beq: beq $src1,$src2,$disp16 */
 
-CIA
-SEM_FN_NAME (m32rb,beq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,beq) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_beq.f
+#define FLD(f) abuf->fields.sfmt_beq.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
-  int taken_p = 0;
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_BRANCH_INIT
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
-if (EQSI (* FLD (f_r1), * FLD (f_r2))) {
+if (EQSI (* FLD (i_src1), * FLD (i_src2))) {
   {
-    USI opval = FLD (f_disp16);
-    BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval));
-    taken_p = 1;
-    TRACE_RESULT (current_cpu, "pc", 'x', opval);
+    USI opval = FLD (i_disp16);
+    SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
+    written |= (1 << 3);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
   }
 }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p);
-    }
-#endif
-
-  return new_pc;
+  abuf->written = written;
+  SEM_BRANCH_FINI (vpc);
+  return vpc;
 #undef FLD
 }
 
-/* beqz: beqz $src2,$disp16 */
+/* beqz: beqz $src2,$disp16 */
 
-CIA
-SEM_FN_NAME (m32rb,beqz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,beqz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_beqz.f
+#define FLD(f) abuf->fields.sfmt_beq.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
-  int taken_p = 0;
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_BRANCH_INIT
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
-if (EQSI (* FLD (f_r2), 0)) {
+if (EQSI (* FLD (i_src2), 0)) {
   {
-    USI opval = FLD (f_disp16);
-    BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval));
-    taken_p = 1;
-    TRACE_RESULT (current_cpu, "pc", 'x', opval);
+    USI opval = FLD (i_disp16);
+    SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
+    written |= (1 << 2);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
   }
 }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p);
-    }
-#endif
-
-  return new_pc;
+  abuf->written = written;
+  SEM_BRANCH_FINI (vpc);
+  return vpc;
 #undef FLD
 }
 
-/* bgez: bgez $src2,$disp16 */
+/* bgez: bgez $src2,$disp16 */
 
-CIA
-SEM_FN_NAME (m32rb,bgez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,bgez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_beqz.f
+#define FLD(f) abuf->fields.sfmt_beq.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
-  int taken_p = 0;
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_BRANCH_INIT
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
-if (GESI (* FLD (f_r2), 0)) {
+if (GESI (* FLD (i_src2), 0)) {
   {
-    USI opval = FLD (f_disp16);
-    BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval));
-    taken_p = 1;
-    TRACE_RESULT (current_cpu, "pc", 'x', opval);
+    USI opval = FLD (i_disp16);
+    SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
+    written |= (1 << 2);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
   }
 }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p);
-    }
-#endif
-
-  return new_pc;
+  abuf->written = written;
+  SEM_BRANCH_FINI (vpc);
+  return vpc;
 #undef FLD
 }
 
-/* bgtz: bgtz $src2,$disp16 */
+/* bgtz: bgtz $src2,$disp16 */
 
-CIA
-SEM_FN_NAME (m32rb,bgtz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,bgtz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_beqz.f
+#define FLD(f) abuf->fields.sfmt_beq.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
-  int taken_p = 0;
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_BRANCH_INIT
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
-if (GTSI (* FLD (f_r2), 0)) {
+if (GTSI (* FLD (i_src2), 0)) {
   {
-    USI opval = FLD (f_disp16);
-    BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval));
-    taken_p = 1;
-    TRACE_RESULT (current_cpu, "pc", 'x', opval);
+    USI opval = FLD (i_disp16);
+    SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
+    written |= (1 << 2);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
   }
 }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p);
-    }
-#endif
-
-  return new_pc;
+  abuf->written = written;
+  SEM_BRANCH_FINI (vpc);
+  return vpc;
 #undef FLD
 }
 
-/* blez: blez $src2,$disp16 */
+/* blez: blez $src2,$disp16 */
 
-CIA
-SEM_FN_NAME (m32rb,blez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,blez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_beqz.f
+#define FLD(f) abuf->fields.sfmt_beq.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
-  int taken_p = 0;
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_BRANCH_INIT
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
-if (LESI (* FLD (f_r2), 0)) {
+if (LESI (* FLD (i_src2), 0)) {
   {
-    USI opval = FLD (f_disp16);
-    BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval));
-    taken_p = 1;
-    TRACE_RESULT (current_cpu, "pc", 'x', opval);
+    USI opval = FLD (i_disp16);
+    SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
+    written |= (1 << 2);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
   }
 }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p);
-    }
-#endif
-
-  return new_pc;
+  abuf->written = written;
+  SEM_BRANCH_FINI (vpc);
+  return vpc;
 #undef FLD
 }
 
-/* bltz: bltz $src2,$disp16 */
+/* bltz: bltz $src2,$disp16 */
 
-CIA
-SEM_FN_NAME (m32rb,bltz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,bltz) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_beqz.f
+#define FLD(f) abuf->fields.sfmt_beq.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
-  int taken_p = 0;
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_BRANCH_INIT
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
-if (LTSI (* FLD (f_r2), 0)) {
+if (LTSI (* FLD (i_src2), 0)) {
   {
-    USI opval = FLD (f_disp16);
-    BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval));
-    taken_p = 1;
-    TRACE_RESULT (current_cpu, "pc", 'x', opval);
+    USI opval = FLD (i_disp16);
+    SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
+    written |= (1 << 2);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
   }
 }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p);
-    }
-#endif
-
-  return new_pc;
+  abuf->written = written;
+  SEM_BRANCH_FINI (vpc);
+  return vpc;
 #undef FLD
 }
 
-/* bnez: bnez $src2,$disp16 */
+/* bnez: bnez $src2,$disp16 */
 
-CIA
-SEM_FN_NAME (m32rb,bnez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,bnez) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_beqz.f
+#define FLD(f) abuf->fields.sfmt_beq.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
-  int taken_p = 0;
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_BRANCH_INIT
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
-if (NESI (* FLD (f_r2), 0)) {
+if (NESI (* FLD (i_src2), 0)) {
   {
-    USI opval = FLD (f_disp16);
-    BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval));
-    taken_p = 1;
-    TRACE_RESULT (current_cpu, "pc", 'x', opval);
+    USI opval = FLD (i_disp16);
+    SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
+    written |= (1 << 2);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
   }
 }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p);
-    }
-#endif
-
-  return new_pc;
+  abuf->written = written;
+  SEM_BRANCH_FINI (vpc);
+  return vpc;
 #undef FLD
 }
 
-/* bl8: bl.s $disp8 */
+/* bl8: bl.s $disp8 */
 
-CIA
-SEM_FN_NAME (m32rb,bl8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,bl8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_bl8.f
+#define FLD(f) abuf->fields.sfmt_bl8.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
-  int taken_p = 0;
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_BRANCH_INIT
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
-do {
+{
   {
-    SI opval = ADDSI (ANDSI (CPU (h_pc), -4), 4);
-    CPU (h_gr[((HOSTUINT) 14)]) = opval;
-    TRACE_RESULT (current_cpu, "gr-14", 'x', opval);
+    SI opval = ADDSI (ANDSI (pc, -4), 4);
+    CPU (h_gr[((UINT) 14)]) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
   {
-    USI opval = FLD (f_disp8);
-    BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval));
-    taken_p = 1;
-    TRACE_RESULT (current_cpu, "pc", 'x', opval);
+    USI opval = FLD (i_disp8);
+    SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
   }
-} while (0);
-
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p);
-    }
-#endif
+}
 
-  return new_pc;
+  SEM_BRANCH_FINI (vpc);
+  return vpc;
 #undef FLD
 }
 
-/* bl24: bl.l $disp24 */
+/* bl24: bl.l $disp24 */
 
-CIA
-SEM_FN_NAME (m32rb,bl24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,bl24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_bl24.f
+#define FLD(f) abuf->fields.sfmt_bl24.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
-  int taken_p = 0;
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_BRANCH_INIT
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
-do {
+{
   {
-    SI opval = ADDSI (CPU (h_pc), 4);
-    CPU (h_gr[((HOSTUINT) 14)]) = opval;
-    TRACE_RESULT (current_cpu, "gr-14", 'x', opval);
+    SI opval = ADDSI (pc, 4);
+    CPU (h_gr[((UINT) 14)]) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
   {
-    USI opval = FLD (f_disp24);
-    BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval));
-    taken_p = 1;
-    TRACE_RESULT (current_cpu, "pc", 'x', opval);
+    USI opval = FLD (i_disp24);
+    SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
   }
-} while (0);
-
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p);
-    }
-#endif
+}
 
-  return new_pc;
+  SEM_BRANCH_FINI (vpc);
+  return vpc;
 #undef FLD
 }
 
-/* bnc8: bnc.s $disp8 */
+/* bnc8: bnc.s $disp8 */
 
-CIA
-SEM_FN_NAME (m32rb,bnc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,bnc8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_bc8.f
+#define FLD(f) abuf->fields.sfmt_bl8.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
-  int taken_p = 0;
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_BRANCH_INIT
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
 if (NOTBI (CPU (h_cond))) {
   {
-    USI opval = FLD (f_disp8);
-    BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval));
-    taken_p = 1;
-    TRACE_RESULT (current_cpu, "pc", 'x', opval);
+    USI opval = FLD (i_disp8);
+    SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
+    written |= (1 << 2);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
   }
 }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p);
-    }
-#endif
-
-  return new_pc;
+  abuf->written = written;
+  SEM_BRANCH_FINI (vpc);
+  return vpc;
 #undef FLD
 }
 
-/* bnc24: bnc.l $disp24 */
+/* bnc24: bnc.l $disp24 */
 
-CIA
-SEM_FN_NAME (m32rb,bnc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,bnc24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_bc24.f
+#define FLD(f) abuf->fields.sfmt_bl24.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
-  int taken_p = 0;
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_BRANCH_INIT
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
 if (NOTBI (CPU (h_cond))) {
   {
-    USI opval = FLD (f_disp24);
-    BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval));
-    taken_p = 1;
-    TRACE_RESULT (current_cpu, "pc", 'x', opval);
+    USI opval = FLD (i_disp24);
+    SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
+    written |= (1 << 2);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
   }
 }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p);
-    }
-#endif
-
-  return new_pc;
+  abuf->written = written;
+  SEM_BRANCH_FINI (vpc);
+  return vpc;
 #undef FLD
 }
 
-/* bne: bne $src1,$src2,$disp16 */
+/* bne: bne $src1,$src2,$disp16 */
 
-CIA
-SEM_FN_NAME (m32rb,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,bne) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_beq.f
+#define FLD(f) abuf->fields.sfmt_beq.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
-  int taken_p = 0;
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_BRANCH_INIT
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
-if (NESI (* FLD (f_r1), * FLD (f_r2))) {
+if (NESI (* FLD (i_src1), * FLD (i_src2))) {
   {
-    USI opval = FLD (f_disp16);
-    BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval));
-    taken_p = 1;
-    TRACE_RESULT (current_cpu, "pc", 'x', opval);
+    USI opval = FLD (i_disp16);
+    SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
+    written |= (1 << 3);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
   }
 }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p);
-    }
-#endif
-
-  return new_pc;
+  abuf->written = written;
+  SEM_BRANCH_FINI (vpc);
+  return vpc;
 #undef FLD
 }
 
-/* bra8: bra.s $disp8 */
+/* bra8: bra.s $disp8 */
 
-CIA
-SEM_FN_NAME (m32rb,bra8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,bra8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_bra8.f
+#define FLD(f) abuf->fields.sfmt_bl8.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
-  int taken_p = 0;
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_BRANCH_INIT
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    USI opval = FLD (f_disp8);
-    BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval));
-    taken_p = 1;
-    TRACE_RESULT (current_cpu, "pc", 'x', opval);
+    USI opval = FLD (i_disp8);
+    SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p);
-    }
-#endif
-
-  return new_pc;
+  SEM_BRANCH_FINI (vpc);
+  return vpc;
 #undef FLD
 }
 
-/* bra24: bra.l $disp24 */
+/* bra24: bra.l $disp24 */
 
-CIA
-SEM_FN_NAME (m32rb,bra24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,bra24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_bra24.f
+#define FLD(f) abuf->fields.sfmt_bl24.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
-  int taken_p = 0;
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_BRANCH_INIT
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
-    USI opval = FLD (f_disp24);
-    BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_CACHE (sem_arg, opval));
-    taken_p = 1;
-    TRACE_RESULT (current_cpu, "pc", 'x', opval);
+    USI opval = FLD (i_disp24);
+    SEM_BRANCH_VIA_CACHE (current_cpu, sem_arg, opval, vpc);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p);
-    }
-#endif
-
-  return new_pc;
+  SEM_BRANCH_FINI (vpc);
+  return vpc;
 #undef FLD
 }
 
-/* cmp: cmp $src1,$src2 */
+/* cmp: cmp $src1,$src2 */
 
-CIA
-SEM_FN_NAME (m32rb,cmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,cmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_cmp.f
+#define FLD(f) abuf->fields.sfmt_st_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    UBI opval = LTSI (* FLD (f_r1), * FLD (f_r2));
+    BI opval = LTSI (* FLD (i_src1), * FLD (i_src2));
     CPU (h_cond) = opval;
-    TRACE_RESULT (current_cpu, "condbit", 'x', opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "cond", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* cmpi: cmpi $src2,$simm16 */
+/* cmpi: cmpi $src2,$simm16 */
 
-CIA
-SEM_FN_NAME (m32rb,cmpi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,cmpi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_cmpi.f
+#define FLD(f) abuf->fields.sfmt_st_d.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
-    UBI opval = LTSI (* FLD (f_r2), FLD (f_simm16));
+    BI opval = LTSI (* FLD (i_src2), FLD (f_simm16));
     CPU (h_cond) = opval;
-    TRACE_RESULT (current_cpu, "condbit", 'x', opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "cond", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* cmpu: cmpu $src1,$src2 */
+/* cmpu: cmpu $src1,$src2 */
 
-CIA
-SEM_FN_NAME (m32rb,cmpu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,cmpu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_cmp.f
+#define FLD(f) abuf->fields.sfmt_st_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    UBI opval = LTUSI (* FLD (f_r1), * FLD (f_r2));
+    BI opval = LTUSI (* FLD (i_src1), * FLD (i_src2));
     CPU (h_cond) = opval;
-    TRACE_RESULT (current_cpu, "condbit", 'x', opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "cond", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* cmpui: cmpui $src2,$simm16 */
+/* cmpui: cmpui $src2,$simm16 */
 
-CIA
-SEM_FN_NAME (m32rb,cmpui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,cmpui) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_cmpi.f
+#define FLD(f) abuf->fields.sfmt_st_d.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
-    UBI opval = LTUSI (* FLD (f_r2), FLD (f_simm16));
+    BI opval = LTUSI (* FLD (i_src2), FLD (f_simm16));
     CPU (h_cond) = opval;
-    TRACE_RESULT (current_cpu, "condbit", 'x', opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "cond", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* div: div $dr,$sr */
+/* div: div $dr,$sr */
 
-CIA
-SEM_FN_NAME (m32rb,div) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,div) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_div.f
+#define FLD(f) abuf->fields.sfmt_add.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
-if (NESI (* FLD (f_r2), 0)) {
+if (NESI (* FLD (i_sr), 0)) {
   {
-    SI opval = DIVSI (* FLD (f_r1), * FLD (f_r2));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = DIVSI (* FLD (i_dr), * FLD (i_sr));
+    * FLD (i_dr) = opval;
+    written |= (1 << 2);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  abuf->written = written;
+  return vpc;
 #undef FLD
 }
 
-/* divu: divu $dr,$sr */
+/* divu: divu $dr,$sr */
 
-CIA
-SEM_FN_NAME (m32rb,divu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,divu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_div.f
+#define FLD(f) abuf->fields.sfmt_add.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
-if (NESI (* FLD (f_r2), 0)) {
+if (NESI (* FLD (i_sr), 0)) {
   {
-    SI opval = UDIVSI (* FLD (f_r1), * FLD (f_r2));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = UDIVSI (* FLD (i_dr), * FLD (i_sr));
+    * FLD (i_dr) = opval;
+    written |= (1 << 2);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  abuf->written = written;
+  return vpc;
 #undef FLD
 }
 
-/* rem: rem $dr,$sr */
+/* rem: rem $dr,$sr */
 
-CIA
-SEM_FN_NAME (m32rb,rem) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,rem) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_div.f
+#define FLD(f) abuf->fields.sfmt_add.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
-if (NESI (* FLD (f_r2), 0)) {
+if (NESI (* FLD (i_sr), 0)) {
   {
-    SI opval = MODSI (* FLD (f_r1), * FLD (f_r2));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = MODSI (* FLD (i_dr), * FLD (i_sr));
+    * FLD (i_dr) = opval;
+    written |= (1 << 2);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  abuf->written = written;
+  return vpc;
 #undef FLD
 }
 
-/* remu: remu $dr,$sr */
+/* remu: remu $dr,$sr */
 
-CIA
-SEM_FN_NAME (m32rb,remu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,remu) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_div.f
+#define FLD(f) abuf->fields.sfmt_add.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
-if (NESI (* FLD (f_r2), 0)) {
+if (NESI (* FLD (i_sr), 0)) {
   {
-    SI opval = UMODSI (* FLD (f_r1), * FLD (f_r2));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = UMODSI (* FLD (i_dr), * FLD (i_sr));
+    * FLD (i_dr) = opval;
+    written |= (1 << 2);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  abuf->written = written;
+  return vpc;
 #undef FLD
 }
 
-/* jl: jl $sr */
+/* jl: jl $sr */
 
-CIA
-SEM_FN_NAME (m32rb,jl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,jl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_jl.f
+#define FLD(f) abuf->fields.sfmt_jl.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
-  int taken_p = 0;
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_BRANCH_INIT
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
-do {
-  USI temp1;SI temp0;
-  temp0 = ADDSI (ANDSI (CPU (h_pc), -4), 4);
-  temp1 = ANDSI (* FLD (f_r2), -4);
+{
+  SI temp0;USI temp1;
+  temp0 = ADDSI (ANDSI (pc, -4), 4);
+  temp1 = ANDSI (* FLD (i_sr), -4);
   {
     SI opval = temp0;
-    CPU (h_gr[((HOSTUINT) 14)]) = opval;
-    TRACE_RESULT (current_cpu, "gr-14", 'x', opval);
+    CPU (h_gr[((UINT) 14)]) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
   {
     USI opval = temp1;
-    BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval));
-    taken_p = 1;
-    TRACE_RESULT (current_cpu, "pc", 'x', opval);
+    SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
   }
-} while (0);
-
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p);
-    }
-#endif
+}
 
-  return new_pc;
+  SEM_BRANCH_FINI (vpc);
+  return vpc;
 #undef FLD
 }
 
-/* jmp: jmp $sr */
+/* jmp: jmp $sr */
 
-CIA
-SEM_FN_NAME (m32rb,jmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,jmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_jmp.f
+#define FLD(f) abuf->fields.sfmt_jl.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
-  int taken_p = 0;
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_BRANCH_INIT
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    USI opval = ANDSI (* FLD (f_r2), -4);
-    BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval));
-    taken_p = 1;
-    TRACE_RESULT (current_cpu, "pc", 'x', opval);
+    USI opval = ANDSI (* FLD (i_sr), -4);
+    SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p);
-    }
-#endif
-
-  return new_pc;
+  SEM_BRANCH_FINI (vpc);
+  return vpc;
 #undef FLD
 }
 
-/* ld: ld $dr,@$sr */
+/* ld: ld $dr,@$sr */
 
-CIA
-SEM_FN_NAME (m32rb,ld) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,ld) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_ld.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = GETMEMSI (current_cpu, * FLD (f_r2));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = GETMEMSI (current_cpu, pc, * FLD (i_sr));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* ld-d: ld $dr,@($slo16,$sr) */
+/* ld-d: ld $dr,@($slo16,$sr) */
 
-CIA
-SEM_FN_NAME (m32rb,ld_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,ld_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_ld_d.f
+#define FLD(f) abuf->fields.sfmt_add3.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
-    SI opval = GETMEMSI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = GETMEMSI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16)));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* ldb: ldb $dr,@$sr */
+/* ldb: ldb $dr,@$sr */
 
-CIA
-SEM_FN_NAME (m32rb,ldb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,ldb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_ldb.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = EXTQISI (GETMEMQI (current_cpu, * FLD (f_r2)));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = EXTQISI (GETMEMQI (current_cpu, pc, * FLD (i_sr)));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
+  return vpc;
+#undef FLD
+}
 
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
-#undef FLD
-}
+/* ldb-d: ldb $dr,@($slo16,$sr) */
 
-/* ldb-d: ldb $dr,@($slo16,$sr).  */
-
-CIA
-SEM_FN_NAME (m32rb,ldb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,ldb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_ldb_d.f
+#define FLD(f) abuf->fields.sfmt_add3.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
-    SI opval = EXTQISI (GETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = EXTQISI (GETMEMQI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16))));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* ldh: ldh $dr,@$sr */
+/* ldh: ldh $dr,@$sr */
 
-CIA
-SEM_FN_NAME (m32rb,ldh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,ldh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_ldh.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = EXTHISI (GETMEMHI (current_cpu, * FLD (f_r2)));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = EXTHISI (GETMEMHI (current_cpu, pc, * FLD (i_sr)));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* ldh-d: ldh $dr,@($slo16,$sr) */
+/* ldh-d: ldh $dr,@($slo16,$sr) */
 
-CIA
-SEM_FN_NAME (m32rb,ldh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,ldh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_ldh_d.f
+#define FLD(f) abuf->fields.sfmt_add3.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
-    SI opval = EXTHISI (GETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = EXTHISI (GETMEMHI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16))));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* ldub: ldub $dr,@$sr */
+/* ldub: ldub $dr,@$sr */
 
-CIA
-SEM_FN_NAME (m32rb,ldub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,ldub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_ldb.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = ZEXTQISI (GETMEMQI (current_cpu, * FLD (f_r2)));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = ZEXTQISI (GETMEMQI (current_cpu, pc, * FLD (i_sr)));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* ldub-d: ldub $dr,@($slo16,$sr) */
+/* ldub-d: ldub $dr,@($slo16,$sr) */
 
-CIA
-SEM_FN_NAME (m32rb,ldub_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,ldub_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_ldb_d.f
+#define FLD(f) abuf->fields.sfmt_add3.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
-    SI opval = ZEXTQISI (GETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = ZEXTQISI (GETMEMQI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16))));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* lduh: lduh $dr,@$sr */
+/* lduh: lduh $dr,@$sr */
 
-CIA
-SEM_FN_NAME (m32rb,lduh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,lduh) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_ldh.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = ZEXTHISI (GETMEMHI (current_cpu, * FLD (f_r2)));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = ZEXTHISI (GETMEMHI (current_cpu, pc, * FLD (i_sr)));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* lduh-d: lduh $dr,@($slo16,$sr) */
+/* lduh-d: lduh $dr,@($slo16,$sr) */
 
-CIA
-SEM_FN_NAME (m32rb,lduh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,lduh_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_ldh_d.f
+#define FLD(f) abuf->fields.sfmt_add3.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
-    SI opval = ZEXTHISI (GETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16))));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = ZEXTHISI (GETMEMHI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16))));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* ld-plus: ld $dr,@$sr+ */
+/* ld-plus: ld $dr,@$sr+ */
 
-CIA
-SEM_FN_NAME (m32rb,ld_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,ld_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_ld_plus.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
-do {
-  SI temp1;SI temp0;
-  temp0 = GETMEMSI (current_cpu, * FLD (f_r2));
-  temp1 = ADDSI (* FLD (f_r2), 4);
+{
+  SI temp0;SI temp1;
+  temp0 = GETMEMSI (current_cpu, pc, * FLD (i_sr));
+  temp1 = ADDSI (* FLD (i_sr), 4);
   {
     SI opval = temp0;
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
   {
     SI opval = temp1;
-    * FLD (f_r2) = opval;
-    TRACE_RESULT (current_cpu, "sr", 'x', opval);
+    * FLD (i_sr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
-} while (0);
-
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
+}
 
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* ld24: ld24 $dr,$uimm24 */
+/* ld24: ld24 $dr,$uimm24 */
 
-CIA
-SEM_FN_NAME (m32rb,ld24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,ld24) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_ld24.f
+#define FLD(f) abuf->fields.sfmt_ld24.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
-    SI opval = FLD (f_uimm24);
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = FLD (i_uimm24);
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* ldi8: ldi8 $dr,$simm8 */
+/* ldi8: ldi8 $dr,$simm8 */
 
-CIA
-SEM_FN_NAME (m32rb,ldi8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,ldi8) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_ldi8.f
+#define FLD(f) abuf->fields.sfmt_addi.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
     SI opval = FLD (f_simm8);
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* ldi16: ldi16 $dr,$hash$slo16 */
+/* ldi16: ldi16 $dr,$hash$slo16 */
 
-CIA
-SEM_FN_NAME (m32rb,ldi16) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,ldi16) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_ldi16.f
+#define FLD(f) abuf->fields.sfmt_add3.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
     SI opval = FLD (f_simm16);
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* lock: lock $dr,@$sr */
+/* lock: lock $dr,@$sr */
 
-CIA
-SEM_FN_NAME (m32rb,lock) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,lock) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_lock.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
-do {
+{
   {
-    UBI opval = 1;
+    BI opval = 1;
     CPU (h_lock) = opval;
-    TRACE_RESULT (current_cpu, "lock-0", 'x', opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "lock", 'x', opval);
   }
   {
-    SI opval = GETMEMSI (current_cpu, * FLD (f_r2));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = GETMEMSI (current_cpu, pc, * FLD (i_sr));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
-} while (0);
-
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
+}
 
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* machi: machi $src1,$src2 */
+/* machi: machi $src1,$src2 */
 
-CIA
-SEM_FN_NAME (m32rb,machi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,machi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_machi.f
+#define FLD(f) abuf->fields.sfmt_st_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    DI opval = SRADI (SLLDI (ADDDI (m32rb_h_accum_get (current_cpu), MULDI (EXTSIDI (ANDSI (* FLD (f_r1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16))))), 8), 8);
-    m32rb_h_accum_set (current_cpu, opval);
-    TRACE_RESULT (current_cpu, "accum", 'D', opval);
+    DI opval = SRADI (SLLDI (ADDDI (GET_H_ACCUM (), MULDI (EXTSIDI (ANDSI (* FLD (i_src1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2), 16))))), 8), 8);
+    SET_H_ACCUM (opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* maclo: maclo $src1,$src2 */
+/* maclo: maclo $src1,$src2 */
 
-CIA
-SEM_FN_NAME (m32rb,maclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,maclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_machi.f
+#define FLD(f) abuf->fields.sfmt_st_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    DI opval = SRADI (SLLDI (ADDDI (m32rb_h_accum_get (current_cpu), MULDI (EXTSIDI (SLLSI (* FLD (f_r1), 16)), EXTHIDI (TRUNCSIHI (* FLD (f_r2))))), 8), 8);
-    m32rb_h_accum_set (current_cpu, opval);
-    TRACE_RESULT (current_cpu, "accum", 'D', opval);
+    DI opval = SRADI (SLLDI (ADDDI (GET_H_ACCUM (), MULDI (EXTSIDI (SLLSI (* FLD (i_src1), 16)), EXTHIDI (TRUNCSIHI (* FLD (i_src2))))), 8), 8);
+    SET_H_ACCUM (opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* macwhi: macwhi $src1,$src2 */
+/* macwhi: macwhi $src1,$src2 */
 
-CIA
-SEM_FN_NAME (m32rb,macwhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,macwhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_machi.f
+#define FLD(f) abuf->fields.sfmt_st_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    DI opval = SRADI (SLLDI (ADDDI (m32rb_h_accum_get (current_cpu), MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16))))), 8), 8);
-    m32rb_h_accum_set (current_cpu, opval);
-    TRACE_RESULT (current_cpu, "accum", 'D', opval);
+    DI opval = SRADI (SLLDI (ADDDI (GET_H_ACCUM (), MULDI (EXTSIDI (* FLD (i_src1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2), 16))))), 8), 8);
+    SET_H_ACCUM (opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* macwlo: macwlo $src1,$src2 */
+/* macwlo: macwlo $src1,$src2 */
 
-CIA
-SEM_FN_NAME (m32rb,macwlo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,macwlo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_machi.f
+#define FLD(f) abuf->fields.sfmt_st_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    DI opval = SRADI (SLLDI (ADDDI (m32rb_h_accum_get (current_cpu), MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (* FLD (f_r2))))), 8), 8);
-    m32rb_h_accum_set (current_cpu, opval);
-    TRACE_RESULT (current_cpu, "accum", 'D', opval);
+    DI opval = SRADI (SLLDI (ADDDI (GET_H_ACCUM (), MULDI (EXTSIDI (* FLD (i_src1)), EXTHIDI (TRUNCSIHI (* FLD (i_src2))))), 8), 8);
+    SET_H_ACCUM (opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* mul: mul $dr,$sr */
+/* mul: mul $dr,$sr */
 
-CIA
-SEM_FN_NAME (m32rb,mul) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,mul) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_add.f
+#define FLD(f) abuf->fields.sfmt_add.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = MULSI (* FLD (f_r1), * FLD (f_r2));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = MULSI (* FLD (i_dr), * FLD (i_sr));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* mulhi: mulhi $src1,$src2 */
+/* mulhi: mulhi $src1,$src2 */
 
-CIA
-SEM_FN_NAME (m32rb,mulhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,mulhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_mulhi.f
+#define FLD(f) abuf->fields.sfmt_st_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    DI opval = SRADI (SLLDI (MULDI (EXTSIDI (ANDSI (* FLD (f_r1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16)))), 16), 16);
-    m32rb_h_accum_set (current_cpu, opval);
-    TRACE_RESULT (current_cpu, "accum", 'D', opval);
+    DI opval = SRADI (SLLDI (MULDI (EXTSIDI (ANDSI (* FLD (i_src1), 0xffff0000)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2), 16)))), 16), 16);
+    SET_H_ACCUM (opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* mullo: mullo $src1,$src2 */
+/* mullo: mullo $src1,$src2 */
 
-CIA
-SEM_FN_NAME (m32rb,mullo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,mullo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_mulhi.f
+#define FLD(f) abuf->fields.sfmt_st_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    DI opval = SRADI (SLLDI (MULDI (EXTSIDI (SLLSI (* FLD (f_r1), 16)), EXTHIDI (TRUNCSIHI (* FLD (f_r2)))), 16), 16);
-    m32rb_h_accum_set (current_cpu, opval);
-    TRACE_RESULT (current_cpu, "accum", 'D', opval);
+    DI opval = SRADI (SLLDI (MULDI (EXTSIDI (SLLSI (* FLD (i_src1), 16)), EXTHIDI (TRUNCSIHI (* FLD (i_src2)))), 16), 16);
+    SET_H_ACCUM (opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* mulwhi: mulwhi $src1,$src2 */
+/* mulwhi: mulwhi $src1,$src2 */
 
-CIA
-SEM_FN_NAME (m32rb,mulwhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,mulwhi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_mulhi.f
+#define FLD(f) abuf->fields.sfmt_st_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    DI opval = SRADI (SLLDI (MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (f_r2), 16)))), 8), 8);
-    m32rb_h_accum_set (current_cpu, opval);
-    TRACE_RESULT (current_cpu, "accum", 'D', opval);
+    DI opval = SRADI (SLLDI (MULDI (EXTSIDI (* FLD (i_src1)), EXTHIDI (TRUNCSIHI (SRASI (* FLD (i_src2), 16)))), 8), 8);
+    SET_H_ACCUM (opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* mulwlo: mulwlo $src1,$src2 */
+/* mulwlo: mulwlo $src1,$src2 */
 
-CIA
-SEM_FN_NAME (m32rb,mulwlo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,mulwlo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_mulhi.f
+#define FLD(f) abuf->fields.sfmt_st_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    DI opval = SRADI (SLLDI (MULDI (EXTSIDI (* FLD (f_r1)), EXTHIDI (TRUNCSIHI (* FLD (f_r2)))), 8), 8);
-    m32rb_h_accum_set (current_cpu, opval);
-    TRACE_RESULT (current_cpu, "accum", 'D', opval);
+    DI opval = SRADI (SLLDI (MULDI (EXTSIDI (* FLD (i_src1)), EXTHIDI (TRUNCSIHI (* FLD (i_src2)))), 8), 8);
+    SET_H_ACCUM (opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* mv: mv $dr,$sr */
+/* mv: mv $dr,$sr */
 
-CIA
-SEM_FN_NAME (m32rb,mv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,mv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_mv.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = * FLD (f_r2);
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = * FLD (i_sr);
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* mvfachi: mvfachi $dr */
+/* mvfachi: mvfachi $dr */
 
-CIA
-SEM_FN_NAME (m32rb,mvfachi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,mvfachi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_mvfachi.f
+#define FLD(f) abuf->fields.sfmt_seth.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = TRUNCDISI (SRADI (m32rb_h_accum_get (current_cpu), 32));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = TRUNCDISI (SRADI (GET_H_ACCUM (), 32));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* mvfaclo: mvfaclo $dr */
+/* mvfaclo: mvfaclo $dr */
 
-CIA
-SEM_FN_NAME (m32rb,mvfaclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,mvfaclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_mvfachi.f
+#define FLD(f) abuf->fields.sfmt_seth.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = TRUNCDISI (m32rb_h_accum_get (current_cpu));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = TRUNCDISI (GET_H_ACCUM ());
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* mvfacmi: mvfacmi $dr */
+/* mvfacmi: mvfacmi $dr */
 
-CIA
-SEM_FN_NAME (m32rb,mvfacmi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,mvfacmi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_mvfachi.f
+#define FLD(f) abuf->fields.sfmt_seth.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = TRUNCDISI (SRADI (m32rb_h_accum_get (current_cpu), 16));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = TRUNCDISI (SRADI (GET_H_ACCUM (), 16));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* mvfc: mvfc $dr,$scr */
+/* mvfc: mvfc $dr,$scr */
 
-CIA
-SEM_FN_NAME (m32rb,mvfc) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,mvfc) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_mvfc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = m32rb_h_cr_get (current_cpu, FLD (f_r2));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = GET_H_CR (FLD (f_r2));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* mvtachi: mvtachi $src1 */
+/* mvtachi: mvtachi $src1 */
 
-CIA
-SEM_FN_NAME (m32rb,mvtachi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,mvtachi) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_mvtachi.f
+#define FLD(f) abuf->fields.sfmt_st_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    DI opval = ORDI (ANDDI (m32rb_h_accum_get (current_cpu), MAKEDI (0, 0xffffffff)), SLLDI (EXTSIDI (* FLD (f_r1)), 32));
-    m32rb_h_accum_set (current_cpu, opval);
-    TRACE_RESULT (current_cpu, "accum", 'D', opval);
+    DI opval = ORDI (ANDDI (GET_H_ACCUM (), MAKEDI (0, 0xffffffff)), SLLDI (EXTSIDI (* FLD (i_src1)), 32));
+    SET_H_ACCUM (opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* mvtaclo: mvtaclo $src1 */
+/* mvtaclo: mvtaclo $src1 */
 
-CIA
-SEM_FN_NAME (m32rb,mvtaclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,mvtaclo) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_mvtachi.f
+#define FLD(f) abuf->fields.sfmt_st_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    DI opval = ORDI (ANDDI (m32rb_h_accum_get (current_cpu), MAKEDI (0xffffffff, 0)), ZEXTSIDI (* FLD (f_r1)));
-    m32rb_h_accum_set (current_cpu, opval);
-    TRACE_RESULT (current_cpu, "accum", 'D', opval);
+    DI opval = ORDI (ANDDI (GET_H_ACCUM (), MAKEDI (0xffffffff, 0)), ZEXTSIDI (* FLD (i_src1)));
+    SET_H_ACCUM (opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* mvtc: mvtc $sr,$dcr */
+/* mvtc: mvtc $sr,$dcr */
 
-CIA
-SEM_FN_NAME (m32rb,mvtc) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,mvtc) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    USI opval = * FLD (f_r2);
-    m32rb_h_cr_set (current_cpu, FLD (f_r1), opval);
-    TRACE_RESULT (current_cpu, "dcr", 'x', opval);
+    USI opval = * FLD (i_sr);
+    SET_H_CR (FLD (f_r1), opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "cr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* neg: neg $dr,$sr */
+/* neg: neg $dr,$sr */
 
-CIA
-SEM_FN_NAME (m32rb,neg) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,neg) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_mv.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = NEGSI (* FLD (f_r2));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = NEGSI (* FLD (i_sr));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* nop: nop */
+/* nop: nop */
 
-CIA
-SEM_FN_NAME (m32rb,nop) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,nop) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_nop.f
+#define FLD(f) abuf->fields.sfmt_empty.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
 PROFILE_COUNT_FILLNOPS (current_cpu, abuf->addr);
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* not: not $dr,$sr */
+/* not: not $dr,$sr */
 
-CIA
-SEM_FN_NAME (m32rb,not) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,not) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_mv.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = INVSI (* FLD (f_r2));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = INVSI (* FLD (i_sr));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* rac: rac */
+/* rac: rac */
 
-CIA
-SEM_FN_NAME (m32rb,rac) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,rac) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_rac.f
+#define FLD(f) abuf->fields.sfmt_empty.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
-do {
+{
   DI tmp_tmp1;
-  tmp_tmp1 = SLLDI (m32rb_h_accum_get (current_cpu), 1);
+  tmp_tmp1 = SLLDI (GET_H_ACCUM (), 1);
   tmp_tmp1 = ADDDI (tmp_tmp1, MAKEDI (0, 32768));
   {
     DI opval = (GTDI (tmp_tmp1, MAKEDI (32767, 0xffff0000))) ? (MAKEDI (32767, 0xffff0000)) : (LTDI (tmp_tmp1, MAKEDI (0xffff8000, 0))) ? (MAKEDI (0xffff8000, 0)) : (ANDDI (tmp_tmp1, MAKEDI (0xffffffff, 0xffff0000)));
-    m32rb_h_accum_set (current_cpu, opval);
-    TRACE_RESULT (current_cpu, "accum", 'D', opval);
+    SET_H_ACCUM (opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
   }
-} while (0);
-
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
+}
 
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* rach: rach */
+/* rach: rach */
 
-CIA
-SEM_FN_NAME (m32rb,rach) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,rach) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_rac.f
+#define FLD(f) abuf->fields.sfmt_empty.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
-do {
+{
   DI tmp_tmp1;
-  tmp_tmp1 = ANDDI (m32rb_h_accum_get (current_cpu), MAKEDI (16777215, 0xffffffff));
+  tmp_tmp1 = ANDDI (GET_H_ACCUM (), MAKEDI (16777215, 0xffffffff));
 if (ANDIF (GEDI (tmp_tmp1, MAKEDI (16383, 0x80000000)), LEDI (tmp_tmp1, MAKEDI (8388607, 0xffffffff)))) {
   tmp_tmp1 = MAKEDI (16383, 0x80000000);
 } else {
 if (ANDIF (GEDI (tmp_tmp1, MAKEDI (8388608, 0)), LEDI (tmp_tmp1, MAKEDI (16760832, 0)))) {
   tmp_tmp1 = MAKEDI (16760832, 0);
 } else {
-  tmp_tmp1 = ANDDI (ADDDI (m32rb_h_accum_get (current_cpu), MAKEDI (0, 1073741824)), MAKEDI (0xffffffff, 0x80000000));
+  tmp_tmp1 = ANDDI (ADDDI (GET_H_ACCUM (), MAKEDI (0, 1073741824)), MAKEDI (0xffffffff, 0x80000000));
 }
 }
   tmp_tmp1 = SLLDI (tmp_tmp1, 1);
   {
     DI opval = SRADI (SLLDI (tmp_tmp1, 7), 7);
-    m32rb_h_accum_set (current_cpu, opval);
-    TRACE_RESULT (current_cpu, "accum", 'D', opval);
+    SET_H_ACCUM (opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "accum", 'D', opval);
   }
-} while (0);
-
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
+}
 
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* rte: rte */
+/* rte: rte */
 
-CIA
-SEM_FN_NAME (m32rb,rte) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,rte) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_rte.f
+#define FLD(f) abuf->fields.sfmt_empty.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
-  int taken_p = 0;
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_BRANCH_INIT
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
-do {
+{
   {
-    UBI opval = CPU (h_bsm);
-    CPU (h_sm) = opval;
-    TRACE_RESULT (current_cpu, "sm-0", 'x', opval);
+    USI opval = ANDSI (GET_H_CR (((UINT) 6)), -4);
+    SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
   }
   {
-    UBI opval = CPU (h_bie);
-    CPU (h_ie) = opval;
-    TRACE_RESULT (current_cpu, "ie-0", 'x', opval);
+    USI opval = GET_H_CR (((UINT) 14));
+    SET_H_CR (((UINT) 6), opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "cr", 'x', opval);
   }
   {
-    UBI opval = CPU (h_bcond);
-    CPU (h_cond) = opval;
-    TRACE_RESULT (current_cpu, "condbit", 'x', opval);
+    UQI opval = CPU (h_bpsw);
+    SET_H_PSW (opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "psw", 'x', opval);
   }
   {
-    USI opval = ANDSI (CPU (h_bpc), -4);
-    BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval));
-    taken_p = 1;
-    TRACE_RESULT (current_cpu, "pc", 'x', opval);
+    UQI opval = CPU (h_bbpsw);
+    CPU (h_bpsw) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "bpsw", 'x', opval);
   }
-} while (0);
-
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p);
-    }
-#endif
+}
 
-  return new_pc;
+  SEM_BRANCH_FINI (vpc);
+  return vpc;
 #undef FLD
 }
 
-/* seth: seth $dr,$hash$hi16 */
+/* seth: seth $dr,$hash$hi16 */
 
-CIA
-SEM_FN_NAME (m32rb,seth) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,seth) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_seth.f
+#define FLD(f) abuf->fields.sfmt_seth.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
     SI opval = SLLSI (FLD (f_hi16), 16);
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* sll: sll $dr,$sr */
+/* sll: sll $dr,$sr */
 
-CIA
-SEM_FN_NAME (m32rb,sll) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,sll) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_add.f
+#define FLD(f) abuf->fields.sfmt_add.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = SLLSI (* FLD (f_r1), ANDSI (* FLD (f_r2), 31));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = SLLSI (* FLD (i_dr), ANDSI (* FLD (i_sr), 31));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* sll3: sll3 $dr,$sr,$simm16 */
+/* sll3: sll3 $dr,$sr,$simm16 */
 
-CIA
-SEM_FN_NAME (m32rb,sll3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,sll3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_sll3.f
+#define FLD(f) abuf->fields.sfmt_add3.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
-    SI opval = SLLSI (* FLD (f_r2), ANDSI (FLD (f_simm16), 31));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = SLLSI (* FLD (i_sr), ANDSI (FLD (f_simm16), 31));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* slli: slli $dr,$uimm5 */
+/* slli: slli $dr,$uimm5 */
 
-CIA
-SEM_FN_NAME (m32rb,slli) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,slli) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_slli.f
+#define FLD(f) abuf->fields.sfmt_slli.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = SLLSI (* FLD (f_r1), FLD (f_uimm5));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = SLLSI (* FLD (i_dr), FLD (f_uimm5));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* sra: sra $dr,$sr */
+/* sra: sra $dr,$sr */
 
-CIA
-SEM_FN_NAME (m32rb,sra) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,sra) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_add.f
+#define FLD(f) abuf->fields.sfmt_add.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = SRASI (* FLD (f_r1), ANDSI (* FLD (f_r2), 31));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = SRASI (* FLD (i_dr), ANDSI (* FLD (i_sr), 31));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* sra3: sra3 $dr,$sr,$simm16 */
+/* sra3: sra3 $dr,$sr,$simm16 */
 
-CIA
-SEM_FN_NAME (m32rb,sra3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,sra3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_sll3.f
+#define FLD(f) abuf->fields.sfmt_add3.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
-    SI opval = SRASI (* FLD (f_r2), ANDSI (FLD (f_simm16), 31));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = SRASI (* FLD (i_sr), ANDSI (FLD (f_simm16), 31));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* srai: srai $dr,$uimm5 */
+/* srai: srai $dr,$uimm5 */
 
-CIA
-SEM_FN_NAME (m32rb,srai) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,srai) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_slli.f
+#define FLD(f) abuf->fields.sfmt_slli.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = SRASI (* FLD (f_r1), FLD (f_uimm5));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = SRASI (* FLD (i_dr), FLD (f_uimm5));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* srl: srl $dr,$sr */
+/* srl: srl $dr,$sr */
 
-CIA
-SEM_FN_NAME (m32rb,srl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,srl) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_add.f
+#define FLD(f) abuf->fields.sfmt_add.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = SRLSI (* FLD (f_r1), ANDSI (* FLD (f_r2), 31));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = SRLSI (* FLD (i_dr), ANDSI (* FLD (i_sr), 31));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* srl3: srl3 $dr,$sr,$simm16 */
+/* srl3: srl3 $dr,$sr,$simm16 */
 
-CIA
-SEM_FN_NAME (m32rb,srl3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,srl3) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_sll3.f
+#define FLD(f) abuf->fields.sfmt_add3.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
-    SI opval = SRLSI (* FLD (f_r2), ANDSI (FLD (f_simm16), 31));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = SRLSI (* FLD (i_sr), ANDSI (FLD (f_simm16), 31));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* srli: srli $dr,$uimm5 */
+/* srli: srli $dr,$uimm5 */
 
-CIA
-SEM_FN_NAME (m32rb,srli) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,srli) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_slli.f
+#define FLD(f) abuf->fields.sfmt_slli.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = SRLSI (* FLD (f_r1), FLD (f_uimm5));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = SRLSI (* FLD (i_dr), FLD (f_uimm5));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* st: st $src1,@$src2 */
+/* st: st $src1,@$src2 */
 
-CIA
-SEM_FN_NAME (m32rb,st) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,st) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_st.f
+#define FLD(f) abuf->fields.sfmt_st_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = * FLD (f_r1);
-    SETMEMSI (current_cpu, * FLD (f_r2), opval);
-    TRACE_RESULT (current_cpu, "memory", 'x', opval);
+    SI opval = * FLD (i_src1);
+    SETMEMSI (current_cpu, pc, * FLD (i_src2), opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* st-d: st $src1,@($slo16,$src2) */
+/* st-d: st $src1,@($slo16,$src2) */
 
-CIA
-SEM_FN_NAME (m32rb,st_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,st_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_st_d.f
+#define FLD(f) abuf->fields.sfmt_st_d.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
-    SI opval = * FLD (f_r1);
-    SETMEMSI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), opval);
-    TRACE_RESULT (current_cpu, "memory", 'x', opval);
+    SI opval = * FLD (i_src1);
+    SETMEMSI (current_cpu, pc, ADDSI (* FLD (i_src2), FLD (f_simm16)), opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* stb: stb $src1,@$src2 */
+/* stb: stb $src1,@$src2 */
 
-CIA
-SEM_FN_NAME (m32rb,stb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,stb) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_stb.f
+#define FLD(f) abuf->fields.sfmt_st_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    QI opval = * FLD (f_r1);
-    SETMEMQI (current_cpu, * FLD (f_r2), opval);
-    TRACE_RESULT (current_cpu, "memory", 'x', opval);
+    QI opval = * FLD (i_src1);
+    SETMEMQI (current_cpu, pc, * FLD (i_src2), opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* stb-d: stb $src1,@($slo16,$src2) */
+/* stb-d: stb $src1,@($slo16,$src2) */
 
-CIA
-SEM_FN_NAME (m32rb,stb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,stb_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_stb_d.f
+#define FLD(f) abuf->fields.sfmt_st_d.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
-    QI opval = * FLD (f_r1);
-    SETMEMQI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), opval);
-    TRACE_RESULT (current_cpu, "memory", 'x', opval);
+    QI opval = * FLD (i_src1);
+    SETMEMQI (current_cpu, pc, ADDSI (* FLD (i_src2), FLD (f_simm16)), opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* sth: sth $src1,@$src2 */
+/* sth: sth $src1,@$src2 */
 
-CIA
-SEM_FN_NAME (m32rb,sth) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,sth) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_sth.f
+#define FLD(f) abuf->fields.sfmt_st_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    HI opval = * FLD (f_r1);
-    SETMEMHI (current_cpu, * FLD (f_r2), opval);
-    TRACE_RESULT (current_cpu, "memory", 'x', opval);
+    HI opval = * FLD (i_src1);
+    SETMEMHI (current_cpu, pc, * FLD (i_src2), opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* sth-d: sth $src1,@($slo16,$src2) */
+/* sth-d: sth $src1,@($slo16,$src2) */
 
-CIA
-SEM_FN_NAME (m32rb,sth_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,sth_d) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_sth_d.f
+#define FLD(f) abuf->fields.sfmt_st_d.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 4);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
 
   {
-    HI opval = * FLD (f_r1);
-    SETMEMHI (current_cpu, ADDSI (* FLD (f_r2), FLD (f_simm16)), opval);
-    TRACE_RESULT (current_cpu, "memory", 'x', opval);
+    HI opval = * FLD (i_src1);
+    SETMEMHI (current_cpu, pc, ADDSI (* FLD (i_src2), FLD (f_simm16)), opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* st-plus: st $src1,@+$src2 */
+/* st-plus: st $src1,@+$src2 */
 
-CIA
-SEM_FN_NAME (m32rb,st_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,st_plus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_st_plus.f
+#define FLD(f) abuf->fields.sfmt_st_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
-do {
+{
   SI tmp_new_src2;
-  tmp_new_src2 = ADDSI (* FLD (f_r2), 4);
+  tmp_new_src2 = ADDSI (* FLD (i_src2), 4);
   {
-    SI opval = * FLD (f_r1);
-    SETMEMSI (current_cpu, tmp_new_src2, opval);
-    TRACE_RESULT (current_cpu, "memory", 'x', opval);
+    SI opval = * FLD (i_src1);
+    SETMEMSI (current_cpu, pc, tmp_new_src2, opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
   }
   {
     SI opval = tmp_new_src2;
-    * FLD (f_r2) = opval;
-    TRACE_RESULT (current_cpu, "src2", 'x', opval);
+    * FLD (i_src2) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
-} while (0);
-
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
+}
 
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* st-minus: st $src1,@-$src2 */
+/* st-minus: st $src1,@-$src2 */
 
-CIA
-SEM_FN_NAME (m32rb,st_minus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,st_minus) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_st_plus.f
+#define FLD(f) abuf->fields.sfmt_st_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
-do {
+{
   SI tmp_new_src2;
-  tmp_new_src2 = SUBSI (* FLD (f_r2), 4);
+  tmp_new_src2 = SUBSI (* FLD (i_src2), 4);
   {
-    SI opval = * FLD (f_r1);
-    SETMEMSI (current_cpu, tmp_new_src2, opval);
-    TRACE_RESULT (current_cpu, "memory", 'x', opval);
+    SI opval = * FLD (i_src1);
+    SETMEMSI (current_cpu, pc, tmp_new_src2, opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
   }
   {
     SI opval = tmp_new_src2;
-    * FLD (f_r2) = opval;
-    TRACE_RESULT (current_cpu, "src2", 'x', opval);
+    * FLD (i_src2) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
-} while (0);
-
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
+}
 
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* sub: sub $dr,$sr */
+/* sub: sub $dr,$sr */
 
-CIA
-SEM_FN_NAME (m32rb,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,sub) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_add.f
+#define FLD(f) abuf->fields.sfmt_add.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
   {
-    SI opval = SUBSI (* FLD (f_r1), * FLD (f_r2));
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    SI opval = SUBSI (* FLD (i_dr), * FLD (i_sr));
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
-
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* subv: subv $dr,$sr */
+/* subv: subv $dr,$sr */
 
-CIA
-SEM_FN_NAME (m32rb,subv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,subv) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_addv.f
+#define FLD(f) abuf->fields.sfmt_add.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
-do {
-  UBI temp1;SI temp0;
-  temp0 = SUBSI (* FLD (f_r1), * FLD (f_r2));
-  temp1 = SUBOFSI (* FLD (f_r1), * FLD (f_r2), 0);
+{
+  SI temp0;BI temp1;
+  temp0 = SUBSI (* FLD (i_dr), * FLD (i_sr));
+  temp1 = SUBOFSI (* FLD (i_dr), * FLD (i_sr), 0);
   {
     SI opval = temp0;
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
   {
-    UBI opval = temp1;
+    BI opval = temp1;
     CPU (h_cond) = opval;
-    TRACE_RESULT (current_cpu, "condbit", 'x', opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "cond", 'x', opval);
   }
-} while (0);
-
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
+}
 
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* subx: subx $dr,$sr */
+/* subx: subx $dr,$sr */
 
-CIA
-SEM_FN_NAME (m32rb,subx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,subx) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_addx.f
+#define FLD(f) abuf->fields.sfmt_add.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
-do {
-  UBI temp1;SI temp0;
-  temp0 = SUBCSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond));
-  temp1 = SUBCFSI (* FLD (f_r1), * FLD (f_r2), CPU (h_cond));
+{
+  SI temp0;BI temp1;
+  temp0 = SUBCSI (* FLD (i_dr), * FLD (i_sr), CPU (h_cond));
+  temp1 = SUBCFSI (* FLD (i_dr), * FLD (i_sr), CPU (h_cond));
   {
     SI opval = temp0;
-    * FLD (f_r1) = opval;
-    TRACE_RESULT (current_cpu, "dr", 'x', opval);
+    * FLD (i_dr) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval);
   }
   {
-    UBI opval = temp1;
+    BI opval = temp1;
     CPU (h_cond) = opval;
-    TRACE_RESULT (current_cpu, "condbit", 'x', opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "cond", 'x', opval);
   }
-} while (0);
-
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_mark_set_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
+}
 
-  return new_pc;
+  return vpc;
 #undef FLD
 }
 
-/* trap: trap $uimm4 */
+/* trap: trap $uimm4 */
 
-CIA
-SEM_FN_NAME (m32rb,trap) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,trap) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_trap.f
+#define FLD(f) abuf->fields.sfmt_trap.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
-  int taken_p = 0;
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_BRANCH_INIT
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
-do {
+{
   {
-    USI opval = ADDSI (CPU (h_pc), 4);
-    m32rb_h_cr_set (current_cpu, ((HOSTUINT) 6), opval);
-    TRACE_RESULT (current_cpu, "cr-6", 'x', opval);
+    USI opval = GET_H_CR (((UINT) 6));
+    SET_H_CR (((UINT) 14), opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "cr", 'x', opval);
   }
   {
-    USI opval = ANDSI (SLLSI (m32rb_h_cr_get (current_cpu, ((HOSTUINT) 0)), 8), 65408);
-    m32rb_h_cr_set (current_cpu, ((HOSTUINT) 0), opval);
-    TRACE_RESULT (current_cpu, "cr-0", 'x', opval);
+    USI opval = ADDSI (pc, 4);
+    SET_H_CR (((UINT) 6), opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "cr", 'x', opval);
   }
   {
-    SI opval = m32r_trap (current_cpu, CPU (h_pc), FLD (f_uimm4));
-    BRANCH_NEW_PC (new_pc, SEM_BRANCH_VIA_ADDR (sem_arg, opval));
-    taken_p = 1;
-    TRACE_RESULT (current_cpu, "pc", 'x', opval);
+    UQI opval = CPU (h_bpsw);
+    CPU (h_bbpsw) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "bbpsw", 'x', opval);
   }
-} while (0);
-
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
-
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_profile_cti_insn (current_cpu, abuf, taken_p);
-    }
-#endif
+  {
+    UQI opval = GET_H_PSW ();
+    CPU (h_bpsw) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "bpsw", 'x', opval);
+  }
+  {
+    UQI opval = ANDQI (GET_H_PSW (), 128);
+    SET_H_PSW (opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "psw", 'x', opval);
+  }
+  {
+    SI opval = m32r_trap (current_cpu, pc, FLD (f_uimm4));
+    SEM_BRANCH_VIA_ADDR (current_cpu, sem_arg, opval, vpc);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "pc", 'x', opval);
+  }
+}
 
-  return new_pc;
+  SEM_BRANCH_FINI (vpc);
+  return vpc;
 #undef FLD
 }
 
-/* unlock: unlock $src1,@$src2 */
+/* unlock: unlock $src1,@$src2 */
 
-CIA
-SEM_FN_NAME (m32rb,unlock) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+static SEM_PC
+SEM_FN_NAME (m32rbf,unlock) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.fmt_unlock.f
+#define FLD(f) abuf->fields.sfmt_st_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-  CIA new_pc = SEM_NEXT_PC (sem_arg, 2);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
 
-do {
+{
 if (CPU (h_lock)) {
   {
-    SI opval = * FLD (f_r1);
-    SETMEMSI (current_cpu, * FLD (f_r2), opval);
-    TRACE_RESULT (current_cpu, "memory", 'x', opval);
+    SI opval = * FLD (i_src1);
+    SETMEMSI (current_cpu, pc, * FLD (i_src2), opval);
+    written |= (1 << 4);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
   }
 }
   {
-    UBI opval = 0;
+    BI opval = 0;
     CPU (h_lock) = opval;
-    TRACE_RESULT (current_cpu, "lock-0", 'x', opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "lock", 'x', opval);
+  }
+}
+
+  abuf->written = written;
+  return vpc;
+#undef FLD
+}
+
+/* clrpsw: clrpsw $uimm8 */
+
+static SEM_PC
+SEM_FN_NAME (m32rbf,clrpsw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+{
+#define FLD(f) abuf->fields.sfmt_clrpsw.f
+  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
+
+  {
+    USI opval = ANDSI (GET_H_CR (((UINT) 0)), ORSI (ZEXTQISI (INVQI (FLD (f_uimm8))), 65280));
+    SET_H_CR (((UINT) 0), opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "cr", 'x', opval);
   }
-} while (0);
 
-  PROFILE_COUNT_INSN (current_cpu, 0, abuf->idesc->num);
+  return vpc;
+#undef FLD
+}
 
-#if WITH_PROFILE_MODEL_P
-  if (PROFILE_MODEL_P (current_cpu))
-    {
-      m32rb_model_mark_get_h_gr (current_cpu, abuf);
-      m32rb_model_profile_insn (current_cpu, abuf);
-    }
-#endif
+/* setpsw: setpsw $uimm8 */
+
+static SEM_PC
+SEM_FN_NAME (m32rbf,setpsw) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+{
+#define FLD(f) abuf->fields.sfmt_clrpsw.f
+  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
+
+  {
+    USI opval = FLD (f_uimm8);
+    SET_H_CR (((UINT) 0), opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "cr", 'x', opval);
+  }
+
+  return vpc;
+#undef FLD
+}
+
+/* bset: bset $uimm3,@($slo16,$sr) */
 
-  return new_pc;
+static SEM_PC
+SEM_FN_NAME (m32rbf,bset) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+{
+#define FLD(f) abuf->fields.sfmt_bset.f
+  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
+
+  {
+    QI opval = ORQI (GETMEMQI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16))), SLLQI (1, SUBSI (7, FLD (f_uimm3))));
+    SETMEMQI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16)), opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
+  }
+
+  return vpc;
 #undef FLD
 }
 
-CIA
-SEM_FN_NAME (m32rb,illegal) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+/* bclr: bclr $uimm3,@($slo16,$sr) */
+
+static SEM_PC
+SEM_FN_NAME (m32rbf,bclr) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-  sim_engine_illegal_insn (current_cpu, NULL_CIA /*FIXME*/);
-  return 0;
+#define FLD(f) abuf->fields.sfmt_bset.f
+  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4);
+
+  {
+    QI opval = ANDQI (GETMEMQI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16))), INVQI (SLLQI (1, SUBSI (7, FLD (f_uimm3)))));
+    SETMEMQI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16)), opval);
+    CGEN_TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
+  }
+
+  return vpc;
+#undef FLD
+}
+
+/* btst: btst $uimm3,$sr */
+
+static SEM_PC
+SEM_FN_NAME (m32rbf,btst) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+{
+#define FLD(f) abuf->fields.sfmt_bset.f
+  ARGBUF *abuf = SEM_ARGBUF (sem_arg);
+  int UNUSED written = 0;
+  IADDR UNUSED pc = abuf->addr;
+  SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
+
+  {
+    BI opval = ANDQI (SRLQI (* FLD (i_sr), SUBSI (7, FLD (f_uimm3))), 1);
+    CPU (h_cond) = opval;
+    CGEN_TRACE_RESULT (current_cpu, abuf, "cond", 'x', opval);
+  }
+
+  return vpc;
+#undef FLD
+}
+
+/* Table of all semantic fns.  */
+
+static const struct sem_fn_desc sem_fns[] = {
+  { M32RBF_INSN_X_INVALID, SEM_FN_NAME (m32rbf,x_invalid) },
+  { M32RBF_INSN_X_AFTER, SEM_FN_NAME (m32rbf,x_after) },
+  { M32RBF_INSN_X_BEFORE, SEM_FN_NAME (m32rbf,x_before) },
+  { M32RBF_INSN_X_CTI_CHAIN, SEM_FN_NAME (m32rbf,x_cti_chain) },
+  { M32RBF_INSN_X_CHAIN, SEM_FN_NAME (m32rbf,x_chain) },
+  { M32RBF_INSN_X_BEGIN, SEM_FN_NAME (m32rbf,x_begin) },
+  { M32RBF_INSN_ADD, SEM_FN_NAME (m32rbf,add) },
+  { M32RBF_INSN_ADD3, SEM_FN_NAME (m32rbf,add3) },
+  { M32RBF_INSN_AND, SEM_FN_NAME (m32rbf,and) },
+  { M32RBF_INSN_AND3, SEM_FN_NAME (m32rbf,and3) },
+  { M32RBF_INSN_OR, SEM_FN_NAME (m32rbf,or) },
+  { M32RBF_INSN_OR3, SEM_FN_NAME (m32rbf,or3) },
+  { M32RBF_INSN_XOR, SEM_FN_NAME (m32rbf,xor) },
+  { M32RBF_INSN_XOR3, SEM_FN_NAME (m32rbf,xor3) },
+  { M32RBF_INSN_ADDI, SEM_FN_NAME (m32rbf,addi) },
+  { M32RBF_INSN_ADDV, SEM_FN_NAME (m32rbf,addv) },
+  { M32RBF_INSN_ADDV3, SEM_FN_NAME (m32rbf,addv3) },
+  { M32RBF_INSN_ADDX, SEM_FN_NAME (m32rbf,addx) },
+  { M32RBF_INSN_BC8, SEM_FN_NAME (m32rbf,bc8) },
+  { M32RBF_INSN_BC24, SEM_FN_NAME (m32rbf,bc24) },
+  { M32RBF_INSN_BEQ, SEM_FN_NAME (m32rbf,beq) },
+  { M32RBF_INSN_BEQZ, SEM_FN_NAME (m32rbf,beqz) },
+  { M32RBF_INSN_BGEZ, SEM_FN_NAME (m32rbf,bgez) },
+  { M32RBF_INSN_BGTZ, SEM_FN_NAME (m32rbf,bgtz) },
+  { M32RBF_INSN_BLEZ, SEM_FN_NAME (m32rbf,blez) },
+  { M32RBF_INSN_BLTZ, SEM_FN_NAME (m32rbf,bltz) },
+  { M32RBF_INSN_BNEZ, SEM_FN_NAME (m32rbf,bnez) },
+  { M32RBF_INSN_BL8, SEM_FN_NAME (m32rbf,bl8) },
+  { M32RBF_INSN_BL24, SEM_FN_NAME (m32rbf,bl24) },
+  { M32RBF_INSN_BNC8, SEM_FN_NAME (m32rbf,bnc8) },
+  { M32RBF_INSN_BNC24, SEM_FN_NAME (m32rbf,bnc24) },
+  { M32RBF_INSN_BNE, SEM_FN_NAME (m32rbf,bne) },
+  { M32RBF_INSN_BRA8, SEM_FN_NAME (m32rbf,bra8) },
+  { M32RBF_INSN_BRA24, SEM_FN_NAME (m32rbf,bra24) },
+  { M32RBF_INSN_CMP, SEM_FN_NAME (m32rbf,cmp) },
+  { M32RBF_INSN_CMPI, SEM_FN_NAME (m32rbf,cmpi) },
+  { M32RBF_INSN_CMPU, SEM_FN_NAME (m32rbf,cmpu) },
+  { M32RBF_INSN_CMPUI, SEM_FN_NAME (m32rbf,cmpui) },
+  { M32RBF_INSN_DIV, SEM_FN_NAME (m32rbf,div) },
+  { M32RBF_INSN_DIVU, SEM_FN_NAME (m32rbf,divu) },
+  { M32RBF_INSN_REM, SEM_FN_NAME (m32rbf,rem) },
+  { M32RBF_INSN_REMU, SEM_FN_NAME (m32rbf,remu) },
+  { M32RBF_INSN_JL, SEM_FN_NAME (m32rbf,jl) },
+  { M32RBF_INSN_JMP, SEM_FN_NAME (m32rbf,jmp) },
+  { M32RBF_INSN_LD, SEM_FN_NAME (m32rbf,ld) },
+  { M32RBF_INSN_LD_D, SEM_FN_NAME (m32rbf,ld_d) },
+  { M32RBF_INSN_LDB, SEM_FN_NAME (m32rbf,ldb) },
+  { M32RBF_INSN_LDB_D, SEM_FN_NAME (m32rbf,ldb_d) },
+  { M32RBF_INSN_LDH, SEM_FN_NAME (m32rbf,ldh) },
+  { M32RBF_INSN_LDH_D, SEM_FN_NAME (m32rbf,ldh_d) },
+  { M32RBF_INSN_LDUB, SEM_FN_NAME (m32rbf,ldub) },
+  { M32RBF_INSN_LDUB_D, SEM_FN_NAME (m32rbf,ldub_d) },
+  { M32RBF_INSN_LDUH, SEM_FN_NAME (m32rbf,lduh) },
+  { M32RBF_INSN_LDUH_D, SEM_FN_NAME (m32rbf,lduh_d) },
+  { M32RBF_INSN_LD_PLUS, SEM_FN_NAME (m32rbf,ld_plus) },
+  { M32RBF_INSN_LD24, SEM_FN_NAME (m32rbf,ld24) },
+  { M32RBF_INSN_LDI8, SEM_FN_NAME (m32rbf,ldi8) },
+  { M32RBF_INSN_LDI16, SEM_FN_NAME (m32rbf,ldi16) },
+  { M32RBF_INSN_LOCK, SEM_FN_NAME (m32rbf,lock) },
+  { M32RBF_INSN_MACHI, SEM_FN_NAME (m32rbf,machi) },
+  { M32RBF_INSN_MACLO, SEM_FN_NAME (m32rbf,maclo) },
+  { M32RBF_INSN_MACWHI, SEM_FN_NAME (m32rbf,macwhi) },
+  { M32RBF_INSN_MACWLO, SEM_FN_NAME (m32rbf,macwlo) },
+  { M32RBF_INSN_MUL, SEM_FN_NAME (m32rbf,mul) },
+  { M32RBF_INSN_MULHI, SEM_FN_NAME (m32rbf,mulhi) },
+  { M32RBF_INSN_MULLO, SEM_FN_NAME (m32rbf,mullo) },
+  { M32RBF_INSN_MULWHI, SEM_FN_NAME (m32rbf,mulwhi) },
+  { M32RBF_INSN_MULWLO, SEM_FN_NAME (m32rbf,mulwlo) },
+  { M32RBF_INSN_MV, SEM_FN_NAME (m32rbf,mv) },
+  { M32RBF_INSN_MVFACHI, SEM_FN_NAME (m32rbf,mvfachi) },
+  { M32RBF_INSN_MVFACLO, SEM_FN_NAME (m32rbf,mvfaclo) },
+  { M32RBF_INSN_MVFACMI, SEM_FN_NAME (m32rbf,mvfacmi) },
+  { M32RBF_INSN_MVFC, SEM_FN_NAME (m32rbf,mvfc) },
+  { M32RBF_INSN_MVTACHI, SEM_FN_NAME (m32rbf,mvtachi) },
+  { M32RBF_INSN_MVTACLO, SEM_FN_NAME (m32rbf,mvtaclo) },
+  { M32RBF_INSN_MVTC, SEM_FN_NAME (m32rbf,mvtc) },
+  { M32RBF_INSN_NEG, SEM_FN_NAME (m32rbf,neg) },
+  { M32RBF_INSN_NOP, SEM_FN_NAME (m32rbf,nop) },
+  { M32RBF_INSN_NOT, SEM_FN_NAME (m32rbf,not) },
+  { M32RBF_INSN_RAC, SEM_FN_NAME (m32rbf,rac) },
+  { M32RBF_INSN_RACH, SEM_FN_NAME (m32rbf,rach) },
+  { M32RBF_INSN_RTE, SEM_FN_NAME (m32rbf,rte) },
+  { M32RBF_INSN_SETH, SEM_FN_NAME (m32rbf,seth) },
+  { M32RBF_INSN_SLL, SEM_FN_NAME (m32rbf,sll) },
+  { M32RBF_INSN_SLL3, SEM_FN_NAME (m32rbf,sll3) },
+  { M32RBF_INSN_SLLI, SEM_FN_NAME (m32rbf,slli) },
+  { M32RBF_INSN_SRA, SEM_FN_NAME (m32rbf,sra) },
+  { M32RBF_INSN_SRA3, SEM_FN_NAME (m32rbf,sra3) },
+  { M32RBF_INSN_SRAI, SEM_FN_NAME (m32rbf,srai) },
+  { M32RBF_INSN_SRL, SEM_FN_NAME (m32rbf,srl) },
+  { M32RBF_INSN_SRL3, SEM_FN_NAME (m32rbf,srl3) },
+  { M32RBF_INSN_SRLI, SEM_FN_NAME (m32rbf,srli) },
+  { M32RBF_INSN_ST, SEM_FN_NAME (m32rbf,st) },
+  { M32RBF_INSN_ST_D, SEM_FN_NAME (m32rbf,st_d) },
+  { M32RBF_INSN_STB, SEM_FN_NAME (m32rbf,stb) },
+  { M32RBF_INSN_STB_D, SEM_FN_NAME (m32rbf,stb_d) },
+  { M32RBF_INSN_STH, SEM_FN_NAME (m32rbf,sth) },
+  { M32RBF_INSN_STH_D, SEM_FN_NAME (m32rbf,sth_d) },
+  { M32RBF_INSN_ST_PLUS, SEM_FN_NAME (m32rbf,st_plus) },
+  { M32RBF_INSN_ST_MINUS, SEM_FN_NAME (m32rbf,st_minus) },
+  { M32RBF_INSN_SUB, SEM_FN_NAME (m32rbf,sub) },
+  { M32RBF_INSN_SUBV, SEM_FN_NAME (m32rbf,subv) },
+  { M32RBF_INSN_SUBX, SEM_FN_NAME (m32rbf,subx) },
+  { M32RBF_INSN_TRAP, SEM_FN_NAME (m32rbf,trap) },
+  { M32RBF_INSN_UNLOCK, SEM_FN_NAME (m32rbf,unlock) },
+  { M32RBF_INSN_CLRPSW, SEM_FN_NAME (m32rbf,clrpsw) },
+  { M32RBF_INSN_SETPSW, SEM_FN_NAME (m32rbf,setpsw) },
+  { M32RBF_INSN_BSET, SEM_FN_NAME (m32rbf,bset) },
+  { M32RBF_INSN_BCLR, SEM_FN_NAME (m32rbf,bclr) },
+  { M32RBF_INSN_BTST, SEM_FN_NAME (m32rbf,btst) },
+  { 0, 0 }
+};
+
+/* Add the semantic fns to IDESC_TABLE.  */
+
+void
+SEM_FN_NAME (m32rbf,init_idesc_table) (SIM_CPU *current_cpu)
+{
+  IDESC *idesc_table = CPU_IDESC (current_cpu);
+  const struct sem_fn_desc *sf;
+  int mach_num = MACH_NUM (CPU_MACH (current_cpu));
+
+  for (sf = &sem_fns[0]; sf->fn != 0; ++sf)
+    {
+      const CGEN_INSN *insn = idesc_table[sf->index].idata;
+      int valid_p = (CGEN_INSN_VIRTUAL_P (insn)
+                    || CGEN_INSN_MACH_HAS_P (insn, mach_num));
+#if FAST_P
+      if (valid_p)
+       idesc_table[sf->index].sem_fast = sf->fn;
+      else
+       idesc_table[sf->index].sem_fast = SEM_FN_NAME (m32rbf,x_invalid);
+#else
+      if (valid_p)
+       idesc_table[sf->index].sem_full = sf->fn;
+      else
+       idesc_table[sf->index].sem_full = SEM_FN_NAME (m32rbf,x_invalid);
+#endif
+    }
 }
 
-#endif /* WANT_CPU */