Search
lxdream.org :: lxdream/src/sh4/sh4stat.in
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/sh4stat.in
changeset 671:a530ea88eebd
prev561:533f6b478071
next673:44c579439d73
author nkeynes
date Thu May 15 10:22:39 2008 +0000 (13 years ago)
permissions -rw-r--r--
last change Permanently add SH4 instruction statistics tracking (enabled with --enable-sh4stats)
view annotate diff log raw
     1 /**
     2  * $Id$
     3  * 
     4  * Support module for collecting instruction stats
     5  *
     6  * Copyright (c) 2005 Nathan Keynes.
     7  *
     8  * This program is free software; you can redistribute it and/or modify
     9  * it under the terms of the GNU General Public License as published by
    10  * the Free Software Foundation; either version 2 of the License, or
    11  * (at your option) any later version.
    12  *
    13  * This program is distributed in the hope that it will be useful,
    14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  * GNU General Public License for more details.
    17  */
    19 #include "dream.h"
    20 #include "sh4stat.h"
    21 #include "sh4core.h"
    23 static uint64_t sh4_stats[SH4_INSTRUCTION_COUNT+1];
    24 static uint64_t sh4_stats_total;
    25 static const char *sh4_stats_names[] = {
    26     "???",
    27 "ADD Rm, Rn",
    28 "ADD #imm, Rn",
    29 "ADDC Rm, Rn",
    30 "ADDV Rm, Rn",
    31 "AND Rm, Rn",
    32 "AND #imm, R0",
    33 "AND.B #imm, @(R0, GBR)",
    34 "BF disp",
    35 "BF/S disp",
    36 "BRA disp",
    37 "BRAF Rn",
    38 "BSR disp",
    39 "BSRF Rn",
    40 "BT disp",
    41 "BT/S disp",
    42 "CLRMAC",
    43 "CLRS",
    44 "CLRT",
    45 "CMP/EQ Rm, Rn",
    46 "CMP/EQ #imm, R0",
    47 "CMP/GE Rm, Rn",
    48 "CMP/GT Rm, Rn",
    49 "CMP/HI Rm, Rn",
    50 "CMP/HS Rm, Rn",
    51 "CMP/PL Rn",
    52 "CMP/PZ Rn",
    53 "CMP/STR Rm, Rn",
    54 "DIV0S Rm, Rn",
    55 "DIV0U",
    56 "DIV1 Rm, Rn",
    57 "DMULS.L Rm, Rn",
    58 "DMULU.L Rm, Rn",
    59 "DT Rn",
    60 "EXTS.B Rm, Rn",
    61 "EXTS.W Rm, Rn",
    62 "EXTU.B Rm, Rn",
    63 "EXTU.W Rm, Rn",
    64 "FABS FRn",
    65 "FADD FRm, FRn",
    66 "FCMP/EQ FRm, FRn",
    67 "FCMP/GT FRm, FRn",
    68 "FCNVDS FRm, FPUL",
    69 "FCNVSD FPUL, FRn",
    70 "FDIV FRm, FRn",
    71 "FIPR FVm, FVn",
    72 "FLDS FRm, FPUL",
    73 "FLDI0 FRn",
    74 "FLDI1 FRn",
    75 "FLOAT FPUL, FRn",
    76 "FMAC FR0, FRm, FRn",
    77 "FMOV FRm, FRn",
    78 "FMOV FRm, @Rn",
    79 "FMOV FRm, @-Rn",
    80 "FMOV FRm, @(R0, Rn)",
    81 "FMOV @Rm, FRn",
    82 "FMOV @Rm+, FRn",
    83 "FMOV @(R0, Rm), FRn",
    84 "FMUL FRm, FRn",
    85 "FNEG FRn",
    86 "FRCHG",
    87 "FSCA FPUL, FRn",
    88 "FSCHG",
    89 "FSQRT FRn",
    90 "FSRRA FRn",
    91 "FSTS FPUL, FRn",
    92 "FSUB FRm, FRn",
    93 "FTRC FRm, FPUL",
    94 "FTRV XMTRX, FVn",
    95 "JMP @Rn",
    96 "JSR @Rn",
    97 "LDC Rm, SR",
    98 "LDC Rm, *",
    99 "LDC.L @Rm+, SR",
   100 "LDC.L @Rm+, *",
   101 "LDS Rm, *",
   102 "LDS.L @Rm+, *",
   103 "LDTLB",
   104 "MAC.L @Rm+, @Rn+",
   105 "MAC.W @Rm+, @Rn+",
   106 "MOV Rm, Rn",
   107 "MOV #imm, Rn",
   108 "MOV.B ...",
   109 "MOV.L ...",
   110 "MOV.L @(disp, PC)",
   111 "MOV.W ...",
   112 "MOVA @(disp, PC), R0",
   113 "MOVCA.L R0, @Rn",
   114 "MOVT Rn",
   115 "MUL.L Rm, Rn",
   116 "MULS.W Rm, Rn",
   117 "MULU.W Rm, Rn",
   118 "NEG Rm, Rn",
   119 "NEGC Rm, Rn",
   120 "NOP",
   121 "NOT Rm, Rn",
   122 "OCBI @Rn",
   123 "OCBP @Rn",
   124 "OCBWB @Rn",
   125 "OR Rm, Rn",
   126 "OR #imm, R0",
   127 "OR.B #imm, @(R0, GBR)",
   128 "PREF @Rn",
   129 "ROTCL Rn",
   130 "ROTCR Rn",
   131 "ROTL Rn",
   132 "ROTR Rn",
   133 "RTE",
   134 "RTS",
   135 "SETS",
   136 "SETT",
   137 "SHAD Rm, Rn",
   138 "SHAL Rn",
   139 "SHAR Rn",
   140 "SHLD Rm, Rn",
   141 "SHLL* Rn",
   142 "SHLR* Rn",
   143 "SLEEP",
   144 "STC SR, Rn",
   145 "STC *, Rn",
   146 "STC.L SR, @-Rn",
   147 "STC.L *, @-Rn",
   148 "STS *, Rn",
   149 "STS.L *, @-Rn",
   150 "SUB Rm, Rn",
   151 "SUBC Rm, Rn",
   152 "SUBV Rm, Rn",
   153 "SWAP.B Rm, Rn",
   154 "SWAP.W Rm, Rn",
   155 "TAS.B @Rn",
   156 "TRAPA #imm",
   157 "TST Rm, Rn",
   158 "TST #imm, R0",
   159 "TST.B #imm, @(R0, GBR)",
   160 "XOR Rm, Rn",
   161 "XOR #imm, R0",
   162 "XOR.B #imm, @(R0, GBR)",
   163 "XTRCT Rm, Rn",
   164 "UNDEF"
   165 };
   167 void sh4_stats_reset( void )
   168 {
   169     int i;
   170     for( i=0; i<= I_UNDEF; i++ ) {
   171 	sh4_stats[i] = 0;
   172     }
   173     sh4_stats_total = 0;
   174 }
   176 void sh4_stats_print( FILE *out )
   177 {
   178     int i;
   179     for( i=0; i<= I_UNDEF; i++ ) {
   180 	fprintf( out, "%-20s\t%d\t%.2f%%\n", sh4_stats_names[i], (uint32_t)sh4_stats[i], ((double)sh4_stats[i])*100.0/(double)sh4_stats_total );
   181     }
   182     fprintf( out, "Total: %lld\n", sh4_stats_total );
   183 }
   185 void sh4_stats_add( sh4_inst_id item )
   186 {
   187     sh4_stats[item]++;
   188     sh4_stats_total++;
   189 }
   191 void sh4_stats_add_by_pc( uint32_t pc ) 
   192 {
   193     uint16_t ir = sh4_read_word(pc);
   194 #define UNDEF() sh4_stats[0]++
   195 %%
   196 ADD Rm, Rn {: sh4_stats[I_ADD]++; :}
   197 ADD #imm, Rn {: sh4_stats[I_ADDI]++; :}
   198 ADDC Rm, Rn {: sh4_stats[I_ADDC]++; :}
   199 ADDV Rm, Rn {: sh4_stats[I_ADDV]++; :}
   200 AND Rm, Rn {: sh4_stats[I_AND]++; :}
   201 AND #imm, R0 {: sh4_stats[I_ANDI]++; :}
   202 AND.B #imm, @(R0, GBR) {: sh4_stats[I_ANDB]++; :}
   203 BF disp {: sh4_stats[I_BF]++; :}
   204 BF/S disp {: sh4_stats[I_BFS]++; :}
   205 BRA disp {: sh4_stats[I_BRA]++; :}
   206 BRAF Rn {: sh4_stats[I_BRAF]++; :}
   207 BSR disp {: sh4_stats[I_BSR]++; :}
   208 BSRF Rn {: sh4_stats[I_BSRF]++; :}
   209 BT disp {: sh4_stats[I_BT]++; :}
   210 BT/S disp {: sh4_stats[I_BTS]++; :}
   211 CLRMAC {: sh4_stats[I_CLRMAC]++; :}
   212 CLRS {: sh4_stats[I_CLRS]++; :}
   213 CLRT {: sh4_stats[I_CLRT]++; :}
   214 CMP/EQ Rm, Rn {: sh4_stats[I_CMPEQ]++; :}
   215 CMP/EQ #imm, R0 {: sh4_stats[I_CMPEQI]++; :}
   216 CMP/GE Rm, Rn {: sh4_stats[I_CMPGE]++; :}
   217 CMP/GT Rm, Rn {: sh4_stats[I_CMPGT]++; :}
   218 CMP/HI Rm, Rn {: sh4_stats[I_CMPHI]++; :}
   219 CMP/HS Rm, Rn {: sh4_stats[I_CMPHS]++; :}
   220 CMP/PL Rn {: sh4_stats[I_CMPPL]++; :}
   221 CMP/PZ Rn {: sh4_stats[I_CMPPZ]++; :}
   222 CMP/STR Rm, Rn {: sh4_stats[I_CMPSTR]++; :}
   223 DIV0S Rm, Rn {: sh4_stats[I_DIV0S]++; :}
   224 DIV0U {: sh4_stats[I_DIV0U]++; :}
   225 DIV1 Rm, Rn {: sh4_stats[I_DIV1]++; :}
   226 DMULS.L Rm, Rn {: sh4_stats[I_DMULS]++; :}
   227 DMULU.L Rm, Rn {: sh4_stats[I_DMULU]++; :}
   228 DT Rn {: sh4_stats[I_DT]++; :}
   229 EXTS.B Rm, Rn {: sh4_stats[I_EXTSB]++; :}
   230 EXTS.W Rm, Rn {: sh4_stats[I_EXTSW]++; :}
   231 EXTU.B Rm, Rn {: sh4_stats[I_EXTUB]++; :}
   232 EXTU.W Rm, Rn {: sh4_stats[I_EXTUW]++; :}
   233 FABS FRn {: sh4_stats[I_FABS]++; :}
   234 FADD FRm, FRn {: sh4_stats[I_FADD]++; :}
   235 FCMP/EQ FRm, FRn {: sh4_stats[I_FCMPEQ]++; :}
   236 FCMP/GT FRm, FRn {: sh4_stats[I_FCMPGT]++; :}
   237 FCNVDS FRm, FPUL {: sh4_stats[I_FCNVDS]++; :}
   238 FCNVSD FPUL, FRn {: sh4_stats[I_FCNVSD]++; :}
   239 FDIV FRm, FRn {: sh4_stats[I_FDIV]++; :}
   240 FIPR FVm, FVn {: sh4_stats[I_FIPR]++; :}
   241 FLDS FRm, FPUL {: sh4_stats[I_FLDS]++; :}
   242 FLDI0 FRn {: sh4_stats[I_FLDI0]++; :}
   243 FLDI1 FRn {: sh4_stats[I_FLDI1]++; :}
   244 FLOAT FPUL, FRn {: sh4_stats[I_FLOAT]++; :}
   245 FMAC FR0, FRm, FRn {: sh4_stats[I_FMAC]++; :}
   246 FMOV FRm, FRn {: sh4_stats[I_FMOV1]++; :}
   247 FMOV FRm, @Rn {: sh4_stats[I_FMOV2]++; :}
   248 FMOV FRm, @-Rn {: sh4_stats[I_FMOV3]++; :}
   249 FMOV FRm, @(R0, Rn) {: sh4_stats[I_FMOV4]++; :}
   250 FMOV @Rm, FRn {: sh4_stats[I_FMOV5]++; :}
   251 FMOV @Rm+, FRn {: sh4_stats[I_FMOV6]++; :}
   252 FMOV @(R0, Rm), FRn {: sh4_stats[I_FMOV7]++; :}
   253 FMUL FRm, FRn {: sh4_stats[I_FMUL]++; :}
   254 FNEG FRn {: sh4_stats[I_FNEG]++; :}
   255 FRCHG {: sh4_stats[I_FRCHG]++; :}
   256 FSCA FPUL, FRn {: sh4_stats[I_FSCA]++; :}
   257 FSCHG {: sh4_stats[I_FSCHG]++; :}
   258 FSQRT FRn {: sh4_stats[I_FSQRT]++; :}
   259 FSRRA FRn {: sh4_stats[I_FSRRA]++; :}
   260 FSTS FPUL, FRn {: sh4_stats[I_FSTS]++; :}
   261 FSUB FRm, FRn {: sh4_stats[I_FSUB]++; :}
   262 FTRC FRm, FPUL {: sh4_stats[I_FTRC]++; :}
   263 FTRV XMTRX, FVn {: sh4_stats[I_FTRV]++; :}
   264 JMP @Rn {: sh4_stats[I_JMP]++; :}
   265 JSR @Rn {: sh4_stats[I_JSR]++; :}
   266 LDC Rm, GBR {: sh4_stats[I_LDC]++; :}
   267 LDC Rm, SR {: sh4_stats[I_LDCSR]++; :}
   268 LDC Rm, VBR {: sh4_stats[I_LDC]++; :}
   269 LDC Rm, SSR {: sh4_stats[I_LDC]++; :}
   270 LDC Rm, SGR {: sh4_stats[I_LDC]++; :}
   271 LDC Rm, SPC {: sh4_stats[I_LDC]++; :}
   272 LDC Rm, DBR {: sh4_stats[I_LDC]++; :}
   273 LDC Rm, Rn_BANK {: sh4_stats[I_LDC]++; :}
   274 LDC.L @Rm+, GBR {: sh4_stats[I_LDCM]++; :}
   275 LDC.L @Rm+, SR {: sh4_stats[I_LDCSRM]++; :}
   276 LDC.L @Rm+, VBR {: sh4_stats[I_LDCM]++; :}
   277 LDC.L @Rm+, SSR {: sh4_stats[I_LDCM]++; :}
   278 LDC.L @Rm+, SGR {: sh4_stats[I_LDCM]++; :}
   279 LDC.L @Rm+, SPC {: sh4_stats[I_LDCM]++; :}
   280 LDC.L @Rm+, DBR {: sh4_stats[I_LDCM]++; :}
   281 LDC.L @Rm+, Rn_BANK {: sh4_stats[I_LDCM]++; :}
   282 LDS Rm, FPSCR {: sh4_stats[I_LDS]++; :}
   283 LDS.L @Rm+, FPSCR {: sh4_stats[I_LDSM]++; :}
   284 LDS Rm, FPUL {: sh4_stats[I_LDS]++; :}
   285 LDS.L @Rm+, FPUL {: sh4_stats[I_LDSM]++; :}
   286 LDS Rm, MACH {: sh4_stats[I_LDS]++; :}
   287 LDS.L @Rm+, MACH {: sh4_stats[I_LDSM]++; :}
   288 LDS Rm, MACL {: sh4_stats[I_LDS]++; :}
   289 LDS.L @Rm+, MACL {: sh4_stats[I_LDSM]++; :}
   290 LDS Rm, PR {: sh4_stats[I_LDS]++; :}
   291 LDS.L @Rm+, PR {: sh4_stats[I_LDSM]++; :}
   292 LDTLB {: sh4_stats[I_LDTLB]++; :}
   293 MAC.L @Rm+, @Rn+ {: sh4_stats[I_MACL]++; :}
   294 MAC.W @Rm+, @Rn+ {: sh4_stats[I_MACW]++; :}
   295 MOV Rm, Rn {: sh4_stats[I_MOV]++; :}
   296 MOV #imm, Rn {: sh4_stats[I_MOVI]++; :}
   297 MOV.B Rm, @Rn {: sh4_stats[I_MOVB]++; :}
   298 MOV.B Rm, @-Rn {: sh4_stats[I_MOVB]++; :}
   299 MOV.B Rm, @(R0, Rn) {: sh4_stats[I_MOVB]++; :}
   300 MOV.B R0, @(disp, GBR) {: sh4_stats[I_MOVB]++; :}
   301 MOV.B R0, @(disp, Rn) {: sh4_stats[I_MOVB]++; :}
   302 MOV.B @Rm, Rn {: sh4_stats[I_MOVB]++; :}
   303 MOV.B @Rm+, Rn {: sh4_stats[I_MOVB]++; :}
   304 MOV.B @(R0, Rm), Rn {: sh4_stats[I_MOVB]++; :}
   305 MOV.B @(disp, GBR), R0 {: sh4_stats[I_MOVB]++; :}
   306 MOV.B @(disp, Rm), R0 {: sh4_stats[I_MOVB]++; :}
   307 MOV.L Rm, @Rn {: sh4_stats[I_MOVL]++; :}
   308 MOV.L Rm, @-Rn {: sh4_stats[I_MOVL]++; :}
   309 MOV.L Rm, @(R0, Rn) {: sh4_stats[I_MOVL]++; :}
   310 MOV.L R0, @(disp, GBR) {: sh4_stats[I_MOVL]++; :}
   311 MOV.L Rm, @(disp, Rn) {: sh4_stats[I_MOVL]++; :}
   312 MOV.L @Rm, Rn {: sh4_stats[I_MOVL]++; :}
   313 MOV.L @Rm+, Rn {: sh4_stats[I_MOVL]++; :}
   314 MOV.L @(R0, Rm), Rn {: sh4_stats[I_MOVL]++; :}
   315 MOV.L @(disp, GBR), R0 {: sh4_stats[I_MOVL]++; :}
   316 MOV.L @(disp, PC), Rn {: sh4_stats[I_MOVLPC]++; :}
   317 MOV.L @(disp, Rm), Rn {: sh4_stats[I_MOVL]++; :}
   318 MOV.W Rm, @Rn {: sh4_stats[I_MOVW]++; :}
   319 MOV.W Rm, @-Rn {: sh4_stats[I_MOVW]++; :}
   320 MOV.W Rm, @(R0, Rn) {: sh4_stats[I_MOVW]++; :}
   321 MOV.W R0, @(disp, GBR) {: sh4_stats[I_MOVW]++; :}
   322 MOV.W R0, @(disp, Rn) {: sh4_stats[I_MOVW]++; :}
   323 MOV.W @Rm, Rn {: sh4_stats[I_MOVW]++; :}
   324 MOV.W @Rm+, Rn {: sh4_stats[I_MOVW]++; :}
   325 MOV.W @(R0, Rm), Rn {: sh4_stats[I_MOVW]++; :}
   326 MOV.W @(disp, GBR), R0 {: sh4_stats[I_MOVW]++; :}
   327 MOV.W @(disp, PC), Rn {: sh4_stats[I_MOVW]++; :}
   328 MOV.W @(disp, Rm), R0 {: sh4_stats[I_MOVW]++; :}
   329 MOVA @(disp, PC), R0 {: sh4_stats[I_MOVA]++; :}
   330 MOVCA.L R0, @Rn {: sh4_stats[I_MOVCA]++; :}
   331 MOVT Rn {: sh4_stats[I_MOVT]++; :}
   332 MUL.L Rm, Rn {: sh4_stats[I_MULL]++; :}
   333 MULS.W Rm, Rn {: sh4_stats[I_MULSW]++; :}
   334 MULU.W Rm, Rn {: sh4_stats[I_MULUW]++; :}
   335 NEG Rm, Rn {: sh4_stats[I_NEG]++; :}
   336 NEGC Rm, Rn {: sh4_stats[I_NEGC]++; :}
   337 NOP {: sh4_stats[I_NOP]++; :}
   338 NOT Rm, Rn {: sh4_stats[I_NOT]++; :}
   339 OCBI @Rn {: sh4_stats[I_OCBI]++; :}
   340 OCBP @Rn {: sh4_stats[I_OCBP]++; :}
   341 OCBWB @Rn {: sh4_stats[I_OCBWB]++; :}
   342 OR Rm, Rn {: sh4_stats[I_OR]++; :}
   343 OR #imm, R0 {: sh4_stats[I_ORI]++; :}
   344 OR.B #imm, @(R0, GBR) {: sh4_stats[I_ORB]++; :}
   345 PREF @Rn {: sh4_stats[I_PREF]++; :}
   346 ROTCL Rn {: sh4_stats[I_ROTCL]++; :}
   347 ROTCR Rn {: sh4_stats[I_ROTCR]++; :}
   348 ROTL Rn {: sh4_stats[I_ROTL]++; :}
   349 ROTR Rn {: sh4_stats[I_ROTR]++; :}
   350 RTE {: sh4_stats[I_RTE]++; :}
   351 RTS {: sh4_stats[I_RTS]++; :}
   352 SETS {: sh4_stats[I_SETS]++; :}
   353 SETT {: sh4_stats[I_SETT]++; :}
   354 SHAD Rm, Rn {: sh4_stats[I_SHAD]++; :}
   355 SHAL Rn {: sh4_stats[I_SHAL]++; :}
   356 SHAR Rn {: sh4_stats[I_SHAR]++; :}
   357 SHLD Rm, Rn {: sh4_stats[I_SHLD]++; :}
   358 SHLL Rn {: sh4_stats[I_SHLL]++; :}
   359 SHLL2 Rn {: sh4_stats[I_SHLL]++; :}
   360 SHLL8 Rn {: sh4_stats[I_SHLL]++; :}
   361 SHLL16 Rn {: sh4_stats[I_SHLL]++; :}
   362 SHLR Rn {: sh4_stats[I_SHLR]++; :}
   363 SHLR2 Rn {: sh4_stats[I_SHLR]++; :}
   364 SHLR8 Rn {: sh4_stats[I_SHLR]++; :}
   365 SHLR16 Rn {: sh4_stats[I_SHLR]++; :}
   366 SLEEP {: sh4_stats[I_SLEEP]++; :}
   367 STC SR, Rn {: sh4_stats[I_STCSR]++; :}
   368 STC GBR, Rn {: sh4_stats[I_STC]++; :}
   369 STC VBR, Rn {: sh4_stats[I_STC]++; :}
   370 STC SSR, Rn {: sh4_stats[I_STC]++; :}
   371 STC SPC, Rn {: sh4_stats[I_STC]++; :}
   372 STC SGR, Rn {: sh4_stats[I_STC]++; :}
   373 STC DBR, Rn {: sh4_stats[I_STC]++; :}
   374 STC Rm_BANK, Rn {: sh4_stats[I_STC]++; :}
   375 STC.L SR, @-Rn {: sh4_stats[I_STCSRM]++; :}
   376 STC.L VBR, @-Rn {: sh4_stats[I_STCM]++; :}
   377 STC.L SSR, @-Rn {: sh4_stats[I_STCM]++; :}
   378 STC.L SPC, @-Rn {: sh4_stats[I_STCM]++; :}
   379 STC.L SGR, @-Rn {: sh4_stats[I_STCM]++; :}
   380 STC.L DBR, @-Rn {: sh4_stats[I_STCM]++; :}
   381 STC.L Rm_BANK, @-Rn {: sh4_stats[I_STCM]++; :}
   382 STC.L GBR, @-Rn {: sh4_stats[I_STCM]++; :}
   383 STS FPSCR, Rn {: sh4_stats[I_STS]++; :}
   384 STS.L FPSCR, @-Rn {: sh4_stats[I_STSM]++; :}
   385 STS FPUL, Rn {: sh4_stats[I_STS]++; :}
   386 STS.L FPUL, @-Rn {: sh4_stats[I_STSM]++; :}
   387 STS MACH, Rn {: sh4_stats[I_STS]++; :}
   388 STS.L MACH, @-Rn {: sh4_stats[I_STSM]++; :}
   389 STS MACL, Rn {: sh4_stats[I_STS]++; :}
   390 STS.L MACL, @-Rn {: sh4_stats[I_STSM]++; :}
   391 STS PR, Rn {: sh4_stats[I_STS]++; :}
   392 STS.L PR, @-Rn {: sh4_stats[I_STSM]++; :}
   393 SUB Rm, Rn {: sh4_stats[I_SUB]++; :}
   394 SUBC Rm, Rn {: sh4_stats[I_SUBC]++; :}
   395 SUBV Rm, Rn {: sh4_stats[I_SUBV]++; :}
   396 SWAP.B Rm, Rn {: sh4_stats[I_SWAPB]++; :}
   397 SWAP.W Rm, Rn {: sh4_stats[I_SWAPW]++; :}
   398 TAS.B @Rn {: sh4_stats[I_TASB]++; :}
   399 TRAPA #imm {: sh4_stats[I_TRAPA]++; :}
   400 TST Rm, Rn {: sh4_stats[I_TST]++; :}
   401 TST #imm, R0 {: sh4_stats[I_TSTI]++; :}
   402 TST.B #imm, @(R0, GBR) {: sh4_stats[I_TSTB]++; :}
   403 XOR Rm, Rn {: sh4_stats[I_XOR]++; :}
   404 XOR #imm, R0 {: sh4_stats[I_XORI]++; :}
   405 XOR.B #imm, @(R0, GBR) {: sh4_stats[I_XORB]++; :}
   406 XTRCT Rm, Rn {: sh4_stats[I_XTRCT]++; :}
   407 UNDEF {: sh4_stats[I_UNDEF]++; :}
   408 %%
   410 sh4_stats_total++;
   411 }
.