10de80192f57cd132b31b233c65734de04939ce65sewardj
20de80192f57cd132b31b233c65734de04939ce65sewardj/*--------------------------------------------------------------------*/
30de80192f57cd132b31b233c65734de04939ce65sewardj/*--- begin                                    guest_tilegx_toIR.c ---*/
40de80192f57cd132b31b233c65734de04939ce65sewardj/*--------------------------------------------------------------------*/
50de80192f57cd132b31b233c65734de04939ce65sewardj
60de80192f57cd132b31b233c65734de04939ce65sewardj/*
70de80192f57cd132b31b233c65734de04939ce65sewardj  This file is part of Valgrind, a dynamic binary instrumentation
80de80192f57cd132b31b233c65734de04939ce65sewardj  framework.
90de80192f57cd132b31b233c65734de04939ce65sewardj
10785952d4bf502fa756b2ac58595fd31fe0f88559sewardj  Copyright (C) 2010-2015  Tilera Corp.
110de80192f57cd132b31b233c65734de04939ce65sewardj
120de80192f57cd132b31b233c65734de04939ce65sewardj  This program is free software; you can redistribute it and/or
130de80192f57cd132b31b233c65734de04939ce65sewardj  modify it under the terms of the GNU General Public License as
140de80192f57cd132b31b233c65734de04939ce65sewardj  published by the Free Software Foundation; either version 2 of the
150de80192f57cd132b31b233c65734de04939ce65sewardj  License, or (at your option) any later version.
160de80192f57cd132b31b233c65734de04939ce65sewardj
170de80192f57cd132b31b233c65734de04939ce65sewardj  This program is distributed in the hope that it will be useful, but
180de80192f57cd132b31b233c65734de04939ce65sewardj  WITHOUT ANY WARRANTY; without even the implied warranty of
190de80192f57cd132b31b233c65734de04939ce65sewardj  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
200de80192f57cd132b31b233c65734de04939ce65sewardj  General Public License for more details.
210de80192f57cd132b31b233c65734de04939ce65sewardj
220de80192f57cd132b31b233c65734de04939ce65sewardj  You should have received a copy of the GNU General Public License
230de80192f57cd132b31b233c65734de04939ce65sewardj  along with this program; if not, write to the Free Software
240de80192f57cd132b31b233c65734de04939ce65sewardj  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
250de80192f57cd132b31b233c65734de04939ce65sewardj  02111-1307, USA.
260de80192f57cd132b31b233c65734de04939ce65sewardj
270de80192f57cd132b31b233c65734de04939ce65sewardj  The GNU General Public License is contained in the file COPYING.
280de80192f57cd132b31b233c65734de04939ce65sewardj*/
290de80192f57cd132b31b233c65734de04939ce65sewardj
300de80192f57cd132b31b233c65734de04939ce65sewardj/* Contributed by Zhi-Gang Liu <zliu at tilera dot com> */
310de80192f57cd132b31b233c65734de04939ce65sewardj
320de80192f57cd132b31b233c65734de04939ce65sewardj/* Translates TILEGX code to IR. */
330de80192f57cd132b31b233c65734de04939ce65sewardj
340de80192f57cd132b31b233c65734de04939ce65sewardj#include "libvex_basictypes.h"
350de80192f57cd132b31b233c65734de04939ce65sewardj#include "libvex_ir.h"
360de80192f57cd132b31b233c65734de04939ce65sewardj#include "libvex.h"
370de80192f57cd132b31b233c65734de04939ce65sewardj#include "libvex_guest_tilegx.h"
380de80192f57cd132b31b233c65734de04939ce65sewardj
390de80192f57cd132b31b233c65734de04939ce65sewardj#include "main_util.h"
400de80192f57cd132b31b233c65734de04939ce65sewardj#include "main_globals.h"
410de80192f57cd132b31b233c65734de04939ce65sewardj#include "guest_generic_bb_to_IR.h"
420de80192f57cd132b31b233c65734de04939ce65sewardj#include "guest_tilegx_defs.h"
430de80192f57cd132b31b233c65734de04939ce65sewardj#include "tilegx_disasm.h"
440de80192f57cd132b31b233c65734de04939ce65sewardj
450de80192f57cd132b31b233c65734de04939ce65sewardj/*------------------------------------------------------------*/
460de80192f57cd132b31b233c65734de04939ce65sewardj/*--- Globals                                              ---*/
470de80192f57cd132b31b233c65734de04939ce65sewardj/*------------------------------------------------------------*/
480de80192f57cd132b31b233c65734de04939ce65sewardj
490de80192f57cd132b31b233c65734de04939ce65sewardj/* These are set at the start of the translation of a instruction, so
500de80192f57cd132b31b233c65734de04939ce65sewardj   that we don't have to pass them around endlessly.  CONST means does
510de80192f57cd132b31b233c65734de04939ce65sewardj   not change during translation of the instruction.
520de80192f57cd132b31b233c65734de04939ce65sewardj*/
530de80192f57cd132b31b233c65734de04939ce65sewardj
540de80192f57cd132b31b233c65734de04939ce65sewardj/* CONST: is the host bigendian?  This has to do with float vs double
550de80192f57cd132b31b233c65734de04939ce65sewardj   register accesses on VFP, but it's complex and not properly thought
560de80192f57cd132b31b233c65734de04939ce65sewardj   out. */
570de80192f57cd132b31b233c65734de04939ce65sewardjstatic VexEndness host_endness;
580de80192f57cd132b31b233c65734de04939ce65sewardj
590de80192f57cd132b31b233c65734de04939ce65sewardj/* Pointer to the guest code area. */
600de80192f57cd132b31b233c65734de04939ce65sewardjstatic UChar *guest_code;
610de80192f57cd132b31b233c65734de04939ce65sewardj
620de80192f57cd132b31b233c65734de04939ce65sewardj/* The guest address corresponding to guest_code[0]. */
630de80192f57cd132b31b233c65734de04939ce65sewardjstatic Addr64 guest_PC_bbstart;
640de80192f57cd132b31b233c65734de04939ce65sewardj
650de80192f57cd132b31b233c65734de04939ce65sewardj/* CONST: The guest address for the instruction currently being
660de80192f57cd132b31b233c65734de04939ce65sewardj   translated. */
670de80192f57cd132b31b233c65734de04939ce65sewardjstatic Addr64 guest_PC_curr_instr;
680de80192f57cd132b31b233c65734de04939ce65sewardj
690de80192f57cd132b31b233c65734de04939ce65sewardj/* MOD: The IRSB* into which we're generating code. */
700de80192f57cd132b31b233c65734de04939ce65sewardjstatic IRSB *irsb;
710de80192f57cd132b31b233c65734de04939ce65sewardj
720de80192f57cd132b31b233c65734de04939ce65sewardj/*------------------------------------------------------------*/
730de80192f57cd132b31b233c65734de04939ce65sewardj/*--- Debugging output                                     ---*/
740de80192f57cd132b31b233c65734de04939ce65sewardj/*------------------------------------------------------------*/
750de80192f57cd132b31b233c65734de04939ce65sewardj
760de80192f57cd132b31b233c65734de04939ce65sewardj#define DIP(format, args...)                    \
770de80192f57cd132b31b233c65734de04939ce65sewardj  if (vex_traceflags & VEX_TRACE_FE)            \
780de80192f57cd132b31b233c65734de04939ce65sewardj    vex_printf(format, ## args)
790de80192f57cd132b31b233c65734de04939ce65sewardj
800de80192f57cd132b31b233c65734de04939ce65sewardj/*------------------------------------------------------------*/
810de80192f57cd132b31b233c65734de04939ce65sewardj/*--- Helper bits and pieces for deconstructing the        ---*/
820de80192f57cd132b31b233c65734de04939ce65sewardj/*--- tilegx insn stream.                                  ---*/
830de80192f57cd132b31b233c65734de04939ce65sewardj/*------------------------------------------------------------*/
840de80192f57cd132b31b233c65734de04939ce65sewardj
850de80192f57cd132b31b233c65734de04939ce65sewardjstatic Int integerGuestRegOffset ( UInt iregNo )
860de80192f57cd132b31b233c65734de04939ce65sewardj{
870de80192f57cd132b31b233c65734de04939ce65sewardj  return 8 * (iregNo);
880de80192f57cd132b31b233c65734de04939ce65sewardj}
890de80192f57cd132b31b233c65734de04939ce65sewardj
900de80192f57cd132b31b233c65734de04939ce65sewardj/*------------------------------------------------------------*/
910de80192f57cd132b31b233c65734de04939ce65sewardj/*---                           Field helpers              ---*/
920de80192f57cd132b31b233c65734de04939ce65sewardj/*------------------------------------------------------------*/
930de80192f57cd132b31b233c65734de04939ce65sewardj
940de80192f57cd132b31b233c65734de04939ce65sewardj/*------------------------------------------------------------*/
950de80192f57cd132b31b233c65734de04939ce65sewardj/*--- Helper bits and pieces for creating IR fragments.    ---*/
960de80192f57cd132b31b233c65734de04939ce65sewardj/*------------------------------------------------------------*/
970de80192f57cd132b31b233c65734de04939ce65sewardj
980de80192f57cd132b31b233c65734de04939ce65sewardjstatic IRExpr *mkU8 ( UInt i )
990de80192f57cd132b31b233c65734de04939ce65sewardj{
1000de80192f57cd132b31b233c65734de04939ce65sewardj  return IRExpr_Const(IRConst_U8((UChar) i));
1010de80192f57cd132b31b233c65734de04939ce65sewardj}
1020de80192f57cd132b31b233c65734de04939ce65sewardj
1030de80192f57cd132b31b233c65734de04939ce65sewardj/* Create an expression node for a 32-bit integer constant */
1040de80192f57cd132b31b233c65734de04939ce65sewardjstatic IRExpr *mkU32 ( UInt i )
1050de80192f57cd132b31b233c65734de04939ce65sewardj{
1060de80192f57cd132b31b233c65734de04939ce65sewardj  return IRExpr_Const(IRConst_U32(i));
1070de80192f57cd132b31b233c65734de04939ce65sewardj}
1080de80192f57cd132b31b233c65734de04939ce65sewardj
1090de80192f57cd132b31b233c65734de04939ce65sewardj/* Create an expression node for a 64-bit integer constant */
1100de80192f57cd132b31b233c65734de04939ce65sewardjstatic IRExpr *mkU64 ( ULong i )
1110de80192f57cd132b31b233c65734de04939ce65sewardj{
1120de80192f57cd132b31b233c65734de04939ce65sewardj  return IRExpr_Const(IRConst_U64(i));
1130de80192f57cd132b31b233c65734de04939ce65sewardj}
1140de80192f57cd132b31b233c65734de04939ce65sewardj
1150de80192f57cd132b31b233c65734de04939ce65sewardjstatic IRExpr *mkexpr ( IRTemp tmp )
1160de80192f57cd132b31b233c65734de04939ce65sewardj{
1170de80192f57cd132b31b233c65734de04939ce65sewardj  return IRExpr_RdTmp(tmp);
1180de80192f57cd132b31b233c65734de04939ce65sewardj}
1190de80192f57cd132b31b233c65734de04939ce65sewardj
1200de80192f57cd132b31b233c65734de04939ce65sewardjstatic IRExpr *unop ( IROp op, IRExpr * a )
1210de80192f57cd132b31b233c65734de04939ce65sewardj{
1220de80192f57cd132b31b233c65734de04939ce65sewardj  return IRExpr_Unop(op, a);
1230de80192f57cd132b31b233c65734de04939ce65sewardj}
1240de80192f57cd132b31b233c65734de04939ce65sewardj
1250de80192f57cd132b31b233c65734de04939ce65sewardjstatic IRExpr *binop ( IROp op, IRExpr * a1, IRExpr * a2 )
1260de80192f57cd132b31b233c65734de04939ce65sewardj{
1270de80192f57cd132b31b233c65734de04939ce65sewardj  return IRExpr_Binop(op, a1, a2);
1280de80192f57cd132b31b233c65734de04939ce65sewardj}
1290de80192f57cd132b31b233c65734de04939ce65sewardj
1300de80192f57cd132b31b233c65734de04939ce65sewardjstatic IRExpr *load ( IRType ty, IRExpr * addr )
1310de80192f57cd132b31b233c65734de04939ce65sewardj{
1320de80192f57cd132b31b233c65734de04939ce65sewardj  IRExpr *load1 = NULL;
1330de80192f57cd132b31b233c65734de04939ce65sewardj
1340de80192f57cd132b31b233c65734de04939ce65sewardj  load1 = IRExpr_Load(Iend_LE, ty, addr);
1350de80192f57cd132b31b233c65734de04939ce65sewardj  return load1;
1360de80192f57cd132b31b233c65734de04939ce65sewardj}
1370de80192f57cd132b31b233c65734de04939ce65sewardj
1380de80192f57cd132b31b233c65734de04939ce65sewardj/* Add a statement to the list held by "irsb". */
1390de80192f57cd132b31b233c65734de04939ce65sewardjstatic void stmt ( IRStmt * st )
1400de80192f57cd132b31b233c65734de04939ce65sewardj{
1410de80192f57cd132b31b233c65734de04939ce65sewardj  addStmtToIRSB(irsb, st);
1420de80192f57cd132b31b233c65734de04939ce65sewardj}
1430de80192f57cd132b31b233c65734de04939ce65sewardj
1440de80192f57cd132b31b233c65734de04939ce65sewardj#define OFFB_PC     offsetof(VexGuestTILEGXState, guest_pc)
1450de80192f57cd132b31b233c65734de04939ce65sewardj
1460de80192f57cd132b31b233c65734de04939ce65sewardjstatic void putPC ( IRExpr * e )
1470de80192f57cd132b31b233c65734de04939ce65sewardj{
1480de80192f57cd132b31b233c65734de04939ce65sewardj  stmt(IRStmt_Put(OFFB_PC, e));
1490de80192f57cd132b31b233c65734de04939ce65sewardj}
1500de80192f57cd132b31b233c65734de04939ce65sewardj
1510de80192f57cd132b31b233c65734de04939ce65sewardjstatic void assign ( IRTemp dst, IRExpr * e )
1520de80192f57cd132b31b233c65734de04939ce65sewardj{
1530de80192f57cd132b31b233c65734de04939ce65sewardj  stmt(IRStmt_WrTmp(dst, e));
1540de80192f57cd132b31b233c65734de04939ce65sewardj}
1550de80192f57cd132b31b233c65734de04939ce65sewardj
1560de80192f57cd132b31b233c65734de04939ce65sewardjstatic void store ( IRExpr * addr, IRExpr * data )
1570de80192f57cd132b31b233c65734de04939ce65sewardj{
1580de80192f57cd132b31b233c65734de04939ce65sewardj  stmt(IRStmt_Store(Iend_LE, addr, data));
1590de80192f57cd132b31b233c65734de04939ce65sewardj}
1600de80192f57cd132b31b233c65734de04939ce65sewardj
1610de80192f57cd132b31b233c65734de04939ce65sewardj/* Generate a new temporary of the given type. */
1620de80192f57cd132b31b233c65734de04939ce65sewardjstatic IRTemp newTemp ( IRType ty )
1630de80192f57cd132b31b233c65734de04939ce65sewardj{
1640de80192f57cd132b31b233c65734de04939ce65sewardj  vassert(isPlausibleIRType(ty));
1650de80192f57cd132b31b233c65734de04939ce65sewardj  return newIRTemp(irsb->tyenv, ty);
1660de80192f57cd132b31b233c65734de04939ce65sewardj}
1670de80192f57cd132b31b233c65734de04939ce65sewardj
1680de80192f57cd132b31b233c65734de04939ce65sewardjstatic ULong extend_s_16to64 ( UInt x )
1690de80192f57cd132b31b233c65734de04939ce65sewardj{
1700de80192f57cd132b31b233c65734de04939ce65sewardj  return (ULong) ((((Long) x) << 48) >> 48);
1710de80192f57cd132b31b233c65734de04939ce65sewardj}
1720de80192f57cd132b31b233c65734de04939ce65sewardj
1730de80192f57cd132b31b233c65734de04939ce65sewardjstatic ULong extend_s_8to64 ( UInt x )
1740de80192f57cd132b31b233c65734de04939ce65sewardj{
1750de80192f57cd132b31b233c65734de04939ce65sewardj  return (ULong) ((((Long) x) << 56) >> 56);
1760de80192f57cd132b31b233c65734de04939ce65sewardj}
1770de80192f57cd132b31b233c65734de04939ce65sewardj
1780de80192f57cd132b31b233c65734de04939ce65sewardjstatic IRExpr *getIReg ( UInt iregNo )
1790de80192f57cd132b31b233c65734de04939ce65sewardj{
1800de80192f57cd132b31b233c65734de04939ce65sewardj  IRType ty = Ity_I64;
1810de80192f57cd132b31b233c65734de04939ce65sewardj  if(!(iregNo < 56 || iregNo == 63 ||
1820de80192f57cd132b31b233c65734de04939ce65sewardj       (iregNo >= 70 && iregNo <= 73))) {
183b173774421d015736c2316b5e6e998e7de545a5cflorian    vex_printf("iregNo=%u\n", iregNo);
1840de80192f57cd132b31b233c65734de04939ce65sewardj    vassert(0);
1850de80192f57cd132b31b233c65734de04939ce65sewardj  }
1860de80192f57cd132b31b233c65734de04939ce65sewardj  return IRExpr_Get(integerGuestRegOffset(iregNo), ty);
1870de80192f57cd132b31b233c65734de04939ce65sewardj}
1880de80192f57cd132b31b233c65734de04939ce65sewardj
1890de80192f57cd132b31b233c65734de04939ce65sewardjstatic void putIReg ( UInt archreg, IRExpr * e )
1900de80192f57cd132b31b233c65734de04939ce65sewardj{
1910de80192f57cd132b31b233c65734de04939ce65sewardj  IRType ty = Ity_I64;
1920de80192f57cd132b31b233c65734de04939ce65sewardj  if(!(archreg < 56 || archreg == 63 || archreg == 70 ||
1930de80192f57cd132b31b233c65734de04939ce65sewardj       archreg == 72 || archreg == 73)) {
194b173774421d015736c2316b5e6e998e7de545a5cflorian    vex_printf("archreg=%u\n", archreg);
1950de80192f57cd132b31b233c65734de04939ce65sewardj    vassert(0);
1960de80192f57cd132b31b233c65734de04939ce65sewardj  }
1970de80192f57cd132b31b233c65734de04939ce65sewardj  vassert(typeOfIRExpr(irsb->tyenv, e) == ty);
1980de80192f57cd132b31b233c65734de04939ce65sewardj  if (archreg != 63)
1990de80192f57cd132b31b233c65734de04939ce65sewardj    stmt(IRStmt_Put(integerGuestRegOffset(archreg), e));
2000de80192f57cd132b31b233c65734de04939ce65sewardj}
2010de80192f57cd132b31b233c65734de04939ce65sewardj
2020de80192f57cd132b31b233c65734de04939ce65sewardj/* Narrow 8/16/32 bit int expr to 8/16/32.  Clearly only some
2030de80192f57cd132b31b233c65734de04939ce65sewardj   of these combinations make sense. */
2040de80192f57cd132b31b233c65734de04939ce65sewardjstatic IRExpr *narrowTo ( IRType dst_ty, IRExpr * e )
2050de80192f57cd132b31b233c65734de04939ce65sewardj{
2060de80192f57cd132b31b233c65734de04939ce65sewardj  IRType src_ty = typeOfIRExpr(irsb->tyenv, e);
2070de80192f57cd132b31b233c65734de04939ce65sewardj  if (src_ty == dst_ty)
2080de80192f57cd132b31b233c65734de04939ce65sewardj    return e;
2090de80192f57cd132b31b233c65734de04939ce65sewardj  if (src_ty == Ity_I32 && dst_ty == Ity_I16)
2100de80192f57cd132b31b233c65734de04939ce65sewardj    return unop(Iop_32to16, e);
2110de80192f57cd132b31b233c65734de04939ce65sewardj  if (src_ty == Ity_I32 && dst_ty == Ity_I8)
2120de80192f57cd132b31b233c65734de04939ce65sewardj    return unop(Iop_32to8, e);
2130de80192f57cd132b31b233c65734de04939ce65sewardj
2140de80192f57cd132b31b233c65734de04939ce65sewardj  if (src_ty == Ity_I64 && dst_ty == Ity_I8) {
2150de80192f57cd132b31b233c65734de04939ce65sewardj    return unop(Iop_64to8, e);
2160de80192f57cd132b31b233c65734de04939ce65sewardj  }
2170de80192f57cd132b31b233c65734de04939ce65sewardj  if (src_ty == Ity_I64 && dst_ty == Ity_I16) {
2180de80192f57cd132b31b233c65734de04939ce65sewardj    return unop(Iop_64to16, e);
2190de80192f57cd132b31b233c65734de04939ce65sewardj  }
2200de80192f57cd132b31b233c65734de04939ce65sewardj  if (src_ty == Ity_I64 && dst_ty == Ity_I32) {
2210de80192f57cd132b31b233c65734de04939ce65sewardj    return unop(Iop_64to32, e);
2220de80192f57cd132b31b233c65734de04939ce65sewardj  }
2230de80192f57cd132b31b233c65734de04939ce65sewardj
2240de80192f57cd132b31b233c65734de04939ce65sewardj  if (vex_traceflags & VEX_TRACE_FE) {
2250de80192f57cd132b31b233c65734de04939ce65sewardj    vex_printf("\nsrc, dst tys are: ");
2260de80192f57cd132b31b233c65734de04939ce65sewardj    ppIRType(src_ty);
2270de80192f57cd132b31b233c65734de04939ce65sewardj    vex_printf(", ");
2280de80192f57cd132b31b233c65734de04939ce65sewardj    ppIRType(dst_ty);
2290de80192f57cd132b31b233c65734de04939ce65sewardj    vex_printf("\n");
2300de80192f57cd132b31b233c65734de04939ce65sewardj  }
2310de80192f57cd132b31b233c65734de04939ce65sewardj  vpanic("narrowTo(tilegx)");
2320de80192f57cd132b31b233c65734de04939ce65sewardj  return e;
2330de80192f57cd132b31b233c65734de04939ce65sewardj}
2340de80192f57cd132b31b233c65734de04939ce65sewardj
2350de80192f57cd132b31b233c65734de04939ce65sewardj#define signExtend(_e, _n)                                              \
2360de80192f57cd132b31b233c65734de04939ce65sewardj  ((_n == 32) ?                                                         \
2370de80192f57cd132b31b233c65734de04939ce65sewardj   unop(Iop_32Sto64, _e) :                                              \
2380de80192f57cd132b31b233c65734de04939ce65sewardj   ((_n == 16) ?                                                        \
23932bf4136270f100788bcad4edb7d47e1b43df254zliu    unop(Iop_16Sto64, _e) :						\
2400de80192f57cd132b31b233c65734de04939ce65sewardj    (binop(Iop_Sar64, binop(Iop_Shl64, _e, mkU8(63 - (_n))), mkU8(63 - (_n))))))
2410de80192f57cd132b31b233c65734de04939ce65sewardj
2420de80192f57cd132b31b233c65734de04939ce65sewardjstatic IRStmt* dis_branch ( IRExpr* guard, ULong imm )
2430de80192f57cd132b31b233c65734de04939ce65sewardj{
2440de80192f57cd132b31b233c65734de04939ce65sewardj  IRTemp t0;
2450de80192f57cd132b31b233c65734de04939ce65sewardj
2460de80192f57cd132b31b233c65734de04939ce65sewardj  t0 = newTemp(Ity_I1);
2470de80192f57cd132b31b233c65734de04939ce65sewardj  assign(t0, guard);
2480de80192f57cd132b31b233c65734de04939ce65sewardj  return IRStmt_Exit(mkexpr(t0), Ijk_Boring,
2490de80192f57cd132b31b233c65734de04939ce65sewardj                     IRConst_U64(imm), OFFB_PC);
2500de80192f57cd132b31b233c65734de04939ce65sewardj}
2510de80192f57cd132b31b233c65734de04939ce65sewardj
2520de80192f57cd132b31b233c65734de04939ce65sewardj#define  MARK_REG_WB(_rd, _td)                  \
2530de80192f57cd132b31b233c65734de04939ce65sewardj  do {                                          \
2540de80192f57cd132b31b233c65734de04939ce65sewardj    vassert(rd_wb_index < 6);                   \
2550de80192f57cd132b31b233c65734de04939ce65sewardj    rd_wb_temp[rd_wb_index] = _td;              \
2560de80192f57cd132b31b233c65734de04939ce65sewardj    rd_wb_reg[rd_wb_index] = _rd;               \
2570de80192f57cd132b31b233c65734de04939ce65sewardj    rd_wb_index++;                              \
2580de80192f57cd132b31b233c65734de04939ce65sewardj  } while(0)
2590de80192f57cd132b31b233c65734de04939ce65sewardj
26032de7768a661c2dcd5e13dba881ad020161073abzliu
26132de7768a661c2dcd5e13dba881ad020161073abzliu/* Expand/repeat byte _X 8 times to a 64-bit value */
26232de7768a661c2dcd5e13dba881ad020161073abzliu#define  V1EXP(_X)                                     \
26332de7768a661c2dcd5e13dba881ad020161073abzliu  ({                                                   \
26432de7768a661c2dcd5e13dba881ad020161073abzliu    _X = ((((UChar)(_X)) << 8) | ((UChar)(_X)));       \
26532de7768a661c2dcd5e13dba881ad020161073abzliu    _X = (((_X) << 16) | (_X));                        \
26632de7768a661c2dcd5e13dba881ad020161073abzliu    (((_X) << 32) | (_X));                             \
26732de7768a661c2dcd5e13dba881ad020161073abzliu  })
26832de7768a661c2dcd5e13dba881ad020161073abzliu
26932de7768a661c2dcd5e13dba881ad020161073abzliu/* Expand/repeat byte _X 4 times to a 64-bit value */
27032de7768a661c2dcd5e13dba881ad020161073abzliu#define  V2EXP(_X)                                 \
27132de7768a661c2dcd5e13dba881ad020161073abzliu  ({                                               \
27232de7768a661c2dcd5e13dba881ad020161073abzliu    _X = ((((UChar)(_X)) << 16) | ((UChar)(_X)));  \
27332de7768a661c2dcd5e13dba881ad020161073abzliu    (((_X) << 32) | (_X));                         \
27432de7768a661c2dcd5e13dba881ad020161073abzliu  })
27532de7768a661c2dcd5e13dba881ad020161073abzliu
2760de80192f57cd132b31b233c65734de04939ce65sewardj/*------------------------------------------------------------*/
2770de80192f57cd132b31b233c65734de04939ce65sewardj/*--- Disassemble a single instruction                     ---*/
2780de80192f57cd132b31b233c65734de04939ce65sewardj/*------------------------------------------------------------*/
2790de80192f57cd132b31b233c65734de04939ce65sewardj
2800de80192f57cd132b31b233c65734de04939ce65sewardj/* Disassemble a single instruction bundle into IR.  The bundle is
2810de80192f57cd132b31b233c65734de04939ce65sewardj   located in host memory at guest_instr, and has guest IP of
2820de80192f57cd132b31b233c65734de04939ce65sewardj   guest_PC_curr_instr, which will have been set before the call
2830de80192f57cd132b31b233c65734de04939ce65sewardj   here. */
2840de80192f57cd132b31b233c65734de04939ce65sewardjstatic DisResult disInstr_TILEGX_WRK ( Bool(*resteerOkFn) (void *, Addr),
2850de80192f57cd132b31b233c65734de04939ce65sewardj                                       Bool resteerCisOk,
2860de80192f57cd132b31b233c65734de04939ce65sewardj                                       void *callback_opaque,
2870de80192f57cd132b31b233c65734de04939ce65sewardj                                       Long delta64,
2880de80192f57cd132b31b233c65734de04939ce65sewardj                                       const VexArchInfo * archinfo,
2890de80192f57cd132b31b233c65734de04939ce65sewardj                                       const VexAbiInfo * abiinfo,
2900de80192f57cd132b31b233c65734de04939ce65sewardj                                       Bool sigill_diag )
2910de80192f57cd132b31b233c65734de04939ce65sewardj{
2920de80192f57cd132b31b233c65734de04939ce65sewardj  struct tilegx_decoded_instruction
2930de80192f57cd132b31b233c65734de04939ce65sewardj    decoded[TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE];
29432bf4136270f100788bcad4edb7d47e1b43df254zliu  ULong  cins, opcode = -1, rd, ra, rb, imm = 0;
2950de80192f57cd132b31b233c65734de04939ce65sewardj  ULong  opd[4];
2960de80192f57cd132b31b233c65734de04939ce65sewardj  ULong  opd_src_map, opd_dst_map, opd_imm_map;
2970de80192f57cd132b31b233c65734de04939ce65sewardj  Int    use_dirty_helper;
2980de80192f57cd132b31b233c65734de04939ce65sewardj  IRTemp t0, t1, t2, t3, t4;
2990de80192f57cd132b31b233c65734de04939ce65sewardj  IRTemp tb[4];
3000de80192f57cd132b31b233c65734de04939ce65sewardj  IRTemp rd_wb_temp[6];
3010de80192f57cd132b31b233c65734de04939ce65sewardj  ULong  rd_wb_reg[6];
3020de80192f57cd132b31b233c65734de04939ce65sewardj  /* Tilegx is a VLIW processor, we have to commit register write after read.*/
3030de80192f57cd132b31b233c65734de04939ce65sewardj  Int    rd_wb_index;
30432bf4136270f100788bcad4edb7d47e1b43df254zliu  Int    n = 0, nr_insn;
3050de80192f57cd132b31b233c65734de04939ce65sewardj  DisResult dres;
3060de80192f57cd132b31b233c65734de04939ce65sewardj
3070de80192f57cd132b31b233c65734de04939ce65sewardj  /* The running delta */
3080de80192f57cd132b31b233c65734de04939ce65sewardj  Long delta = delta64;
3090de80192f57cd132b31b233c65734de04939ce65sewardj
3100de80192f57cd132b31b233c65734de04939ce65sewardj  /* Holds pc at the start of the insn, so that we can print
3110de80192f57cd132b31b233c65734de04939ce65sewardj     consistent error messages for unimplemented insns. */
3120de80192f57cd132b31b233c65734de04939ce65sewardj  //Long delta_start = delta;
3130de80192f57cd132b31b233c65734de04939ce65sewardj
3140de80192f57cd132b31b233c65734de04939ce65sewardj  UChar *code = (UChar *) (guest_code + delta);
3150de80192f57cd132b31b233c65734de04939ce65sewardj
3160de80192f57cd132b31b233c65734de04939ce65sewardj  IRStmt *bstmt = NULL;  /* Branch statement. */
3170de80192f57cd132b31b233c65734de04939ce65sewardj  IRExpr *next = NULL; /* Next bundle expr. */
3180de80192f57cd132b31b233c65734de04939ce65sewardj  ULong  jumpkind =  Ijk_Boring;
3190de80192f57cd132b31b233c65734de04939ce65sewardj  ULong  steering_pc;
3200de80192f57cd132b31b233c65734de04939ce65sewardj
3210de80192f57cd132b31b233c65734de04939ce65sewardj  /* Set result defaults. */
3220de80192f57cd132b31b233c65734de04939ce65sewardj  dres.whatNext = Dis_Continue;
3230de80192f57cd132b31b233c65734de04939ce65sewardj  dres.len = 0;
3240de80192f57cd132b31b233c65734de04939ce65sewardj  dres.continueAt = 0;
3250de80192f57cd132b31b233c65734de04939ce65sewardj  dres.jk_StopHere = Ijk_INVALID;
3260de80192f57cd132b31b233c65734de04939ce65sewardj
3270de80192f57cd132b31b233c65734de04939ce65sewardj  /* Verify the code addr is 8-byte aligned. */
32832bf4136270f100788bcad4edb7d47e1b43df254zliu  vassert((((Addr)code) & 7) == 0);
3290de80192f57cd132b31b233c65734de04939ce65sewardj
3300de80192f57cd132b31b233c65734de04939ce65sewardj  /* Get the instruction bundle. */
3310de80192f57cd132b31b233c65734de04939ce65sewardj  cins = *((ULong *)(Addr) code);
3320de80192f57cd132b31b233c65734de04939ce65sewardj
3330de80192f57cd132b31b233c65734de04939ce65sewardj  /* "Special" instructions. */
3340de80192f57cd132b31b233c65734de04939ce65sewardj  /* Spot the 16-byte preamble:   ****tilegx****
3350de80192f57cd132b31b233c65734de04939ce65sewardj     0:02b3c7ff91234fff { moveli zero, 4660 ; moveli zero, 22136 }
3360de80192f57cd132b31b233c65734de04939ce65sewardj     8:0091a7ff95678fff { moveli zero, 22136 ; moveli zero, 4660 }
3370de80192f57cd132b31b233c65734de04939ce65sewardj  */
3380de80192f57cd132b31b233c65734de04939ce65sewardj#define CL_W0 0x02b3c7ff91234fffULL
3390de80192f57cd132b31b233c65734de04939ce65sewardj#define CL_W1 0x0091a7ff95678fffULL
3400de80192f57cd132b31b233c65734de04939ce65sewardj
3410de80192f57cd132b31b233c65734de04939ce65sewardj  if (*((ULong*)(Addr)(code)) == CL_W0 &&
3420de80192f57cd132b31b233c65734de04939ce65sewardj      *((ULong*)(Addr)(code + 8)) == CL_W1) {
3430de80192f57cd132b31b233c65734de04939ce65sewardj    /* Got a "Special" instruction preamble.  Which one is it? */
3440de80192f57cd132b31b233c65734de04939ce65sewardj    if (*((ULong*)(Addr)(code + 16)) ==
3450de80192f57cd132b31b233c65734de04939ce65sewardj        0x283a69a6d1483000ULL /* or r13, r13, r13 */ ) {
3460de80192f57cd132b31b233c65734de04939ce65sewardj      /* r0 = client_request ( r12 ) */
3470de80192f57cd132b31b233c65734de04939ce65sewardj      DIP("r0 = client_request ( r12 )\n");
3480de80192f57cd132b31b233c65734de04939ce65sewardj
3490de80192f57cd132b31b233c65734de04939ce65sewardj      putPC(mkU64(guest_PC_curr_instr + 24));
3500de80192f57cd132b31b233c65734de04939ce65sewardj
3510de80192f57cd132b31b233c65734de04939ce65sewardj      dres.jk_StopHere = Ijk_ClientReq;
3520de80192f57cd132b31b233c65734de04939ce65sewardj      dres.whatNext = Dis_StopHere;
3530de80192f57cd132b31b233c65734de04939ce65sewardj      dres.len = 24;
3540de80192f57cd132b31b233c65734de04939ce65sewardj      goto decode_success;
3550de80192f57cd132b31b233c65734de04939ce65sewardj
3560de80192f57cd132b31b233c65734de04939ce65sewardj    } else if (*((ULong*)(Addr)(code + 16)) ==
3570de80192f57cd132b31b233c65734de04939ce65sewardj               0x283a71c751483000ULL /* or r14, r14, r14 */ ) {
3580de80192f57cd132b31b233c65734de04939ce65sewardj      /* r11 = guest_NRADDR */
3590de80192f57cd132b31b233c65734de04939ce65sewardj      DIP("r11 = guest_NRADDR\n");
3600de80192f57cd132b31b233c65734de04939ce65sewardj      dres.len = 24;
3610de80192f57cd132b31b233c65734de04939ce65sewardj      putIReg(11, IRExpr_Get(offsetof(VexGuestTILEGXState, guest_NRADDR),
3620de80192f57cd132b31b233c65734de04939ce65sewardj                             Ity_I64));
3630de80192f57cd132b31b233c65734de04939ce65sewardj      putPC(mkU64(guest_PC_curr_instr + 8));
3640de80192f57cd132b31b233c65734de04939ce65sewardj      goto decode_success;
3650de80192f57cd132b31b233c65734de04939ce65sewardj
3660de80192f57cd132b31b233c65734de04939ce65sewardj    } else if (*((ULong*)(Addr)(code + 16)) ==
3670de80192f57cd132b31b233c65734de04939ce65sewardj               0x283a79e7d1483000ULL  /* or r15, r15, r15 */ ) {
3680de80192f57cd132b31b233c65734de04939ce65sewardj      /*  branch-and-link-to-noredir r12 */
3690de80192f57cd132b31b233c65734de04939ce65sewardj      DIP("branch-and-link-to-noredir r12\n");
3700de80192f57cd132b31b233c65734de04939ce65sewardj      dres.len = 24;
3710de80192f57cd132b31b233c65734de04939ce65sewardj      putIReg(55, mkU64(guest_PC_curr_instr + 24));
3720de80192f57cd132b31b233c65734de04939ce65sewardj
3730de80192f57cd132b31b233c65734de04939ce65sewardj      putPC(getIReg(12));
3740de80192f57cd132b31b233c65734de04939ce65sewardj
3750de80192f57cd132b31b233c65734de04939ce65sewardj      dres.jk_StopHere = Ijk_NoRedir;
3760de80192f57cd132b31b233c65734de04939ce65sewardj      dres.whatNext = Dis_StopHere;
3770de80192f57cd132b31b233c65734de04939ce65sewardj      goto decode_success;
3780de80192f57cd132b31b233c65734de04939ce65sewardj
3790de80192f57cd132b31b233c65734de04939ce65sewardj    }  else if (*((ULong*)(Addr)(code + 16)) ==
3800de80192f57cd132b31b233c65734de04939ce65sewardj                0x283a5965d1483000ULL  /* or r11, r11, r11 */ ) {
3810de80192f57cd132b31b233c65734de04939ce65sewardj      /*  vex-inject-ir */
3820de80192f57cd132b31b233c65734de04939ce65sewardj      DIP("vex-inject-ir\n");
3830de80192f57cd132b31b233c65734de04939ce65sewardj      dres.len = 24;
3840de80192f57cd132b31b233c65734de04939ce65sewardj
3850de80192f57cd132b31b233c65734de04939ce65sewardj      vex_inject_ir(irsb, Iend_LE);
3860de80192f57cd132b31b233c65734de04939ce65sewardj
3870de80192f57cd132b31b233c65734de04939ce65sewardj      stmt(IRStmt_Put(offsetof(VexGuestTILEGXState, guest_CMSTART),
3880de80192f57cd132b31b233c65734de04939ce65sewardj                      mkU64(guest_PC_curr_instr)));
3890de80192f57cd132b31b233c65734de04939ce65sewardj      stmt(IRStmt_Put(offsetof(VexGuestTILEGXState, guest_CMLEN),
3900de80192f57cd132b31b233c65734de04939ce65sewardj                      mkU64(24)));
3910de80192f57cd132b31b233c65734de04939ce65sewardj
3920de80192f57cd132b31b233c65734de04939ce65sewardj      /* 2 + 1 = 3 bundles. 24 bytes. */
3930de80192f57cd132b31b233c65734de04939ce65sewardj      putPC(mkU64(guest_PC_curr_instr + 24));
3940de80192f57cd132b31b233c65734de04939ce65sewardj
3950de80192f57cd132b31b233c65734de04939ce65sewardj      dres.jk_StopHere = Ijk_InvalICache;
3960de80192f57cd132b31b233c65734de04939ce65sewardj      dres.whatNext = Dis_StopHere;
3970de80192f57cd132b31b233c65734de04939ce65sewardj      goto decode_success;
3980de80192f57cd132b31b233c65734de04939ce65sewardj    }
3990de80192f57cd132b31b233c65734de04939ce65sewardj
4000de80192f57cd132b31b233c65734de04939ce65sewardj    /* We don't expect this. */
4010de80192f57cd132b31b233c65734de04939ce65sewardj    vex_printf("%s: unexpect special bundles at %lx\n",
4020de80192f57cd132b31b233c65734de04939ce65sewardj               __func__, (Addr)guest_PC_curr_instr);
4030de80192f57cd132b31b233c65734de04939ce65sewardj    delta += 16;
4040de80192f57cd132b31b233c65734de04939ce65sewardj    goto decode_failure;
4050de80192f57cd132b31b233c65734de04939ce65sewardj    /*NOTREACHED*/
4060de80192f57cd132b31b233c65734de04939ce65sewardj  }
4070de80192f57cd132b31b233c65734de04939ce65sewardj
4080de80192f57cd132b31b233c65734de04939ce65sewardj  /* To decode the given instruction bundle. */
4090de80192f57cd132b31b233c65734de04939ce65sewardj  nr_insn = parse_insn_tilegx((tilegx_bundle_bits)cins,
41032bf4136270f100788bcad4edb7d47e1b43df254zliu                              (ULong)(Addr)code,
4110de80192f57cd132b31b233c65734de04939ce65sewardj                              decoded);
4120de80192f57cd132b31b233c65734de04939ce65sewardj
4130de80192f57cd132b31b233c65734de04939ce65sewardj  if (vex_traceflags & VEX_TRACE_FE)
41432bf4136270f100788bcad4edb7d47e1b43df254zliu    decode_and_display(&cins, 1, (ULong)(Addr)code);
4150de80192f57cd132b31b233c65734de04939ce65sewardj
4160de80192f57cd132b31b233c65734de04939ce65sewardj  /* Init. rb_wb_index */
4170de80192f57cd132b31b233c65734de04939ce65sewardj  rd_wb_index = 0;
4180de80192f57cd132b31b233c65734de04939ce65sewardj
4190de80192f57cd132b31b233c65734de04939ce65sewardj  steering_pc = -1ULL;
4200de80192f57cd132b31b233c65734de04939ce65sewardj
4210de80192f57cd132b31b233c65734de04939ce65sewardj  for (n = 0; n < nr_insn; n++) {
4220de80192f57cd132b31b233c65734de04939ce65sewardj    opcode = decoded[n].opcode->mnemonic;
4230de80192f57cd132b31b233c65734de04939ce65sewardj    Int opi;
4240de80192f57cd132b31b233c65734de04939ce65sewardj
4250de80192f57cd132b31b233c65734de04939ce65sewardj    rd = ra = rb = -1;
4260de80192f57cd132b31b233c65734de04939ce65sewardj    opd[0] = opd[1] = opd[2] = opd[3] = -1;
4270de80192f57cd132b31b233c65734de04939ce65sewardj    opd_dst_map = 0;
4280de80192f57cd132b31b233c65734de04939ce65sewardj    opd_src_map = 0;
4290de80192f57cd132b31b233c65734de04939ce65sewardj    opd_imm_map = 0;
4300de80192f57cd132b31b233c65734de04939ce65sewardj
4310de80192f57cd132b31b233c65734de04939ce65sewardj    for (opi = 0; opi < decoded[n].opcode->num_operands; opi++) {
4320de80192f57cd132b31b233c65734de04939ce65sewardj      const struct tilegx_operand *op = decoded[n].operands[opi];
4330de80192f57cd132b31b233c65734de04939ce65sewardj      opd[opi] = decoded[n].operand_values[opi];
4340de80192f57cd132b31b233c65734de04939ce65sewardj
4350de80192f57cd132b31b233c65734de04939ce65sewardj      /* Set the operands. rd, ra, rb and imm. */
4360de80192f57cd132b31b233c65734de04939ce65sewardj      if (opi < 3) {
4370de80192f57cd132b31b233c65734de04939ce65sewardj        if (op->is_dest_reg) {
4380de80192f57cd132b31b233c65734de04939ce65sewardj          if (rd == -1)
4390de80192f57cd132b31b233c65734de04939ce65sewardj            rd =  decoded[n].operand_values[opi];
4400de80192f57cd132b31b233c65734de04939ce65sewardj          else if (ra == -1)
4410de80192f57cd132b31b233c65734de04939ce65sewardj            ra =  decoded[n].operand_values[opi];
4420de80192f57cd132b31b233c65734de04939ce65sewardj        } else if (op->is_src_reg) {
4430de80192f57cd132b31b233c65734de04939ce65sewardj          if (ra == -1) {
4440de80192f57cd132b31b233c65734de04939ce65sewardj            ra = decoded[n].operand_values[opi];
4450de80192f57cd132b31b233c65734de04939ce65sewardj          } else if(rb == -1) {
4460de80192f57cd132b31b233c65734de04939ce65sewardj            rb = decoded[n].operand_values[opi];
4470de80192f57cd132b31b233c65734de04939ce65sewardj          } else {
4480de80192f57cd132b31b233c65734de04939ce65sewardj            vassert(0);
4490de80192f57cd132b31b233c65734de04939ce65sewardj          }
4500de80192f57cd132b31b233c65734de04939ce65sewardj        } else {
4510de80192f57cd132b31b233c65734de04939ce65sewardj          imm = decoded[n].operand_values[opi];
4520de80192f57cd132b31b233c65734de04939ce65sewardj        }
4530de80192f57cd132b31b233c65734de04939ce65sewardj      }
4540de80192f57cd132b31b233c65734de04939ce65sewardj
4550de80192f57cd132b31b233c65734de04939ce65sewardj      /* Build bit maps of used dest, source registers
4560de80192f57cd132b31b233c65734de04939ce65sewardj         and immediate. */
4570de80192f57cd132b31b233c65734de04939ce65sewardj      if (op->is_dest_reg) {
4580de80192f57cd132b31b233c65734de04939ce65sewardj        opd_dst_map |= 1ULL << opi;
4590de80192f57cd132b31b233c65734de04939ce65sewardj        if(op->is_src_reg)
4600de80192f57cd132b31b233c65734de04939ce65sewardj          opd_src_map |= 1ULL << opi;
4610de80192f57cd132b31b233c65734de04939ce65sewardj      } else if(op->is_src_reg) {
4620de80192f57cd132b31b233c65734de04939ce65sewardj        opd_src_map |= 1ULL << opi;
4630de80192f57cd132b31b233c65734de04939ce65sewardj      } else {
4640de80192f57cd132b31b233c65734de04939ce65sewardj        opd_imm_map |= 1ULL << opi;
4650de80192f57cd132b31b233c65734de04939ce65sewardj      }
4660de80192f57cd132b31b233c65734de04939ce65sewardj    }
4670de80192f57cd132b31b233c65734de04939ce65sewardj
4680de80192f57cd132b31b233c65734de04939ce65sewardj    use_dirty_helper = 0;
4690de80192f57cd132b31b233c65734de04939ce65sewardj
4700de80192f57cd132b31b233c65734de04939ce65sewardj    switch (opcode) {
4710de80192f57cd132b31b233c65734de04939ce65sewardj    case 0:  /* "bpt" */  /* "raise" */
4720de80192f57cd132b31b233c65734de04939ce65sewardj      /* "bpt" pseudo instruction is an illegal instruction */
4730de80192f57cd132b31b233c65734de04939ce65sewardj      opd_imm_map |= (1 << 0);
4740de80192f57cd132b31b233c65734de04939ce65sewardj      opd[0] = cins;
4750de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
4760de80192f57cd132b31b233c65734de04939ce65sewardj      break;
4770de80192f57cd132b31b233c65734de04939ce65sewardj    case 1:  /* "info" */   /* Ignore this instruction. */
4780de80192f57cd132b31b233c65734de04939ce65sewardj      break;
4790de80192f57cd132b31b233c65734de04939ce65sewardj    case 2:  /* "infol" */   /* Ignore this instruction. */
4800de80192f57cd132b31b233c65734de04939ce65sewardj      break;
4810de80192f57cd132b31b233c65734de04939ce65sewardj    case 3:  /* "ld4s_tls" */   /* Ignore this instruction. */
4820de80192f57cd132b31b233c65734de04939ce65sewardj      break;
4830de80192f57cd132b31b233c65734de04939ce65sewardj    case 4:  /* "ld_tls" */    /* Ignore this instruction. */
4840de80192f57cd132b31b233c65734de04939ce65sewardj      break;
4850de80192f57cd132b31b233c65734de04939ce65sewardj    case 5:  /* "move" */
4860de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
4870de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, getIReg(ra));
4880de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
4890de80192f57cd132b31b233c65734de04939ce65sewardj      break;
4900de80192f57cd132b31b233c65734de04939ce65sewardj    case 6:  /* "movei" */
4910de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
4920de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, mkU64(extend_s_8to64(imm)));
4930de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
4940de80192f57cd132b31b233c65734de04939ce65sewardj      break;
4950de80192f57cd132b31b233c65734de04939ce65sewardj    case 7:  /* "moveli" */
4960de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
4970de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, mkU64(extend_s_16to64(imm)));
4980de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
4990de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5000de80192f57cd132b31b233c65734de04939ce65sewardj    case 8:  /* "prefetch" */   /* Ignore. */
5010de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5020de80192f57cd132b31b233c65734de04939ce65sewardj    case 9:  /* "prefetch_add_l1" */   /* Ignore. */
5030de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5040de80192f57cd132b31b233c65734de04939ce65sewardj    case 10: /* "prefetch_add_l1_fault" */   /* Ignore. */
5050de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5060de80192f57cd132b31b233c65734de04939ce65sewardj    case 11: /* "prefetch_add_l2" */   /* Ignore. */
5070de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5080de80192f57cd132b31b233c65734de04939ce65sewardj    case 12: /* "prefetch_add_l2_fault" */   /* Ignore. */
5090de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5100de80192f57cd132b31b233c65734de04939ce65sewardj    case 13: /* "prefetch_add_l3" */   /* Ignore. */
5110de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5120de80192f57cd132b31b233c65734de04939ce65sewardj    case 14: /* "prefetch_add_l3_fault" */   /* Ignore. */
5130de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5140de80192f57cd132b31b233c65734de04939ce65sewardj    case 15: /* "prefetch_l1" */  /* Ignore. */
5150de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5160de80192f57cd132b31b233c65734de04939ce65sewardj    case 16: /* "prefetch_l1_fault" */   /* Ignore. */
5170de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5180de80192f57cd132b31b233c65734de04939ce65sewardj    case 17: /* "prefetch_l2" */   /* Ignore. */
5190de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5200de80192f57cd132b31b233c65734de04939ce65sewardj    case 18: /* "prefetch_l2_fault" */   /* Ignore. */
5210de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5220de80192f57cd132b31b233c65734de04939ce65sewardj    case 19: /* "prefetch_l3" */   /* Ignore. */
5230de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5240de80192f57cd132b31b233c65734de04939ce65sewardj    case 20: /* "prefetch_l3_fault" */   /* Ignore. */
5250de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5260de80192f57cd132b31b233c65734de04939ce65sewardj    case 21: /* "raise" */
5270de80192f57cd132b31b233c65734de04939ce65sewardj      /* "raise" pseudo instruction is an illegal instruction plusing
5280de80192f57cd132b31b233c65734de04939ce65sewardj         a "moveli zero, <sig>", so we need save whole bundle in the
5290de80192f57cd132b31b233c65734de04939ce65sewardj         opd[0], which will be used in the dirty helper. */
5300de80192f57cd132b31b233c65734de04939ce65sewardj      opd_imm_map |= (1 << 0);
5310de80192f57cd132b31b233c65734de04939ce65sewardj      opd[0] = cins;
5320de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
5330de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5340de80192f57cd132b31b233c65734de04939ce65sewardj    case 22: /* "add" */
5350de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
5360de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64, getIReg(ra), getIReg(rb)));
5370de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
5380de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5390de80192f57cd132b31b233c65734de04939ce65sewardj    case 23: /* "addi" */
5400de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
5410de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64, getIReg(ra),
5420de80192f57cd132b31b233c65734de04939ce65sewardj                       mkU64(extend_s_8to64(imm))));
5430de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
5440de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5450de80192f57cd132b31b233c65734de04939ce65sewardj    case 24: /* "addli" */
5460de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
5470de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64, getIReg(ra),
5480de80192f57cd132b31b233c65734de04939ce65sewardj                       mkU64(extend_s_16to64(imm))));
5490de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
5500de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5510de80192f57cd132b31b233c65734de04939ce65sewardj    case 25: /* "addx" */
5520de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
5530de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, signExtend(binop(Iop_Add32,
5540de80192f57cd132b31b233c65734de04939ce65sewardj                                  narrowTo(Ity_I32, getIReg(ra)),
5550de80192f57cd132b31b233c65734de04939ce65sewardj                                  narrowTo(Ity_I32, getIReg(rb))),
5560de80192f57cd132b31b233c65734de04939ce65sewardj                            32));
5570de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
5580de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5590de80192f57cd132b31b233c65734de04939ce65sewardj    case 26: /* "addxi" */
5600de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
5610de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, signExtend(binop(Iop_Add32,
5620de80192f57cd132b31b233c65734de04939ce65sewardj                                  narrowTo(Ity_I32, getIReg(ra)),
5630de80192f57cd132b31b233c65734de04939ce65sewardj                                  mkU32(imm)), 32));
5640de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
5650de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5660de80192f57cd132b31b233c65734de04939ce65sewardj    case 27: /* "addxli" */
5670de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
5680de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, signExtend(binop(Iop_Add32,
5690de80192f57cd132b31b233c65734de04939ce65sewardj                                  narrowTo(Ity_I32, getIReg(ra)),
5700de80192f57cd132b31b233c65734de04939ce65sewardj                                  mkU32(imm)), 32));
5710de80192f57cd132b31b233c65734de04939ce65sewardj
5720de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
5730de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5740de80192f57cd132b31b233c65734de04939ce65sewardj    case 28: /* "addxsc" */
5750de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
5760de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5770de80192f57cd132b31b233c65734de04939ce65sewardj    case 29: /* "and" */
5780de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
5790de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_And64, getIReg(ra), getIReg(rb)));
5800de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
5810de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5820de80192f57cd132b31b233c65734de04939ce65sewardj    case 30: /* "andi" */
5830de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
5840de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_And64, getIReg(ra),
5850de80192f57cd132b31b233c65734de04939ce65sewardj                       mkU64(extend_s_8to64(imm))));
5860de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
5870de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5880de80192f57cd132b31b233c65734de04939ce65sewardj    case 31: /* "beqz" */
5890de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
5900de80192f57cd132b31b233c65734de04939ce65sewardj    case 32:
5910de80192f57cd132b31b233c65734de04939ce65sewardj      /* "beqzt" */
5920de80192f57cd132b31b233c65734de04939ce65sewardj      bstmt = dis_branch(binop(Iop_CmpEQ64, getIReg(ra), mkU64(0)),
5930de80192f57cd132b31b233c65734de04939ce65sewardj                         imm);
5940de80192f57cd132b31b233c65734de04939ce65sewardj      break;
5950de80192f57cd132b31b233c65734de04939ce65sewardj    case 33: /* "bfexts" */
5960de80192f57cd132b31b233c65734de04939ce65sewardj      {
5970de80192f57cd132b31b233c65734de04939ce65sewardj        ULong imm0 = decoded[n].operand_values[3];
5980de80192f57cd132b31b233c65734de04939ce65sewardj        ULong mask = ((-1ULL) ^ ((-1ULL << ((imm0 - imm) & 63)) << 1));
5990de80192f57cd132b31b233c65734de04939ce65sewardj        t0 = newTemp(Ity_I64);
6000de80192f57cd132b31b233c65734de04939ce65sewardj        t2 = newTemp(Ity_I64);
6010de80192f57cd132b31b233c65734de04939ce65sewardj        assign(t0, binop(Iop_Xor64,
6020de80192f57cd132b31b233c65734de04939ce65sewardj                         binop(Iop_Sub64,
6030de80192f57cd132b31b233c65734de04939ce65sewardj                               binop(Iop_And64,
6040de80192f57cd132b31b233c65734de04939ce65sewardj                                     binop(Iop_Shr64,
6050de80192f57cd132b31b233c65734de04939ce65sewardj                                           getIReg(ra),
6060de80192f57cd132b31b233c65734de04939ce65sewardj                                           mkU8(imm0)),
6070de80192f57cd132b31b233c65734de04939ce65sewardj                                     mkU64(1)),
6080de80192f57cd132b31b233c65734de04939ce65sewardj                               mkU64(1)),
6090de80192f57cd132b31b233c65734de04939ce65sewardj                         mkU64(-1ULL)));
6100de80192f57cd132b31b233c65734de04939ce65sewardj        assign(t2,
6110de80192f57cd132b31b233c65734de04939ce65sewardj               binop(Iop_Or64,
6120de80192f57cd132b31b233c65734de04939ce65sewardj                     binop(Iop_And64,
6130de80192f57cd132b31b233c65734de04939ce65sewardj                           binop(Iop_Or64,
6140de80192f57cd132b31b233c65734de04939ce65sewardj                                 binop(Iop_Shr64,
6150de80192f57cd132b31b233c65734de04939ce65sewardj                                       getIReg(ra),
6160de80192f57cd132b31b233c65734de04939ce65sewardj                                       mkU8(imm)),
6170de80192f57cd132b31b233c65734de04939ce65sewardj                                 binop(Iop_Shl64,
6180de80192f57cd132b31b233c65734de04939ce65sewardj                                       getIReg(ra),
6190de80192f57cd132b31b233c65734de04939ce65sewardj                                       mkU8(64 - imm))),
6200de80192f57cd132b31b233c65734de04939ce65sewardj                           mkU64(mask)),
6210de80192f57cd132b31b233c65734de04939ce65sewardj                     binop(Iop_And64,
6220de80192f57cd132b31b233c65734de04939ce65sewardj                           mkexpr(t0),
6230de80192f57cd132b31b233c65734de04939ce65sewardj                           mkU64(~mask))));
6240de80192f57cd132b31b233c65734de04939ce65sewardj
6250de80192f57cd132b31b233c65734de04939ce65sewardj        MARK_REG_WB(rd, t2);
6260de80192f57cd132b31b233c65734de04939ce65sewardj      }
6270de80192f57cd132b31b233c65734de04939ce65sewardj      break;
6280de80192f57cd132b31b233c65734de04939ce65sewardj    case 34:  /* "bfextu" */
6290de80192f57cd132b31b233c65734de04939ce65sewardj      {
6300de80192f57cd132b31b233c65734de04939ce65sewardj        ULong imm0 = decoded[n].operand_values[3];
6310de80192f57cd132b31b233c65734de04939ce65sewardj        ULong mask = 0;
6320de80192f57cd132b31b233c65734de04939ce65sewardj        t2 = newTemp(Ity_I64);
6330de80192f57cd132b31b233c65734de04939ce65sewardj        mask = ((-1ULL) ^ ((-1ULL << ((imm0 - imm) & 63)) << 1));
6340de80192f57cd132b31b233c65734de04939ce65sewardj
6350de80192f57cd132b31b233c65734de04939ce65sewardj        assign(t2,
6360de80192f57cd132b31b233c65734de04939ce65sewardj               binop(Iop_And64,
6370de80192f57cd132b31b233c65734de04939ce65sewardj                     binop(Iop_Or64,
6380de80192f57cd132b31b233c65734de04939ce65sewardj                           binop(Iop_Shr64,
6390de80192f57cd132b31b233c65734de04939ce65sewardj                                 getIReg(ra),
6400de80192f57cd132b31b233c65734de04939ce65sewardj                                 mkU8(imm)),
6410de80192f57cd132b31b233c65734de04939ce65sewardj                           binop(Iop_Shl64,
6420de80192f57cd132b31b233c65734de04939ce65sewardj                                 getIReg(ra),
6430de80192f57cd132b31b233c65734de04939ce65sewardj                                 mkU8(64 - imm))),
6440de80192f57cd132b31b233c65734de04939ce65sewardj                     mkU64(mask)));
6450de80192f57cd132b31b233c65734de04939ce65sewardj        MARK_REG_WB(rd, t2);
6460de80192f57cd132b31b233c65734de04939ce65sewardj      }
6470de80192f57cd132b31b233c65734de04939ce65sewardj      break;
6480de80192f57cd132b31b233c65734de04939ce65sewardj    case 35:  /* "bfins" */
6490de80192f57cd132b31b233c65734de04939ce65sewardj      {
6500de80192f57cd132b31b233c65734de04939ce65sewardj        ULong mask;
6510de80192f57cd132b31b233c65734de04939ce65sewardj        ULong imm0 = decoded[n].operand_values[3];
6520de80192f57cd132b31b233c65734de04939ce65sewardj        t0 = newTemp(Ity_I64);
6530de80192f57cd132b31b233c65734de04939ce65sewardj        t2 = newTemp(Ity_I64);
6540de80192f57cd132b31b233c65734de04939ce65sewardj        if (imm <= imm0)
6550de80192f57cd132b31b233c65734de04939ce65sewardj        {
6560de80192f57cd132b31b233c65734de04939ce65sewardj          mask = ((-1ULL << imm) ^ ((-1ULL << imm0) << 1));
6570de80192f57cd132b31b233c65734de04939ce65sewardj        }
6580de80192f57cd132b31b233c65734de04939ce65sewardj        else
6590de80192f57cd132b31b233c65734de04939ce65sewardj        {
6600de80192f57cd132b31b233c65734de04939ce65sewardj          mask = ((-1ULL << imm) | (-1ULL >> (63 - imm0)));
6610de80192f57cd132b31b233c65734de04939ce65sewardj        }
6620de80192f57cd132b31b233c65734de04939ce65sewardj
6630de80192f57cd132b31b233c65734de04939ce65sewardj        assign(t0, binop(Iop_Or64,
6640de80192f57cd132b31b233c65734de04939ce65sewardj                         binop(Iop_Shl64,
6650de80192f57cd132b31b233c65734de04939ce65sewardj                               getIReg(ra),
6660de80192f57cd132b31b233c65734de04939ce65sewardj                               mkU8(imm)),
6670de80192f57cd132b31b233c65734de04939ce65sewardj                         binop(Iop_Shr64,
6680de80192f57cd132b31b233c65734de04939ce65sewardj                               getIReg(ra),
6690de80192f57cd132b31b233c65734de04939ce65sewardj                               mkU8(64 - imm))));
6700de80192f57cd132b31b233c65734de04939ce65sewardj
6710de80192f57cd132b31b233c65734de04939ce65sewardj        assign(t2, binop(Iop_Or64,
6720de80192f57cd132b31b233c65734de04939ce65sewardj                         binop(Iop_And64,
6730de80192f57cd132b31b233c65734de04939ce65sewardj                               mkexpr(t0),
6740de80192f57cd132b31b233c65734de04939ce65sewardj                               mkU64(mask)),
6750de80192f57cd132b31b233c65734de04939ce65sewardj                         binop(Iop_And64,
6760de80192f57cd132b31b233c65734de04939ce65sewardj                               getIReg(rd),
6770de80192f57cd132b31b233c65734de04939ce65sewardj                               mkU64(~mask))));
6780de80192f57cd132b31b233c65734de04939ce65sewardj
6790de80192f57cd132b31b233c65734de04939ce65sewardj        MARK_REG_WB(rd, t2);
6800de80192f57cd132b31b233c65734de04939ce65sewardj      }
6810de80192f57cd132b31b233c65734de04939ce65sewardj      break;
6820de80192f57cd132b31b233c65734de04939ce65sewardj    case 36:  /* "bgez" */
6830de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
6840de80192f57cd132b31b233c65734de04939ce65sewardj    case 37:  /* "bgezt" */
6850de80192f57cd132b31b233c65734de04939ce65sewardj      bstmt = dis_branch(binop(Iop_CmpEQ64,
6860de80192f57cd132b31b233c65734de04939ce65sewardj                               binop(Iop_And64,
6870de80192f57cd132b31b233c65734de04939ce65sewardj                                     getIReg(ra),
6880de80192f57cd132b31b233c65734de04939ce65sewardj                                     mkU64(0x8000000000000000ULL)),
6890de80192f57cd132b31b233c65734de04939ce65sewardj                               mkU64(0x0)),
6900de80192f57cd132b31b233c65734de04939ce65sewardj                         imm);
6910de80192f57cd132b31b233c65734de04939ce65sewardj      break;
6920de80192f57cd132b31b233c65734de04939ce65sewardj    case 38:  /* "bgtz" */
6930de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
6940de80192f57cd132b31b233c65734de04939ce65sewardj    case 39:
6950de80192f57cd132b31b233c65734de04939ce65sewardj      /* "bgtzt" */
6960de80192f57cd132b31b233c65734de04939ce65sewardj      bstmt = dis_branch(unop(Iop_Not1,
6970de80192f57cd132b31b233c65734de04939ce65sewardj                              binop(Iop_CmpLE64S,
6980de80192f57cd132b31b233c65734de04939ce65sewardj                                    getIReg(ra),
6990de80192f57cd132b31b233c65734de04939ce65sewardj                                    mkU64(0))),
7000de80192f57cd132b31b233c65734de04939ce65sewardj                         imm);
7010de80192f57cd132b31b233c65734de04939ce65sewardj      break;
7020de80192f57cd132b31b233c65734de04939ce65sewardj    case 40:  /* "blbc" */
7030de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
7040de80192f57cd132b31b233c65734de04939ce65sewardj    case 41:  /* "blbct" */
7050de80192f57cd132b31b233c65734de04939ce65sewardj      bstmt = dis_branch(unop(Iop_64to1,
7060de80192f57cd132b31b233c65734de04939ce65sewardj                              unop(Iop_Not64, getIReg(ra))),
7070de80192f57cd132b31b233c65734de04939ce65sewardj                         imm);
7080de80192f57cd132b31b233c65734de04939ce65sewardj
7090de80192f57cd132b31b233c65734de04939ce65sewardj      break;
7100de80192f57cd132b31b233c65734de04939ce65sewardj    case 42:  /* "blbs" */
7110de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
7120de80192f57cd132b31b233c65734de04939ce65sewardj    case 43:
7130de80192f57cd132b31b233c65734de04939ce65sewardj      /* "blbst" */
7140de80192f57cd132b31b233c65734de04939ce65sewardj      bstmt = dis_branch(unop(Iop_64to1,
7150de80192f57cd132b31b233c65734de04939ce65sewardj                              getIReg(ra)),
7160de80192f57cd132b31b233c65734de04939ce65sewardj                         imm);
7170de80192f57cd132b31b233c65734de04939ce65sewardj      break;
7180de80192f57cd132b31b233c65734de04939ce65sewardj    case 44:  /* "blez" */
7190de80192f57cd132b31b233c65734de04939ce65sewardj      bstmt = dis_branch(binop(Iop_CmpLE64S, getIReg(ra),
7200de80192f57cd132b31b233c65734de04939ce65sewardj                               mkU64(0)),
7210de80192f57cd132b31b233c65734de04939ce65sewardj                         imm);
7220de80192f57cd132b31b233c65734de04939ce65sewardj      break;
7230de80192f57cd132b31b233c65734de04939ce65sewardj    case 45:  /* "blezt" */
7240de80192f57cd132b31b233c65734de04939ce65sewardj      bstmt = dis_branch(binop(Iop_CmpLE64S, getIReg(ra),
7250de80192f57cd132b31b233c65734de04939ce65sewardj                               mkU64(0)),
7260de80192f57cd132b31b233c65734de04939ce65sewardj                         imm);
7270de80192f57cd132b31b233c65734de04939ce65sewardj      break;
7280de80192f57cd132b31b233c65734de04939ce65sewardj    case 46:  /* "bltz" */
7290de80192f57cd132b31b233c65734de04939ce65sewardj      bstmt = dis_branch(binop(Iop_CmpLT64S, getIReg(ra),
7300de80192f57cd132b31b233c65734de04939ce65sewardj                               mkU64(0)),
7310de80192f57cd132b31b233c65734de04939ce65sewardj                         imm);
7320de80192f57cd132b31b233c65734de04939ce65sewardj      break;
7330de80192f57cd132b31b233c65734de04939ce65sewardj    case 47:  /* "bltzt" */
7340de80192f57cd132b31b233c65734de04939ce65sewardj      bstmt = dis_branch(binop(Iop_CmpLT64S, getIReg(ra),
7350de80192f57cd132b31b233c65734de04939ce65sewardj                               mkU64(0)),
7360de80192f57cd132b31b233c65734de04939ce65sewardj                         imm);
7370de80192f57cd132b31b233c65734de04939ce65sewardj      break;
7380de80192f57cd132b31b233c65734de04939ce65sewardj    case 48:  /* "bnez" */
7390de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
7400de80192f57cd132b31b233c65734de04939ce65sewardj    case 49:
7410de80192f57cd132b31b233c65734de04939ce65sewardj      /* "bnezt" */
7420de80192f57cd132b31b233c65734de04939ce65sewardj      bstmt = dis_branch(binop(Iop_CmpNE64, getIReg(ra),
7430de80192f57cd132b31b233c65734de04939ce65sewardj                               mkU64(0)),
7440de80192f57cd132b31b233c65734de04939ce65sewardj                         imm);
7450de80192f57cd132b31b233c65734de04939ce65sewardj      break;
7460de80192f57cd132b31b233c65734de04939ce65sewardj    case 50:  /* "clz" */
7470de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
7480de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, unop(Iop_Clz64, getIReg(ra)));
7490de80192f57cd132b31b233c65734de04939ce65sewardj
7500de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
7510de80192f57cd132b31b233c65734de04939ce65sewardj      break;
7520de80192f57cd132b31b233c65734de04939ce65sewardj    case 51:  /* "cmoveqz rd, ra, rb" */
7530de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
7540de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, IRExpr_ITE(binop(Iop_CmpEQ64, getIReg(ra), mkU64(0)),
7550de80192f57cd132b31b233c65734de04939ce65sewardj                            getIReg(rb), getIReg(rd)));
7560de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
7570de80192f57cd132b31b233c65734de04939ce65sewardj      break;
7580de80192f57cd132b31b233c65734de04939ce65sewardj    case 52:  /* "cmovnez" */
7590de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
7600de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, IRExpr_ITE(binop(Iop_CmpEQ64, getIReg(ra), mkU64(0)),
7610de80192f57cd132b31b233c65734de04939ce65sewardj                            getIReg(rd), getIReg(rb)));
7620de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
7630de80192f57cd132b31b233c65734de04939ce65sewardj      break;
7640de80192f57cd132b31b233c65734de04939ce65sewardj    case 53:  /* "cmpeq" */
7650de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
7660de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_1Uto64, binop(Iop_CmpEQ64,
7670de80192f57cd132b31b233c65734de04939ce65sewardj                                         getIReg(ra), getIReg(rb))));
7680de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
7690de80192f57cd132b31b233c65734de04939ce65sewardj      break;
7700de80192f57cd132b31b233c65734de04939ce65sewardj
7710de80192f57cd132b31b233c65734de04939ce65sewardj    case 54:  /* "cmpeqi" */
7720de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
7730de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, unop(Iop_1Uto64, binop(Iop_CmpEQ64,
7740de80192f57cd132b31b233c65734de04939ce65sewardj                                        getIReg(ra),
7750de80192f57cd132b31b233c65734de04939ce65sewardj                                        mkU64(extend_s_8to64(imm)))));
7760de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
7770de80192f57cd132b31b233c65734de04939ce65sewardj      break;
7780de80192f57cd132b31b233c65734de04939ce65sewardj    case 55:  /* "cmpexch" */
7790de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
7800de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
7810de80192f57cd132b31b233c65734de04939ce65sewardj
7820de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, getIReg(rb));
7830de80192f57cd132b31b233c65734de04939ce65sewardj      stmt( IRStmt_CAS(mkIRCAS(IRTemp_INVALID, t2, Iend_LE,
7840de80192f57cd132b31b233c65734de04939ce65sewardj                               getIReg(ra),
7850de80192f57cd132b31b233c65734de04939ce65sewardj                               NULL, binop(Iop_Add64,
7860de80192f57cd132b31b233c65734de04939ce65sewardj                                           getIReg(70),
7870de80192f57cd132b31b233c65734de04939ce65sewardj                                           getIReg(71)),
7880de80192f57cd132b31b233c65734de04939ce65sewardj                               NULL, mkexpr(t1))));
7890de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
7900de80192f57cd132b31b233c65734de04939ce65sewardj      break;
7910de80192f57cd132b31b233c65734de04939ce65sewardj    case 56:  /* "cmpexch4" */
7920de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I32);
7930de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
7940de80192f57cd132b31b233c65734de04939ce65sewardj      t3 = newTemp(Ity_I32);
7950de80192f57cd132b31b233c65734de04939ce65sewardj
7960de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, narrowTo(Ity_I32, getIReg(rb)));
7970de80192f57cd132b31b233c65734de04939ce65sewardj      stmt( IRStmt_CAS(mkIRCAS(IRTemp_INVALID, t3, Iend_LE,
7980de80192f57cd132b31b233c65734de04939ce65sewardj                               getIReg(ra),
7990de80192f57cd132b31b233c65734de04939ce65sewardj                               NULL,
8000de80192f57cd132b31b233c65734de04939ce65sewardj                               narrowTo(Ity_I32, binop(Iop_Add64,
8010de80192f57cd132b31b233c65734de04939ce65sewardj                                                       getIReg(70),
8020de80192f57cd132b31b233c65734de04939ce65sewardj                                                       getIReg(71))),
8030de80192f57cd132b31b233c65734de04939ce65sewardj                               NULL,
8040de80192f57cd132b31b233c65734de04939ce65sewardj                               mkexpr(t1))));
8050de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, unop(Iop_32Uto64, mkexpr(t3)));
8060de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
8070de80192f57cd132b31b233c65734de04939ce65sewardj      break;
8080de80192f57cd132b31b233c65734de04939ce65sewardj    case 57:  /* "cmples" */
8090de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
8100de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, unop(Iop_1Uto64,
8110de80192f57cd132b31b233c65734de04939ce65sewardj                      binop(Iop_CmpLE64S, getIReg(ra), getIReg(rb))));
8120de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
8130de80192f57cd132b31b233c65734de04939ce65sewardj      break;
8140de80192f57cd132b31b233c65734de04939ce65sewardj    case 58:  /* "cmpleu" */
8150de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
8160de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_1Uto64,
8170de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_CmpLE64U, getIReg(ra), getIReg(rb))));
8180de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
8190de80192f57cd132b31b233c65734de04939ce65sewardj      break;
8200de80192f57cd132b31b233c65734de04939ce65sewardj    case 59:  /* "cmplts" */
8210de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
8220de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, unop(Iop_1Uto64,
8230de80192f57cd132b31b233c65734de04939ce65sewardj                      binop(Iop_CmpLT64S, getIReg(ra), getIReg(rb))));
8240de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
8250de80192f57cd132b31b233c65734de04939ce65sewardj      break;
8260de80192f57cd132b31b233c65734de04939ce65sewardj    case 60:  /* "cmpltsi" */
8270de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
8280de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, unop(Iop_1Uto64,
8290de80192f57cd132b31b233c65734de04939ce65sewardj                      binop(Iop_CmpLT64S,
8300de80192f57cd132b31b233c65734de04939ce65sewardj                            getIReg(ra),
8310de80192f57cd132b31b233c65734de04939ce65sewardj                            mkU64(extend_s_8to64(imm)))));
8320de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
8330de80192f57cd132b31b233c65734de04939ce65sewardj      break;
8340de80192f57cd132b31b233c65734de04939ce65sewardj    case 61:
8350de80192f57cd132b31b233c65734de04939ce65sewardj
8360de80192f57cd132b31b233c65734de04939ce65sewardj      /* "cmpltu" */
8370de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
8380de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, unop(Iop_1Uto64,
8390de80192f57cd132b31b233c65734de04939ce65sewardj                      binop(Iop_CmpLT64U, getIReg(ra), getIReg(rb))));
8400de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
8410de80192f57cd132b31b233c65734de04939ce65sewardj
8420de80192f57cd132b31b233c65734de04939ce65sewardj
8430de80192f57cd132b31b233c65734de04939ce65sewardj      break;
8440de80192f57cd132b31b233c65734de04939ce65sewardj    case 62:  /* "cmpltui" */
8450de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
8460de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_1Uto64,
8470de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_CmpLT64U,
8480de80192f57cd132b31b233c65734de04939ce65sewardj                             getIReg(ra),
8490de80192f57cd132b31b233c65734de04939ce65sewardj                             mkU64(imm))));
8500de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
8510de80192f57cd132b31b233c65734de04939ce65sewardj
8520de80192f57cd132b31b233c65734de04939ce65sewardj
8530de80192f57cd132b31b233c65734de04939ce65sewardj      break;
8540de80192f57cd132b31b233c65734de04939ce65sewardj    case 63:  /* "cmpne" */
8550de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
8560de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, unop(Iop_1Uto64,
8570de80192f57cd132b31b233c65734de04939ce65sewardj                      binop(Iop_CmpNE64, getIReg(ra), getIReg(rb))));
8580de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
8590de80192f57cd132b31b233c65734de04939ce65sewardj
8600de80192f57cd132b31b233c65734de04939ce65sewardj
8610de80192f57cd132b31b233c65734de04939ce65sewardj      break;
8620de80192f57cd132b31b233c65734de04939ce65sewardj    case 64:
8630de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
8640de80192f57cd132b31b233c65734de04939ce65sewardj    case 65:
8650de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
8660de80192f57cd132b31b233c65734de04939ce65sewardj    case 66:
8670de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
8680de80192f57cd132b31b233c65734de04939ce65sewardj    case 67:
8690de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
8700de80192f57cd132b31b233c65734de04939ce65sewardj    case 68:
8710de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
8720de80192f57cd132b31b233c65734de04939ce65sewardj    case 69:
8730de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
8740de80192f57cd132b31b233c65734de04939ce65sewardj    case 70:
8750de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
8760de80192f57cd132b31b233c65734de04939ce65sewardj    case 71:
8770de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
8780de80192f57cd132b31b233c65734de04939ce65sewardj    case 72:
8790de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
8800de80192f57cd132b31b233c65734de04939ce65sewardj      break;
8810de80192f57cd132b31b233c65734de04939ce65sewardj    case 73:  /* "ctz" */
8820de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
8830de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, unop(Iop_Ctz64, getIReg(ra)));
8840de80192f57cd132b31b233c65734de04939ce65sewardj
8850de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
8860de80192f57cd132b31b233c65734de04939ce65sewardj
8870de80192f57cd132b31b233c65734de04939ce65sewardj
8880de80192f57cd132b31b233c65734de04939ce65sewardj      break;
8890de80192f57cd132b31b233c65734de04939ce65sewardj    case 74:  /* "dblalign" */
8900de80192f57cd132b31b233c65734de04939ce65sewardj      t0 = newTemp(Ity_I64);
8910de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
8920de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
8930de80192f57cd132b31b233c65734de04939ce65sewardj
8940de80192f57cd132b31b233c65734de04939ce65sewardj      /* t0 is the bit shift amount */
8950de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t0, binop(Iop_Shl64,
8960de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_And64,
8970de80192f57cd132b31b233c65734de04939ce65sewardj                             getIReg(rb),
8980de80192f57cd132b31b233c65734de04939ce65sewardj                             mkU64(7)),
8990de80192f57cd132b31b233c65734de04939ce65sewardj                       mkU8(3)));
9000de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, binop(Iop_Sub64,
9010de80192f57cd132b31b233c65734de04939ce65sewardj                       mkU64(64),
9020de80192f57cd132b31b233c65734de04939ce65sewardj                       mkexpr(t0)));
9030de80192f57cd132b31b233c65734de04939ce65sewardj
9040de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Or64,
9050de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_Shl64,
9060de80192f57cd132b31b233c65734de04939ce65sewardj                             getIReg(ra),
9070de80192f57cd132b31b233c65734de04939ce65sewardj                             unop(Iop_64to8, mkexpr(t1))),
9080de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_Shr64,
9090de80192f57cd132b31b233c65734de04939ce65sewardj                             getIReg(rd),
9100de80192f57cd132b31b233c65734de04939ce65sewardj                             unop(Iop_64to8, mkexpr(t0)))));
9110de80192f57cd132b31b233c65734de04939ce65sewardj
9120de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
9130de80192f57cd132b31b233c65734de04939ce65sewardj      break;
9140de80192f57cd132b31b233c65734de04939ce65sewardj    case 75:
9150de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
9160de80192f57cd132b31b233c65734de04939ce65sewardj    case 76:
9170de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
9180de80192f57cd132b31b233c65734de04939ce65sewardj    case 77:
9190de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
9200de80192f57cd132b31b233c65734de04939ce65sewardj    case 78:
9210de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
9220de80192f57cd132b31b233c65734de04939ce65sewardj    case 79:
9230de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
9240de80192f57cd132b31b233c65734de04939ce65sewardj      break;
9250de80192f57cd132b31b233c65734de04939ce65sewardj    case 80:  /* "exch" */
9260de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
9270de80192f57cd132b31b233c65734de04939ce65sewardj      stmt( IRStmt_CAS(
9280de80192f57cd132b31b233c65734de04939ce65sewardj              mkIRCAS(IRTemp_INVALID,
9290de80192f57cd132b31b233c65734de04939ce65sewardj                      t2,
9300de80192f57cd132b31b233c65734de04939ce65sewardj                      Iend_LE,
9310de80192f57cd132b31b233c65734de04939ce65sewardj                      getIReg(ra),
9320de80192f57cd132b31b233c65734de04939ce65sewardj                      NULL,
9330de80192f57cd132b31b233c65734de04939ce65sewardj                      mkU64(0x0),
9340de80192f57cd132b31b233c65734de04939ce65sewardj                      NULL,
9350de80192f57cd132b31b233c65734de04939ce65sewardj                      getIReg(rb))));
9360de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
9370de80192f57cd132b31b233c65734de04939ce65sewardj      break;
9380de80192f57cd132b31b233c65734de04939ce65sewardj    case 81:  /* "exch4 rd, ra, rb" */
9390de80192f57cd132b31b233c65734de04939ce65sewardj      t0 = newTemp(Ity_I32);
9400de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
9410de80192f57cd132b31b233c65734de04939ce65sewardj      stmt( IRStmt_CAS(
9420de80192f57cd132b31b233c65734de04939ce65sewardj              mkIRCAS(IRTemp_INVALID,
9430de80192f57cd132b31b233c65734de04939ce65sewardj                      t0,
9440de80192f57cd132b31b233c65734de04939ce65sewardj                      Iend_LE,
9450de80192f57cd132b31b233c65734de04939ce65sewardj                      getIReg(ra),
9460de80192f57cd132b31b233c65734de04939ce65sewardj                      NULL,
9470de80192f57cd132b31b233c65734de04939ce65sewardj                      mkU32(0x0),
9480de80192f57cd132b31b233c65734de04939ce65sewardj                      NULL,
9490de80192f57cd132b31b233c65734de04939ce65sewardj                      narrowTo(Ity_I32,
9500de80192f57cd132b31b233c65734de04939ce65sewardj                               getIReg(rb)))));
9510de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, unop(Iop_32Sto64, mkexpr(t0)));
9520de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
9530de80192f57cd132b31b233c65734de04939ce65sewardj      break;
9540de80192f57cd132b31b233c65734de04939ce65sewardj    case 82:
9550de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
9560de80192f57cd132b31b233c65734de04939ce65sewardj    case 83:
9570de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
9580de80192f57cd132b31b233c65734de04939ce65sewardj    case 84:
9590de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
9600de80192f57cd132b31b233c65734de04939ce65sewardj    case 85:
9610de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
9620de80192f57cd132b31b233c65734de04939ce65sewardj    case 86:
9630de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
9640de80192f57cd132b31b233c65734de04939ce65sewardj    case 87:
9650de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
9660de80192f57cd132b31b233c65734de04939ce65sewardj    case 88:
9670de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
9680de80192f57cd132b31b233c65734de04939ce65sewardj    case 89:
9690de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
9700de80192f57cd132b31b233c65734de04939ce65sewardj      break;
9710de80192f57cd132b31b233c65734de04939ce65sewardj    case 90:  /* "fetchadd" */
9720de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
9730de80192f57cd132b31b233c65734de04939ce65sewardj      stmt( IRStmt_CAS(
9740de80192f57cd132b31b233c65734de04939ce65sewardj              mkIRCAS(IRTemp_INVALID,
9750de80192f57cd132b31b233c65734de04939ce65sewardj                      t2,
9760de80192f57cd132b31b233c65734de04939ce65sewardj                      Iend_LE,
9770de80192f57cd132b31b233c65734de04939ce65sewardj                      getIReg(ra),
9780de80192f57cd132b31b233c65734de04939ce65sewardj                      NULL,
9790de80192f57cd132b31b233c65734de04939ce65sewardj                      // fetchadd=3
9800de80192f57cd132b31b233c65734de04939ce65sewardj                      mkU64(0x3),
9810de80192f57cd132b31b233c65734de04939ce65sewardj                      NULL,
9820de80192f57cd132b31b233c65734de04939ce65sewardj                      getIReg(rb))));
9830de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
9840de80192f57cd132b31b233c65734de04939ce65sewardj      break;
9850de80192f57cd132b31b233c65734de04939ce65sewardj    case 91:  /* "fetchadd4" */
9860de80192f57cd132b31b233c65734de04939ce65sewardj      t0 = newTemp(Ity_I32);
9870de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
9880de80192f57cd132b31b233c65734de04939ce65sewardj      stmt( IRStmt_CAS(
9890de80192f57cd132b31b233c65734de04939ce65sewardj              mkIRCAS(IRTemp_INVALID,
9900de80192f57cd132b31b233c65734de04939ce65sewardj                      t0,
9910de80192f57cd132b31b233c65734de04939ce65sewardj                      Iend_LE,
9920de80192f57cd132b31b233c65734de04939ce65sewardj                      getIReg(ra),
9930de80192f57cd132b31b233c65734de04939ce65sewardj                      NULL,
9940de80192f57cd132b31b233c65734de04939ce65sewardj                      // fetchadd=3
9950de80192f57cd132b31b233c65734de04939ce65sewardj                      mkU32(0x3),
9960de80192f57cd132b31b233c65734de04939ce65sewardj                      NULL,
9970de80192f57cd132b31b233c65734de04939ce65sewardj                      narrowTo(Ity_I32,
9980de80192f57cd132b31b233c65734de04939ce65sewardj                               getIReg(rb)))));
9990de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, unop(Iop_32Sto64, mkexpr(t0)));
10000de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
10010de80192f57cd132b31b233c65734de04939ce65sewardj
10020de80192f57cd132b31b233c65734de04939ce65sewardj      break;
10030de80192f57cd132b31b233c65734de04939ce65sewardj    case 92:  /* "fetchaddgez" */
10040de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
10050de80192f57cd132b31b233c65734de04939ce65sewardj      stmt( IRStmt_CAS(
10060de80192f57cd132b31b233c65734de04939ce65sewardj              mkIRCAS(IRTemp_INVALID,
10070de80192f57cd132b31b233c65734de04939ce65sewardj                      t2,
10080de80192f57cd132b31b233c65734de04939ce65sewardj                      Iend_LE,
10090de80192f57cd132b31b233c65734de04939ce65sewardj                      getIReg(ra),
10100de80192f57cd132b31b233c65734de04939ce65sewardj                      NULL,
10110de80192f57cd132b31b233c65734de04939ce65sewardj                      // fetchaddgez=5
10120de80192f57cd132b31b233c65734de04939ce65sewardj                      mkU64(0x5),
10130de80192f57cd132b31b233c65734de04939ce65sewardj                      NULL,
10140de80192f57cd132b31b233c65734de04939ce65sewardj                      getIReg(rb))));
10150de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
10160de80192f57cd132b31b233c65734de04939ce65sewardj      break;
10170de80192f57cd132b31b233c65734de04939ce65sewardj    case 93:  /* "fetchaddgez4" */
10180de80192f57cd132b31b233c65734de04939ce65sewardj      t0 = newTemp(Ity_I32);
10190de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
10200de80192f57cd132b31b233c65734de04939ce65sewardj      stmt( IRStmt_CAS(
10210de80192f57cd132b31b233c65734de04939ce65sewardj              mkIRCAS(IRTemp_INVALID,
10220de80192f57cd132b31b233c65734de04939ce65sewardj                      t0,
10230de80192f57cd132b31b233c65734de04939ce65sewardj                      Iend_LE,
10240de80192f57cd132b31b233c65734de04939ce65sewardj                      getIReg(ra),
10250de80192f57cd132b31b233c65734de04939ce65sewardj                      NULL,
10260de80192f57cd132b31b233c65734de04939ce65sewardj                      // fetchaddgez=5
10270de80192f57cd132b31b233c65734de04939ce65sewardj                      mkU32(0x5),
10280de80192f57cd132b31b233c65734de04939ce65sewardj                      NULL,
10290de80192f57cd132b31b233c65734de04939ce65sewardj                      narrowTo(Ity_I32,
10300de80192f57cd132b31b233c65734de04939ce65sewardj                               getIReg(rb)))));
10310de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, unop(Iop_32Sto64, mkexpr(t0)));
10320de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
10330de80192f57cd132b31b233c65734de04939ce65sewardj      break;
10340de80192f57cd132b31b233c65734de04939ce65sewardj    case 94:  /* "fetchand\n") */
10350de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
10360de80192f57cd132b31b233c65734de04939ce65sewardj      stmt( IRStmt_CAS(
10370de80192f57cd132b31b233c65734de04939ce65sewardj              mkIRCAS(IRTemp_INVALID,
10380de80192f57cd132b31b233c65734de04939ce65sewardj                      t2,
10390de80192f57cd132b31b233c65734de04939ce65sewardj                      Iend_LE,
10400de80192f57cd132b31b233c65734de04939ce65sewardj                      getIReg(ra),
10410de80192f57cd132b31b233c65734de04939ce65sewardj                      NULL,
10420de80192f57cd132b31b233c65734de04939ce65sewardj                      mkU64(0x2),
10430de80192f57cd132b31b233c65734de04939ce65sewardj                      NULL,
10440de80192f57cd132b31b233c65734de04939ce65sewardj                      getIReg(rb))));
10450de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
10460de80192f57cd132b31b233c65734de04939ce65sewardj      break;
10470de80192f57cd132b31b233c65734de04939ce65sewardj    case 95:
10480de80192f57cd132b31b233c65734de04939ce65sewardj      /* mkIRCAS.
10490de80192f57cd132b31b233c65734de04939ce65sewardj         0: xch###      1: cmpexch###,
10500de80192f57cd132b31b233c65734de04939ce65sewardj         2: fetchand##  3: fetchadd##
10510de80192f57cd132b31b233c65734de04939ce65sewardj         4: fetchor##   5: fetchaddgez
10520de80192f57cd132b31b233c65734de04939ce65sewardj      */
10530de80192f57cd132b31b233c65734de04939ce65sewardj      /* "fetchand4" */
10540de80192f57cd132b31b233c65734de04939ce65sewardj      t0 = newTemp(Ity_I32);
10550de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
10560de80192f57cd132b31b233c65734de04939ce65sewardj      stmt( IRStmt_CAS(
10570de80192f57cd132b31b233c65734de04939ce65sewardj              mkIRCAS(IRTemp_INVALID,
10580de80192f57cd132b31b233c65734de04939ce65sewardj                      t0,
10590de80192f57cd132b31b233c65734de04939ce65sewardj                      Iend_LE,
10600de80192f57cd132b31b233c65734de04939ce65sewardj                      getIReg(ra),
10610de80192f57cd132b31b233c65734de04939ce65sewardj                      NULL,
10620de80192f57cd132b31b233c65734de04939ce65sewardj                      mkU32(0x2),
10630de80192f57cd132b31b233c65734de04939ce65sewardj                      NULL,
10640de80192f57cd132b31b233c65734de04939ce65sewardj                      narrowTo(Ity_I32,
10650de80192f57cd132b31b233c65734de04939ce65sewardj                               getIReg(rb)))));
10660de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, unop(Iop_32Sto64, mkexpr(t0)));
10670de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
10680de80192f57cd132b31b233c65734de04939ce65sewardj      break;
10690de80192f57cd132b31b233c65734de04939ce65sewardj    case 96:  /* "fetchor" */
10700de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
10710de80192f57cd132b31b233c65734de04939ce65sewardj      stmt( IRStmt_CAS(
10720de80192f57cd132b31b233c65734de04939ce65sewardj              mkIRCAS(IRTemp_INVALID,
10730de80192f57cd132b31b233c65734de04939ce65sewardj                      t2,
10740de80192f57cd132b31b233c65734de04939ce65sewardj                      Iend_LE,
10750de80192f57cd132b31b233c65734de04939ce65sewardj                      getIReg(ra),
10760de80192f57cd132b31b233c65734de04939ce65sewardj                      NULL,
10770de80192f57cd132b31b233c65734de04939ce65sewardj                      mkU64(0x4),
10780de80192f57cd132b31b233c65734de04939ce65sewardj                      NULL,
10790de80192f57cd132b31b233c65734de04939ce65sewardj                      getIReg(rb))));
10800de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
10810de80192f57cd132b31b233c65734de04939ce65sewardj      break;
10820de80192f57cd132b31b233c65734de04939ce65sewardj    case 97:  /* "fetchor4" */
10830de80192f57cd132b31b233c65734de04939ce65sewardj      t0 = newTemp(Ity_I32);
10840de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
10850de80192f57cd132b31b233c65734de04939ce65sewardj      stmt( IRStmt_CAS(
10860de80192f57cd132b31b233c65734de04939ce65sewardj              mkIRCAS(IRTemp_INVALID,
10870de80192f57cd132b31b233c65734de04939ce65sewardj                      t0,
10880de80192f57cd132b31b233c65734de04939ce65sewardj                      Iend_LE,
10890de80192f57cd132b31b233c65734de04939ce65sewardj                      getIReg(ra),
10900de80192f57cd132b31b233c65734de04939ce65sewardj                      NULL,
10910de80192f57cd132b31b233c65734de04939ce65sewardj                      mkU32(0x4),
10920de80192f57cd132b31b233c65734de04939ce65sewardj                      NULL,
10930de80192f57cd132b31b233c65734de04939ce65sewardj                      narrowTo(Ity_I32,
10940de80192f57cd132b31b233c65734de04939ce65sewardj                               getIReg(rb)))));
10950de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, unop(Iop_32Sto64, mkexpr(t0)));
10960de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
10970de80192f57cd132b31b233c65734de04939ce65sewardj      break;
10980de80192f57cd132b31b233c65734de04939ce65sewardj    case 98:
10990de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
11000de80192f57cd132b31b233c65734de04939ce65sewardj    case 99:
11010de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
11020de80192f57cd132b31b233c65734de04939ce65sewardj    case 100:
11030de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
11040de80192f57cd132b31b233c65734de04939ce65sewardj      break;
11050de80192f57cd132b31b233c65734de04939ce65sewardj    case 101: /* "fnop"  Ignore */
11060de80192f57cd132b31b233c65734de04939ce65sewardj      break;
11070de80192f57cd132b31b233c65734de04939ce65sewardj    case 102:
11080de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
11090de80192f57cd132b31b233c65734de04939ce65sewardj    case 103:
11100de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
11110de80192f57cd132b31b233c65734de04939ce65sewardj    case 104:
11120de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
11130de80192f57cd132b31b233c65734de04939ce65sewardj    case 105:
11140de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
11150de80192f57cd132b31b233c65734de04939ce65sewardj    case 106:
11160de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
11170de80192f57cd132b31b233c65734de04939ce65sewardj    case 107:
11180de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
11190de80192f57cd132b31b233c65734de04939ce65sewardj    case 108:
11200de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
11210de80192f57cd132b31b233c65734de04939ce65sewardj      break;
11220de80192f57cd132b31b233c65734de04939ce65sewardj    case 109:
11230de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
11240de80192f57cd132b31b233c65734de04939ce65sewardj    case 110:
11250de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
11260de80192f57cd132b31b233c65734de04939ce65sewardj    case 111:
11270de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
11280de80192f57cd132b31b233c65734de04939ce65sewardj      break;
11290de80192f57cd132b31b233c65734de04939ce65sewardj    case 112:  /* "iret" */
11300de80192f57cd132b31b233c65734de04939ce65sewardj      next = mkU64(guest_PC_curr_instr + 8);
11310de80192f57cd132b31b233c65734de04939ce65sewardj      jumpkind = Ijk_Ret;
11320de80192f57cd132b31b233c65734de04939ce65sewardj      break;
11330de80192f57cd132b31b233c65734de04939ce65sewardj    case 113:  /* "j" */
11340de80192f57cd132b31b233c65734de04939ce65sewardj      next = mkU64(imm);
11350de80192f57cd132b31b233c65734de04939ce65sewardj      /* set steering address. */
11360de80192f57cd132b31b233c65734de04939ce65sewardj      steering_pc = imm;
11370de80192f57cd132b31b233c65734de04939ce65sewardj      jumpkind = Ijk_Boring;
11380de80192f57cd132b31b233c65734de04939ce65sewardj      break;
11390de80192f57cd132b31b233c65734de04939ce65sewardj    case 114:
11400de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
11410de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, mkU64(guest_PC_curr_instr + 8));
11420de80192f57cd132b31b233c65734de04939ce65sewardj      /* set steering address. */
11430de80192f57cd132b31b233c65734de04939ce65sewardj      steering_pc = imm;
11440de80192f57cd132b31b233c65734de04939ce65sewardj      next = mkU64(imm);
11450de80192f57cd132b31b233c65734de04939ce65sewardj      jumpkind = Ijk_Call;
11460de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(55, t2);
11470de80192f57cd132b31b233c65734de04939ce65sewardj      break;
11480de80192f57cd132b31b233c65734de04939ce65sewardj    case 115:  /* "jalr" */
11490de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
11500de80192f57cd132b31b233c65734de04939ce65sewardj    case 116:  /* "jalrp" */
11510de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
11520de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
11530de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, getIReg(ra));
11540de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, mkU64(guest_PC_curr_instr + 8));
11550de80192f57cd132b31b233c65734de04939ce65sewardj      next = mkexpr(t1);
11560de80192f57cd132b31b233c65734de04939ce65sewardj      jumpkind = Ijk_Call;
11570de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(55, t2);
11580de80192f57cd132b31b233c65734de04939ce65sewardj      break;
11590de80192f57cd132b31b233c65734de04939ce65sewardj    case 117:  /* "jr" */
11600de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
11610de80192f57cd132b31b233c65734de04939ce65sewardj    case 118:  /* "jrp" */
11620de80192f57cd132b31b233c65734de04939ce65sewardj      next = getIReg(ra);
11630de80192f57cd132b31b233c65734de04939ce65sewardj      jumpkind = Ijk_Boring;
11640de80192f57cd132b31b233c65734de04939ce65sewardj      break;
11650de80192f57cd132b31b233c65734de04939ce65sewardj    case 119:  /* "ld" */
11660de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
11670de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, load(Ity_I64, (getIReg(ra))));
11680de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
11690de80192f57cd132b31b233c65734de04939ce65sewardj      break;
11700de80192f57cd132b31b233c65734de04939ce65sewardj    case 120:  /* "ld1s" */
11710de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
11720de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_8Sto64,
11730de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I8, (getIReg(ra)))));
11740de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
11750de80192f57cd132b31b233c65734de04939ce65sewardj      break;
11760de80192f57cd132b31b233c65734de04939ce65sewardj    case 121:  /* "ld1s_add" */
11770de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
11780de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
11790de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, binop(Iop_Add64, getIReg(ra), mkU64(imm)));
11800de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_8Sto64,
11810de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I8, (getIReg(ra)))));
11820de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(ra, t1);
11830de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
11840de80192f57cd132b31b233c65734de04939ce65sewardj      break;
11850de80192f57cd132b31b233c65734de04939ce65sewardj    case 122:  /* "ld1u" */
11860de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
11870de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_8Uto64,
11880de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I8, (getIReg(ra)))));
11890de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
11900de80192f57cd132b31b233c65734de04939ce65sewardj
11910de80192f57cd132b31b233c65734de04939ce65sewardj      break;
11920de80192f57cd132b31b233c65734de04939ce65sewardj    case 123:  /* "ld1u_add" */
11930de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
11940de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
11950de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1,  binop(Iop_Add64, getIReg(ra), mkU64(imm)));
11960de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_8Uto64,
11970de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I8, (getIReg(ra)))));
11980de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(ra, t1);
11990de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
12000de80192f57cd132b31b233c65734de04939ce65sewardj      break;
12010de80192f57cd132b31b233c65734de04939ce65sewardj    case 124:  /* "ld2s" */
12020de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
12030de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_16Sto64,
12040de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I16, getIReg(ra))));
12050de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
12060de80192f57cd132b31b233c65734de04939ce65sewardj      break;
12070de80192f57cd132b31b233c65734de04939ce65sewardj    case 125:  /* "ld2s_add" */
12080de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
12090de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
12100de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1,  binop(Iop_Add64, getIReg(ra), mkU64(imm)));
12110de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_16Sto64,
12120de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I16, getIReg(ra))));
12130de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
12140de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(ra, t1);
12150de80192f57cd132b31b233c65734de04939ce65sewardj      break;
12160de80192f57cd132b31b233c65734de04939ce65sewardj    case 126: /* "ld2u" */
12170de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
12180de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_16Uto64,
12190de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I16, getIReg(ra))));
12200de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
12210de80192f57cd132b31b233c65734de04939ce65sewardj      break;
12220de80192f57cd132b31b233c65734de04939ce65sewardj    case 127: /* "ld2u_add" */
12230de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
12240de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
12250de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1,  binop(Iop_Add64, getIReg(ra), mkU64(imm)));
12260de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_16Uto64,
12270de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I16, getIReg(ra))));
12280de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
12290de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(ra, t1);
12300de80192f57cd132b31b233c65734de04939ce65sewardj      break;
12310de80192f57cd132b31b233c65734de04939ce65sewardj    case 128: /* "ld4s" */
12320de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
12330de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_32Sto64,
12340de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I32, (getIReg(ra)))));
12350de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
12360de80192f57cd132b31b233c65734de04939ce65sewardj      break;
12370de80192f57cd132b31b233c65734de04939ce65sewardj    case 129: /* "ld4s_add" */
12380de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
12390de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
12400de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1,  binop(Iop_Add64, getIReg(ra), mkU64(imm)));
12410de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_32Sto64,
12420de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I32, (getIReg(ra)))));
12430de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
12440de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(ra, t1);
12450de80192f57cd132b31b233c65734de04939ce65sewardj      break;
12460de80192f57cd132b31b233c65734de04939ce65sewardj    case 130:  /* "ld4u" */
12470de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
12480de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_32Uto64,
12490de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I32, getIReg(ra))));
12500de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
12510de80192f57cd132b31b233c65734de04939ce65sewardj      break;
12520de80192f57cd132b31b233c65734de04939ce65sewardj    case 131:  /* "ld4u_add" */
12530de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
12540de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
12550de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, binop(Iop_Add64, getIReg(ra), mkU64(imm)));
12560de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_32Uto64,
12570de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I32, getIReg(ra))));
12580de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(ra, t1);
12590de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
12600de80192f57cd132b31b233c65734de04939ce65sewardj      break;
12610de80192f57cd132b31b233c65734de04939ce65sewardj    case 132:  /* "ld_add" */
12620de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
12630de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
12640de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, load(Ity_I64, getIReg(ra)));
12650de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64, getIReg(ra), mkU64(imm)));
12660de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(ra, t2);
12670de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t1);
12680de80192f57cd132b31b233c65734de04939ce65sewardj      break;
12690de80192f57cd132b31b233c65734de04939ce65sewardj    case 133:  /* "ldna" */
12700de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
12710de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, load(Ity_I64,
12720de80192f57cd132b31b233c65734de04939ce65sewardj                      binop(Iop_And64,
12730de80192f57cd132b31b233c65734de04939ce65sewardj                            getIReg(ra),
12740de80192f57cd132b31b233c65734de04939ce65sewardj                            unop(Iop_Not64,
12750de80192f57cd132b31b233c65734de04939ce65sewardj                                 mkU64(7)))));
12760de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
12770de80192f57cd132b31b233c65734de04939ce65sewardj      break;
12780de80192f57cd132b31b233c65734de04939ce65sewardj    case 134:  /* "ldna_add" */
12790de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
12800de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
12810de80192f57cd132b31b233c65734de04939ce65sewardj
12820de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, binop(Iop_Add64, getIReg(ra), mkU64(imm)));
12830de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, load(Ity_I64,
12840de80192f57cd132b31b233c65734de04939ce65sewardj                      binop(Iop_And64,
12850de80192f57cd132b31b233c65734de04939ce65sewardj                            getIReg(ra),
12860de80192f57cd132b31b233c65734de04939ce65sewardj                            unop(Iop_Not64,
12870de80192f57cd132b31b233c65734de04939ce65sewardj                                 mkU64(7)))));
12880de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(ra, t1);
12890de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
12900de80192f57cd132b31b233c65734de04939ce65sewardj      break;
12910de80192f57cd132b31b233c65734de04939ce65sewardj    case 135:  /* "ldnt" */
12920de80192f57cd132b31b233c65734de04939ce65sewardj      /* Valgrind IR has no Non-Temp load. Use normal load. */
12930de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
12940de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, load(Ity_I64, (getIReg(ra))));
12950de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
12960de80192f57cd132b31b233c65734de04939ce65sewardj      break;
12970de80192f57cd132b31b233c65734de04939ce65sewardj    case 136:  /* "ldnt1s" */
12980de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
12990de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_8Sto64,
13000de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I8, (getIReg(ra)))));
13010de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
13020de80192f57cd132b31b233c65734de04939ce65sewardj      break;
13030de80192f57cd132b31b233c65734de04939ce65sewardj    case 137:  /* "ldnt1s_add" */
13040de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
13050de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
13060de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_8Sto64,
13070de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I8, (getIReg(ra)))));
13080de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, binop(Iop_Add64, getIReg(ra), mkU64(imm)));
13090de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(ra, t1);
13100de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
13110de80192f57cd132b31b233c65734de04939ce65sewardj      break;
13120de80192f57cd132b31b233c65734de04939ce65sewardj    case 138:  /* "ldnt1u" */
13130de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
13140de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_8Uto64,
13150de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I8, (getIReg(ra)))));
13160de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
13170de80192f57cd132b31b233c65734de04939ce65sewardj      break;
13180de80192f57cd132b31b233c65734de04939ce65sewardj    case 139:  /* "ldnt1u_add" */
13190de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
13200de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
13210de80192f57cd132b31b233c65734de04939ce65sewardj
13220de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, binop(Iop_Add64, getIReg(ra), mkU64(imm)));
13230de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_8Uto64,
13240de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I8, (getIReg(ra)))));
13250de80192f57cd132b31b233c65734de04939ce65sewardj
13260de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(ra, t1);
13270de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
13280de80192f57cd132b31b233c65734de04939ce65sewardj      break;
13290de80192f57cd132b31b233c65734de04939ce65sewardj    case 140:  /* "ldnt2s" */
13300de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
13310de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_16Sto64,
13320de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I16, getIReg(ra))));
13330de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
13340de80192f57cd132b31b233c65734de04939ce65sewardj      break;
13350de80192f57cd132b31b233c65734de04939ce65sewardj    case 141:  /* "ldnt2s_add" */
13360de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
13370de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
13380de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_16Sto64,
13390de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I16, getIReg(ra))));
13400de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, binop(Iop_Add64, getIReg(ra), mkU64(imm)));
13410de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(ra, t1);
13420de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
13430de80192f57cd132b31b233c65734de04939ce65sewardj      break;
13440de80192f57cd132b31b233c65734de04939ce65sewardj    case 142:  /* "ldnt2u" */
13450de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
13460de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_16Uto64,
13470de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I16, getIReg(ra))));
13480de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
13490de80192f57cd132b31b233c65734de04939ce65sewardj      break;
13500de80192f57cd132b31b233c65734de04939ce65sewardj    case 143:  /* "ldnt2u_add" */
13510de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
13520de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
13530de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_16Uto64,
13540de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I16, getIReg(ra))));
13550de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, binop(Iop_Add64, getIReg(ra), mkU64(imm)));
13560de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(ra, t1);
13570de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
13580de80192f57cd132b31b233c65734de04939ce65sewardj      break;
13590de80192f57cd132b31b233c65734de04939ce65sewardj    case 144:  /* "ldnt4s" */
13600de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
13610de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_32Sto64,
13620de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I32, (getIReg(ra)))));
13630de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
13640de80192f57cd132b31b233c65734de04939ce65sewardj      break;
13650de80192f57cd132b31b233c65734de04939ce65sewardj    case 145:  /* "ldnt4s_add" */
13660de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
13670de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
13680de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_32Sto64,
13690de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I32, (getIReg(ra)))));
13700de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, binop(Iop_Add64, getIReg(ra), mkU64(imm)));
13710de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
13720de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(ra, t1);
13730de80192f57cd132b31b233c65734de04939ce65sewardj      break;
13740de80192f57cd132b31b233c65734de04939ce65sewardj    case 146:  /* "ldnt4u" */
13750de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
13760de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_32Uto64,
13770de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I32, getIReg(ra))));
13780de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
13790de80192f57cd132b31b233c65734de04939ce65sewardj      break;
13800de80192f57cd132b31b233c65734de04939ce65sewardj    case 147:  /* "ldnt4u_add" */
13810de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
13820de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
13830de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_32Uto64,
13840de80192f57cd132b31b233c65734de04939ce65sewardj                       load(Ity_I32, getIReg(ra))));
13850de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, binop(Iop_Add64, getIReg(ra), mkU64(imm)));
13860de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
13870de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(ra, t1);
13880de80192f57cd132b31b233c65734de04939ce65sewardj      break;
13890de80192f57cd132b31b233c65734de04939ce65sewardj    case 148:  /* "ldnt_add" */
13900de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
13910de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
13920de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, load(Ity_I64, getIReg(ra)));
13930de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64, getIReg(ra), mkU64(imm)));
13940de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t1);
13950de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(ra, t2);
13960de80192f57cd132b31b233c65734de04939ce65sewardj      break;
13970de80192f57cd132b31b233c65734de04939ce65sewardj    case 149:  /* "lnk" */
13980de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
13990de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  mkU64(guest_PC_curr_instr + 8));
14000de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
14010de80192f57cd132b31b233c65734de04939ce65sewardj      break;
14020de80192f57cd132b31b233c65734de04939ce65sewardj    case 150:  /* "mf" */
14030de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
14040de80192f57cd132b31b233c65734de04939ce65sewardj      break;
14050de80192f57cd132b31b233c65734de04939ce65sewardj    case 151:  /* "mfspr" */
140632bf4136270f100788bcad4edb7d47e1b43df254zliu      t2 = newTemp(Ity_I64);
140732bf4136270f100788bcad4edb7d47e1b43df254zliu      if (imm == 0x2780) { // Get Cmpexch value
140832bf4136270f100788bcad4edb7d47e1b43df254zliu	 assign(t2, getIReg(70));
140932bf4136270f100788bcad4edb7d47e1b43df254zliu	 MARK_REG_WB(rd, t2);
141032bf4136270f100788bcad4edb7d47e1b43df254zliu      } else if (imm == 0x2580) { // Get EX_CONTEXT_0_0
141132bf4136270f100788bcad4edb7d47e1b43df254zliu         assign(t2, getIReg(576 / 8));
141232bf4136270f100788bcad4edb7d47e1b43df254zliu         MARK_REG_WB(rd, t2);
141332bf4136270f100788bcad4edb7d47e1b43df254zliu      } else if (imm == 0x2581) { // Get EX_CONTEXT_0_1
141432bf4136270f100788bcad4edb7d47e1b43df254zliu         assign(t2, getIReg(584 / 8));
141532bf4136270f100788bcad4edb7d47e1b43df254zliu         MARK_REG_WB(rd, t2);
141632bf4136270f100788bcad4edb7d47e1b43df254zliu      } else
14170de80192f57cd132b31b233c65734de04939ce65sewardj        use_dirty_helper = 1;
14180de80192f57cd132b31b233c65734de04939ce65sewardj      break;
14190de80192f57cd132b31b233c65734de04939ce65sewardj    case 152:  /* "mm" */
14200de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
14210de80192f57cd132b31b233c65734de04939ce65sewardj      break;
14220de80192f57cd132b31b233c65734de04939ce65sewardj    case 153:  /* "mnz" */
14230de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
14240de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_And64,
14250de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_1Sto64, binop(Iop_CmpNE64,
14260de80192f57cd132b31b233c65734de04939ce65sewardj                                              getIReg(ra),
14270de80192f57cd132b31b233c65734de04939ce65sewardj                                              mkU64(0))),
14280de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(rb)));
14290de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
14300de80192f57cd132b31b233c65734de04939ce65sewardj      break;
14310de80192f57cd132b31b233c65734de04939ce65sewardj    case 154:  /* "mtspr imm, ra" */
14320de80192f57cd132b31b233c65734de04939ce65sewardj      if (imm == 0x2780) // Set Cmpexch value
14330de80192f57cd132b31b233c65734de04939ce65sewardj        putIReg(70, getIReg(ra));
14340de80192f57cd132b31b233c65734de04939ce65sewardj      else if (imm == 0x2580) // set EX_CONTEXT_0_0
14350de80192f57cd132b31b233c65734de04939ce65sewardj        putIReg(576/8, getIReg(ra));
14360de80192f57cd132b31b233c65734de04939ce65sewardj      else if (imm == 0x2581) // set EX_CONTEXT_0_1
14370de80192f57cd132b31b233c65734de04939ce65sewardj        putIReg(584/8, getIReg(ra));
14380de80192f57cd132b31b233c65734de04939ce65sewardj      else
14390de80192f57cd132b31b233c65734de04939ce65sewardj        use_dirty_helper = 1;
14400de80192f57cd132b31b233c65734de04939ce65sewardj      break;
14410de80192f57cd132b31b233c65734de04939ce65sewardj    case 155:  /* "mul_hs_hs" */
14420de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
14430de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_MullS32,
14440de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32,
14450de80192f57cd132b31b233c65734de04939ce65sewardj                            binop(Iop_Shr64,
14460de80192f57cd132b31b233c65734de04939ce65sewardj                                  getIReg(ra),
14470de80192f57cd132b31b233c65734de04939ce65sewardj                                  mkU8(32))),
14480de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32,
14490de80192f57cd132b31b233c65734de04939ce65sewardj                            binop(Iop_Shr64,
14500de80192f57cd132b31b233c65734de04939ce65sewardj                                  getIReg(rb),
14510de80192f57cd132b31b233c65734de04939ce65sewardj                                  mkU8(32)))));
14520de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
14530de80192f57cd132b31b233c65734de04939ce65sewardj      break;
14540de80192f57cd132b31b233c65734de04939ce65sewardj    case 156:  /* "mul_hs_hu" */
14550de80192f57cd132b31b233c65734de04939ce65sewardj      t0 = newTemp(Ity_I64);
14560de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
14570de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
14580de80192f57cd132b31b233c65734de04939ce65sewardj      t3 = newTemp(Ity_I64);
14590de80192f57cd132b31b233c65734de04939ce65sewardj
14600de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t0, unop(Iop_32Sto64,
14610de80192f57cd132b31b233c65734de04939ce65sewardj                      unop(Iop_64to32,
14620de80192f57cd132b31b233c65734de04939ce65sewardj                           binop(Iop_Shr64, getIReg(ra), mkU8(32)))));
14630de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, binop(Iop_MullU32,
14640de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, mkexpr(t0)),
14650de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, binop(Iop_Shr64, getIReg(rb), mkU8(32)))));
14660de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t3, binop(Iop_MullU32,
14670de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, binop(Iop_Shr64,
14680de80192f57cd132b31b233c65734de04939ce65sewardj                                              mkexpr(t0),
14690de80192f57cd132b31b233c65734de04939ce65sewardj                                              mkU8(32))),
14700de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, binop(Iop_Shr64, getIReg(rb), mkU8(32)))));
14710de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64,
14720de80192f57cd132b31b233c65734de04939ce65sewardj                       mkexpr(t1),
14730de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_Shl64,
14740de80192f57cd132b31b233c65734de04939ce65sewardj                             mkexpr(t3),
14750de80192f57cd132b31b233c65734de04939ce65sewardj                             mkU8(32))));
14760de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
14770de80192f57cd132b31b233c65734de04939ce65sewardj      break;
14780de80192f57cd132b31b233c65734de04939ce65sewardj    case 157:  /* "mul_hs_ls" */
14790de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
14800de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_MullS32,
14810de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32,
14820de80192f57cd132b31b233c65734de04939ce65sewardj                            binop(Iop_Shr64,
14830de80192f57cd132b31b233c65734de04939ce65sewardj                                  getIReg(ra),
14840de80192f57cd132b31b233c65734de04939ce65sewardj                                  mkU8(32))),
14850de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32,
14860de80192f57cd132b31b233c65734de04939ce65sewardj                            getIReg(rb))));
14870de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
14880de80192f57cd132b31b233c65734de04939ce65sewardj      break;
14890de80192f57cd132b31b233c65734de04939ce65sewardj    case 158:  /* "mul_hs_lu" */
14900de80192f57cd132b31b233c65734de04939ce65sewardj      t0 = newTemp(Ity_I64);
14910de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
14920de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
14930de80192f57cd132b31b233c65734de04939ce65sewardj      t3 = newTemp(Ity_I64);
14940de80192f57cd132b31b233c65734de04939ce65sewardj
14950de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t0, unop(Iop_32Sto64,
14960de80192f57cd132b31b233c65734de04939ce65sewardj                      unop(Iop_64to32,
14970de80192f57cd132b31b233c65734de04939ce65sewardj                           binop(Iop_Shr64, getIReg(ra), mkU8(32)))));
14980de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, binop(Iop_MullU32,
14990de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, mkexpr(t0)),
15000de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, getIReg(rb))));
15010de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t3, binop(Iop_MullU32,
15020de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, binop(Iop_Shr64,
15030de80192f57cd132b31b233c65734de04939ce65sewardj                                              mkexpr(t0),
15040de80192f57cd132b31b233c65734de04939ce65sewardj                                              mkU8(32))),
15050de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, getIReg(rb))));
15060de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64,
15070de80192f57cd132b31b233c65734de04939ce65sewardj                       mkexpr(t1),
15080de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_Shl64,
15090de80192f57cd132b31b233c65734de04939ce65sewardj                             mkexpr(t3),
15100de80192f57cd132b31b233c65734de04939ce65sewardj                             mkU8(32))));
15110de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
15120de80192f57cd132b31b233c65734de04939ce65sewardj      break;
15130de80192f57cd132b31b233c65734de04939ce65sewardj    case 159:  /* "mul_hu_hu" */
15140de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
15150de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_MullU32,
15160de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32,
15170de80192f57cd132b31b233c65734de04939ce65sewardj                            binop(Iop_Shr64,
15180de80192f57cd132b31b233c65734de04939ce65sewardj                                  getIReg(ra),
15190de80192f57cd132b31b233c65734de04939ce65sewardj                                  mkU8(32))),
15200de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32,
15210de80192f57cd132b31b233c65734de04939ce65sewardj                            binop(Iop_Shr64,
15220de80192f57cd132b31b233c65734de04939ce65sewardj                                  getIReg(rb),
15230de80192f57cd132b31b233c65734de04939ce65sewardj                                  mkU8(32)))));
15240de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
15250de80192f57cd132b31b233c65734de04939ce65sewardj      break;
15260de80192f57cd132b31b233c65734de04939ce65sewardj    case 160:  /* "mul_hu_ls" */
15270de80192f57cd132b31b233c65734de04939ce65sewardj      t0 = newTemp(Ity_I64);
15280de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
15290de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
15300de80192f57cd132b31b233c65734de04939ce65sewardj      t3 = newTemp(Ity_I64);
15310de80192f57cd132b31b233c65734de04939ce65sewardj
15320de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t0, unop(Iop_32Sto64,
15330de80192f57cd132b31b233c65734de04939ce65sewardj                      unop(Iop_64to32,
15340de80192f57cd132b31b233c65734de04939ce65sewardj                           getIReg(ra))));
15350de80192f57cd132b31b233c65734de04939ce65sewardj
15360de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, binop(Iop_MullU32,
15370de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, mkexpr(t0)),
15380de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, binop(Iop_Shr64, getIReg(rb), mkU8(32)))));
15390de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t3, binop(Iop_MullU32,
15400de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, binop(Iop_Shr64,
15410de80192f57cd132b31b233c65734de04939ce65sewardj                                              mkexpr(t0),
15420de80192f57cd132b31b233c65734de04939ce65sewardj                                              mkU8(32))),
15430de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, binop(Iop_Shr64, getIReg(rb), mkU8(32)))));
15440de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64,
15450de80192f57cd132b31b233c65734de04939ce65sewardj                       mkexpr(t1),
15460de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_Shl64,
15470de80192f57cd132b31b233c65734de04939ce65sewardj                             mkexpr(t3),
15480de80192f57cd132b31b233c65734de04939ce65sewardj                             mkU8(32))));
15490de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
15500de80192f57cd132b31b233c65734de04939ce65sewardj      break;
15510de80192f57cd132b31b233c65734de04939ce65sewardj    case 161:  /* "mul_hu_lu" */
15520de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
15530de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_MullU32,
15540de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32,
15550de80192f57cd132b31b233c65734de04939ce65sewardj                            binop(Iop_Shr64,
15560de80192f57cd132b31b233c65734de04939ce65sewardj                                  getIReg(ra),
15570de80192f57cd132b31b233c65734de04939ce65sewardj                                  mkU8(32))),
15580de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32,
15590de80192f57cd132b31b233c65734de04939ce65sewardj                            getIReg(rb))));
15600de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
15610de80192f57cd132b31b233c65734de04939ce65sewardj      break;
15620de80192f57cd132b31b233c65734de04939ce65sewardj    case 162:  /* "mul_ls_ls" */
15630de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
15640de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_MullS32,
15650de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, getIReg(ra)),
15660de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, getIReg(rb))));
15670de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
15680de80192f57cd132b31b233c65734de04939ce65sewardj      break;
15690de80192f57cd132b31b233c65734de04939ce65sewardj    case 163:  /* "mul_ls_lu" */
15700de80192f57cd132b31b233c65734de04939ce65sewardj      t0 = newTemp(Ity_I64);
15710de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
15720de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
15730de80192f57cd132b31b233c65734de04939ce65sewardj      t3 = newTemp(Ity_I64);
15740de80192f57cd132b31b233c65734de04939ce65sewardj
15750de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t0, unop(Iop_32Sto64,
15760de80192f57cd132b31b233c65734de04939ce65sewardj                      unop(Iop_64to32, getIReg(ra))));
15770de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, binop(Iop_MullU32,
15780de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, mkexpr(t0)),
15790de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, getIReg(rb))));
15800de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t3, binop(Iop_MullU32,
15810de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, binop(Iop_Shr64,
15820de80192f57cd132b31b233c65734de04939ce65sewardj                                              mkexpr(t0),
15830de80192f57cd132b31b233c65734de04939ce65sewardj                                              mkU8(32))),
15840de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, getIReg(rb))));
15850de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64,
15860de80192f57cd132b31b233c65734de04939ce65sewardj                       mkexpr(t1),
15870de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_Shl64,
15880de80192f57cd132b31b233c65734de04939ce65sewardj                             mkexpr(t3),
15890de80192f57cd132b31b233c65734de04939ce65sewardj                             mkU8(32))));
15900de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
15910de80192f57cd132b31b233c65734de04939ce65sewardj      break;
15920de80192f57cd132b31b233c65734de04939ce65sewardj    case 164:   /* "mul_lu_lu" */
15930de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
15940de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_MullU32,
15950de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, getIReg(ra)),
15960de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, getIReg(rb))));
15970de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
15980de80192f57cd132b31b233c65734de04939ce65sewardj      break;
15990de80192f57cd132b31b233c65734de04939ce65sewardj    case 165:   /* "mula_hs_hs" */
16000de80192f57cd132b31b233c65734de04939ce65sewardj      t0 = newTemp(Ity_I64);
16010de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
16020de80192f57cd132b31b233c65734de04939ce65sewardj
16030de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t0, binop(Iop_MullS32,
16040de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, binop(Iop_Shr64,
16050de80192f57cd132b31b233c65734de04939ce65sewardj                                              getIReg(ra), mkU8(32))),
16060de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, binop(Iop_Shr64,
16070de80192f57cd132b31b233c65734de04939ce65sewardj                                              getIReg(rb), mkU8(32)))));
16080de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64, getIReg(rd), mkexpr(t0)));
16090de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
16100de80192f57cd132b31b233c65734de04939ce65sewardj      break;
16110de80192f57cd132b31b233c65734de04939ce65sewardj    case 166:   /* "mula_hs_hu" */
16120de80192f57cd132b31b233c65734de04939ce65sewardj      t0 = newTemp(Ity_I64);
16130de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
16140de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
16150de80192f57cd132b31b233c65734de04939ce65sewardj      t3 = newTemp(Ity_I64);
16160de80192f57cd132b31b233c65734de04939ce65sewardj      t4 = newTemp(Ity_I64);
16170de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t0, unop(Iop_32Sto64,
16180de80192f57cd132b31b233c65734de04939ce65sewardj                      unop(Iop_64to32,
16190de80192f57cd132b31b233c65734de04939ce65sewardj                           binop(Iop_Shr64, getIReg(ra), mkU8(32)))));
16200de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, binop(Iop_MullU32,
16210de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, mkexpr(t0)),
16220de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, binop(Iop_Shr64,
16230de80192f57cd132b31b233c65734de04939ce65sewardj                                              getIReg(rb), mkU8(32)))));
16240de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t3, binop(Iop_MullU32,
16250de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, binop(Iop_Shr64,
16260de80192f57cd132b31b233c65734de04939ce65sewardj                                              mkexpr(t0),
16270de80192f57cd132b31b233c65734de04939ce65sewardj                                              mkU8(32))),
16280de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, binop(Iop_Shr64,
16290de80192f57cd132b31b233c65734de04939ce65sewardj                                              getIReg(rb), mkU8(32)))));
16300de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64,
16310de80192f57cd132b31b233c65734de04939ce65sewardj                       mkexpr(t1),
16320de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_Shl64,
16330de80192f57cd132b31b233c65734de04939ce65sewardj                             mkexpr(t3),
16340de80192f57cd132b31b233c65734de04939ce65sewardj                             mkU8(32))));
16350de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t4, binop(Iop_Add64, getIReg(rd), mkexpr(t2)));
16360de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t4);
16370de80192f57cd132b31b233c65734de04939ce65sewardj      break;
16380de80192f57cd132b31b233c65734de04939ce65sewardj    case 167:   /* "mula_hs_ls" */
16390de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
16400de80192f57cd132b31b233c65734de04939ce65sewardj      t4 = newTemp(Ity_I64);
16410de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_MullS32,
16420de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32,
16430de80192f57cd132b31b233c65734de04939ce65sewardj                            binop(Iop_Shr64,
16440de80192f57cd132b31b233c65734de04939ce65sewardj                                  getIReg(ra),
16450de80192f57cd132b31b233c65734de04939ce65sewardj                                  mkU8(32))),
16460de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32,
16470de80192f57cd132b31b233c65734de04939ce65sewardj                            getIReg(rb))));
16480de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t4, binop(Iop_Add64, getIReg(rd), mkexpr(t2)));
16490de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t4);
16500de80192f57cd132b31b233c65734de04939ce65sewardj      break;
16510de80192f57cd132b31b233c65734de04939ce65sewardj    case 168:   /* "mula_hs_lu" */
16520de80192f57cd132b31b233c65734de04939ce65sewardj      t0 = newTemp(Ity_I64);
16530de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
16540de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
16550de80192f57cd132b31b233c65734de04939ce65sewardj      t3 = newTemp(Ity_I64);
16560de80192f57cd132b31b233c65734de04939ce65sewardj      t4 = newTemp(Ity_I64);
16570de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t0, unop(Iop_32Sto64,
16580de80192f57cd132b31b233c65734de04939ce65sewardj                      unop(Iop_64to32,
16590de80192f57cd132b31b233c65734de04939ce65sewardj                           binop(Iop_Shr64, getIReg(ra), mkU8(32)))));
16600de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, binop(Iop_MullU32,
16610de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, mkexpr(t0)),
16620de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, getIReg(rb))));
16630de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t3, binop(Iop_MullU32,
16640de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, binop(Iop_Shr64,
16650de80192f57cd132b31b233c65734de04939ce65sewardj                                              mkexpr(t0),
16660de80192f57cd132b31b233c65734de04939ce65sewardj                                              mkU8(32))),
16670de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, getIReg(rb))));
16680de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64,
16690de80192f57cd132b31b233c65734de04939ce65sewardj                       mkexpr(t1),
16700de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_Shl64,
16710de80192f57cd132b31b233c65734de04939ce65sewardj                             mkexpr(t3),
16720de80192f57cd132b31b233c65734de04939ce65sewardj                             mkU8(32))));
16730de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t4, binop(Iop_Add64, getIReg(rd), mkexpr(t2)));
16740de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t4);
16750de80192f57cd132b31b233c65734de04939ce65sewardj      break;
16760de80192f57cd132b31b233c65734de04939ce65sewardj    case 169:   /* "mula_hu_hu" */
16770de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
16780de80192f57cd132b31b233c65734de04939ce65sewardj      break;
16790de80192f57cd132b31b233c65734de04939ce65sewardj    case 170:   /* "mula_hu_ls" */
16800de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
16810de80192f57cd132b31b233c65734de04939ce65sewardj      break;
16820de80192f57cd132b31b233c65734de04939ce65sewardj    case 171:   /* "mula_hu_lu" */
16830de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
16840de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64,
16850de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_MullU32,
16860de80192f57cd132b31b233c65734de04939ce65sewardj                             unop(Iop_64to32,
16870de80192f57cd132b31b233c65734de04939ce65sewardj                                  binop(Iop_Shr64,
16880de80192f57cd132b31b233c65734de04939ce65sewardj                                        getIReg(ra),
16890de80192f57cd132b31b233c65734de04939ce65sewardj                                        mkU8(32))),
16900de80192f57cd132b31b233c65734de04939ce65sewardj                             unop(Iop_64to32,
16910de80192f57cd132b31b233c65734de04939ce65sewardj                                  getIReg(rb))),
16920de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(rd)));
16930de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
16940de80192f57cd132b31b233c65734de04939ce65sewardj      break;
16950de80192f57cd132b31b233c65734de04939ce65sewardj    case 172:  /* "mula_ls_ls" */
16960de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
16970de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64,
16980de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(rd),
16990de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_MullS32,
17000de80192f57cd132b31b233c65734de04939ce65sewardj                             unop(Iop_64to32, getIReg(ra)),
17010de80192f57cd132b31b233c65734de04939ce65sewardj                             unop(Iop_64to32, getIReg(rb)))));
17020de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
17030de80192f57cd132b31b233c65734de04939ce65sewardj      break;
17040de80192f57cd132b31b233c65734de04939ce65sewardj    case 173:  /* "mula_ls_lu" */
17050de80192f57cd132b31b233c65734de04939ce65sewardj      t0 = newTemp(Ity_I64);
17060de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
17070de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
17080de80192f57cd132b31b233c65734de04939ce65sewardj      t3 = newTemp(Ity_I64);
17090de80192f57cd132b31b233c65734de04939ce65sewardj
17100de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t0, unop(Iop_32Sto64,
17110de80192f57cd132b31b233c65734de04939ce65sewardj                      unop(Iop_64to32, getIReg(ra))));
17120de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, binop(Iop_MullU32,
17130de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, mkexpr(t0)),
17140de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, getIReg(rb))));
17150de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t3, binop(Iop_MullU32,
17160de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, binop(Iop_Shr64,
17170de80192f57cd132b31b233c65734de04939ce65sewardj                                              mkexpr(t0),
17180de80192f57cd132b31b233c65734de04939ce65sewardj                                              mkU8(32))),
17190de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to32, getIReg(rb))));
17200de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64,
17210de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(rd),
17220de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_Add64,
17230de80192f57cd132b31b233c65734de04939ce65sewardj                             mkexpr(t1),
17240de80192f57cd132b31b233c65734de04939ce65sewardj                             binop(Iop_Shl64,
17250de80192f57cd132b31b233c65734de04939ce65sewardj                                   mkexpr(t3),
17260de80192f57cd132b31b233c65734de04939ce65sewardj                                   mkU8(32)))));
17270de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
17280de80192f57cd132b31b233c65734de04939ce65sewardj      break;
17290de80192f57cd132b31b233c65734de04939ce65sewardj    case 174:  /* "mula_lu_lu" */
17300de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
17310de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64,
17320de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_MullU32,
17330de80192f57cd132b31b233c65734de04939ce65sewardj                             unop(Iop_64to32,
17340de80192f57cd132b31b233c65734de04939ce65sewardj                                  getIReg(ra)),
17350de80192f57cd132b31b233c65734de04939ce65sewardj                             unop(Iop_64to32,
17360de80192f57cd132b31b233c65734de04939ce65sewardj                                  getIReg(rb))),
17370de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(rd)));
17380de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
17390de80192f57cd132b31b233c65734de04939ce65sewardj      break;
17400de80192f57cd132b31b233c65734de04939ce65sewardj    case 175:   /* "mulax" */
17410de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
17420de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, unop(Iop_32Sto64,
17430de80192f57cd132b31b233c65734de04939ce65sewardj                      unop(Iop_64to32,
17440de80192f57cd132b31b233c65734de04939ce65sewardj                           binop(Iop_Add64,
17450de80192f57cd132b31b233c65734de04939ce65sewardj                                 getIReg(rd),
17460de80192f57cd132b31b233c65734de04939ce65sewardj                                 binop(Iop_MullU32,
17470de80192f57cd132b31b233c65734de04939ce65sewardj                                       narrowTo(Ity_I32, getIReg(ra)),
17480de80192f57cd132b31b233c65734de04939ce65sewardj                                       narrowTo(Ity_I32, getIReg(rb)))))));
17490de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
17500de80192f57cd132b31b233c65734de04939ce65sewardj      break;
17510de80192f57cd132b31b233c65734de04939ce65sewardj    case 176:   /* "mulx" */
17520de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
17530de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, unop(Iop_32Sto64,
17540de80192f57cd132b31b233c65734de04939ce65sewardj                      unop(Iop_64to32,
17550de80192f57cd132b31b233c65734de04939ce65sewardj                           binop(Iop_MullU32,
17560de80192f57cd132b31b233c65734de04939ce65sewardj                                 narrowTo(Ity_I32, getIReg(ra)),
17570de80192f57cd132b31b233c65734de04939ce65sewardj                                 narrowTo(Ity_I32, getIReg(rb))))));
17580de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
17590de80192f57cd132b31b233c65734de04939ce65sewardj      break;
17600de80192f57cd132b31b233c65734de04939ce65sewardj    case 177:   /* "mz" */
17610de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
17620de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_And64,
17630de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_1Sto64, binop(Iop_CmpEQ64,
17640de80192f57cd132b31b233c65734de04939ce65sewardj                                              getIReg(ra),
17650de80192f57cd132b31b233c65734de04939ce65sewardj                                              mkU64(0))),
17660de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(rb)));
17670de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
17680de80192f57cd132b31b233c65734de04939ce65sewardj      break;
17690de80192f57cd132b31b233c65734de04939ce65sewardj    case 178:  /* "nap" */
17700de80192f57cd132b31b233c65734de04939ce65sewardj      break;
17710de80192f57cd132b31b233c65734de04939ce65sewardj    case 179:  /* "nop" */
17720de80192f57cd132b31b233c65734de04939ce65sewardj      break;
17730de80192f57cd132b31b233c65734de04939ce65sewardj    case 180:  /* "nor" */
17740de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
17750de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, unop(Iop_Not64,
17760de80192f57cd132b31b233c65734de04939ce65sewardj                      binop(Iop_Or64,
17770de80192f57cd132b31b233c65734de04939ce65sewardj                            getIReg(ra),
17780de80192f57cd132b31b233c65734de04939ce65sewardj                            getIReg(rb))));
17790de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
17800de80192f57cd132b31b233c65734de04939ce65sewardj      break;
17810de80192f57cd132b31b233c65734de04939ce65sewardj    case 181:  /* "or" */
17820de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
17830de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Or64,
17840de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(ra),
17850de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(rb)));
17860de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
17870de80192f57cd132b31b233c65734de04939ce65sewardj      break;
17880de80192f57cd132b31b233c65734de04939ce65sewardj    case 182:  /* "ori" */
17890de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
17900de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Or64,
17910de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(ra),
17920de80192f57cd132b31b233c65734de04939ce65sewardj                       mkU64(imm)));
17930de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
17940de80192f57cd132b31b233c65734de04939ce65sewardj      break;
17950de80192f57cd132b31b233c65734de04939ce65sewardj    case 183:
17960de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
17970de80192f57cd132b31b233c65734de04939ce65sewardj    case 184:
17980de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
17990de80192f57cd132b31b233c65734de04939ce65sewardj    case 185:
18000de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
18010de80192f57cd132b31b233c65734de04939ce65sewardj      break;
18020de80192f57cd132b31b233c65734de04939ce65sewardj    case 186:  /* "rotl" */
18030de80192f57cd132b31b233c65734de04939ce65sewardj      t0 = newTemp(Ity_I64);
18040de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
18050de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
18060de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t0, binop(Iop_Shl64,
18070de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(ra),
18080de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to8, getIReg(rb))));
18090de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, binop(Iop_Shr64,
18100de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(ra),
18110de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to8, binop(Iop_Sub64,
18120de80192f57cd132b31b233c65734de04939ce65sewardj                                             mkU64(0),
18130de80192f57cd132b31b233c65734de04939ce65sewardj                                             getIReg(rb)))));
18140de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Or64, mkexpr(t0), mkexpr(t1)));
18150de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
18160de80192f57cd132b31b233c65734de04939ce65sewardj      break;
18170de80192f57cd132b31b233c65734de04939ce65sewardj    case 187:  /* "rotli" */
18180de80192f57cd132b31b233c65734de04939ce65sewardj      t0 = newTemp(Ity_I64);
18190de80192f57cd132b31b233c65734de04939ce65sewardj      t1 = newTemp(Ity_I64);
18200de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
18210de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t0, binop(Iop_Shl64,
18220de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(ra),
18230de80192f57cd132b31b233c65734de04939ce65sewardj                       mkU8(imm)));
18240de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t1, binop(Iop_Shr64,
18250de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(ra),
18260de80192f57cd132b31b233c65734de04939ce65sewardj                       mkU8(0 - imm)));
18270de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Or64, mkexpr(t0), mkexpr(t1)));
18280de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
18290de80192f57cd132b31b233c65734de04939ce65sewardj      break;
18300de80192f57cd132b31b233c65734de04939ce65sewardj    case 188:   /* "shl" */
18310de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
18320de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Shl64,
18330de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(ra),
18340de80192f57cd132b31b233c65734de04939ce65sewardj                       unop(Iop_64to8, getIReg(rb))));
18350de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
18360de80192f57cd132b31b233c65734de04939ce65sewardj
18370de80192f57cd132b31b233c65734de04939ce65sewardj      break;
18380de80192f57cd132b31b233c65734de04939ce65sewardj    case 189:   /* "shl16insli" */
18390de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
18400de80192f57cd132b31b233c65734de04939ce65sewardj      t3 = newTemp(Ity_I64);
18410de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t3, binop(Iop_Shl64, getIReg(ra), mkU8(16)));
18420de80192f57cd132b31b233c65734de04939ce65sewardj      imm &= 0xFFFFULL;
18430de80192f57cd132b31b233c65734de04939ce65sewardj      if (imm & 0x8000)
18440de80192f57cd132b31b233c65734de04939ce65sewardj      {
18450de80192f57cd132b31b233c65734de04939ce65sewardj        t4 = newTemp(Ity_I64);
18460de80192f57cd132b31b233c65734de04939ce65sewardj        assign(t4, mkU64(imm));
18470de80192f57cd132b31b233c65734de04939ce65sewardj        assign(t2, binop(Iop_Add64, mkexpr(t3), mkexpr(t4)));
18480de80192f57cd132b31b233c65734de04939ce65sewardj      }
18490de80192f57cd132b31b233c65734de04939ce65sewardj      else
18500de80192f57cd132b31b233c65734de04939ce65sewardj      {
18510de80192f57cd132b31b233c65734de04939ce65sewardj        assign(t2, binop(Iop_Add64, mkexpr(t3), mkU64(imm)));
18520de80192f57cd132b31b233c65734de04939ce65sewardj      }
18530de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
18540de80192f57cd132b31b233c65734de04939ce65sewardj
18550de80192f57cd132b31b233c65734de04939ce65sewardj      break;
18560de80192f57cd132b31b233c65734de04939ce65sewardj    case 190:   /* "shl1add" */
18570de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
18580de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64,
18590de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_Shl64,
18600de80192f57cd132b31b233c65734de04939ce65sewardj                             getIReg(ra), mkU8(1)),
18610de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(rb)));
18620de80192f57cd132b31b233c65734de04939ce65sewardj
18630de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
18640de80192f57cd132b31b233c65734de04939ce65sewardj      break;
18650de80192f57cd132b31b233c65734de04939ce65sewardj    case 191:   /* "shl1addx" */
18660de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
18670de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,
18680de80192f57cd132b31b233c65734de04939ce65sewardj             unop(Iop_32Sto64,
18690de80192f57cd132b31b233c65734de04939ce65sewardj                  unop(Iop_64to32,
18700de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_Add64,
18710de80192f57cd132b31b233c65734de04939ce65sewardj                             binop(Iop_Shl64,
18720de80192f57cd132b31b233c65734de04939ce65sewardj                                   getIReg(ra), mkU8(1)),
18730de80192f57cd132b31b233c65734de04939ce65sewardj                             getIReg(rb)))));
18740de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
18750de80192f57cd132b31b233c65734de04939ce65sewardj      break;
18760de80192f57cd132b31b233c65734de04939ce65sewardj    case 192:   /* "shl2add" */
18770de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
18780de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64,
18790de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_Shl64,
18800de80192f57cd132b31b233c65734de04939ce65sewardj                             getIReg(ra), mkU8(2)),
18810de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(rb)));
18820de80192f57cd132b31b233c65734de04939ce65sewardj
18830de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
18840de80192f57cd132b31b233c65734de04939ce65sewardj
18850de80192f57cd132b31b233c65734de04939ce65sewardj      break;
18860de80192f57cd132b31b233c65734de04939ce65sewardj    case 193:   /* "shl2addx" */
18870de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
18880de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,
18890de80192f57cd132b31b233c65734de04939ce65sewardj             unop(Iop_32Sto64,
18900de80192f57cd132b31b233c65734de04939ce65sewardj                  unop(Iop_64to32,
18910de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_Add64,
18920de80192f57cd132b31b233c65734de04939ce65sewardj                             binop(Iop_Shl64,
18930de80192f57cd132b31b233c65734de04939ce65sewardj                                   getIReg(ra), mkU8(2)),
18940de80192f57cd132b31b233c65734de04939ce65sewardj                             getIReg(rb)))));
18950de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
18960de80192f57cd132b31b233c65734de04939ce65sewardj
18970de80192f57cd132b31b233c65734de04939ce65sewardj      break;
18980de80192f57cd132b31b233c65734de04939ce65sewardj    case 194:   /* "shl3add" */
18990de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
19000de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64,
19010de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_Shl64,
19020de80192f57cd132b31b233c65734de04939ce65sewardj                             getIReg(ra), mkU8(3)),
19030de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(rb)));
19040de80192f57cd132b31b233c65734de04939ce65sewardj
19050de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
19060de80192f57cd132b31b233c65734de04939ce65sewardj      break;
19070de80192f57cd132b31b233c65734de04939ce65sewardj    case 195:   /* "shl3addx" */
19080de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
19090de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,
19100de80192f57cd132b31b233c65734de04939ce65sewardj             unop(Iop_32Sto64,
19110de80192f57cd132b31b233c65734de04939ce65sewardj                  unop(Iop_64to32,
19120de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_Add64,
19130de80192f57cd132b31b233c65734de04939ce65sewardj                             binop(Iop_Shl64,
19140de80192f57cd132b31b233c65734de04939ce65sewardj                                   getIReg(ra), mkU8(3)),
19150de80192f57cd132b31b233c65734de04939ce65sewardj                             getIReg(rb)))));
19160de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
19170de80192f57cd132b31b233c65734de04939ce65sewardj      break;
19180de80192f57cd132b31b233c65734de04939ce65sewardj    case 196:   /* "shli" */
19190de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
19200de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Shl64, getIReg(ra),
19210de80192f57cd132b31b233c65734de04939ce65sewardj                       mkU8(imm)));
19220de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
19230de80192f57cd132b31b233c65734de04939ce65sewardj      break;
19240de80192f57cd132b31b233c65734de04939ce65sewardj    case 197:   /* "shlx" */
19250de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
19260de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, unop(Iop_32Sto64,
19270de80192f57cd132b31b233c65734de04939ce65sewardj                      binop(Iop_Shl32,
19280de80192f57cd132b31b233c65734de04939ce65sewardj                            narrowTo(Ity_I32, getIReg(ra)),
19290de80192f57cd132b31b233c65734de04939ce65sewardj                            narrowTo(Ity_I8, getIReg(rb)))));
19300de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
19310de80192f57cd132b31b233c65734de04939ce65sewardj      break;
19320de80192f57cd132b31b233c65734de04939ce65sewardj    case 198:   /* "shlxi" */
19330de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
19340de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, signExtend(binop(Iop_Shl32,
19350de80192f57cd132b31b233c65734de04939ce65sewardj                                  narrowTo(Ity_I32, getIReg(ra)),
19360de80192f57cd132b31b233c65734de04939ce65sewardj                                  mkU8(imm)),
19370de80192f57cd132b31b233c65734de04939ce65sewardj                            32));
19380de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
19390de80192f57cd132b31b233c65734de04939ce65sewardj      break;
19400de80192f57cd132b31b233c65734de04939ce65sewardj    case 199:  /* "shrs" */
19410de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
19420de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Sar64, getIReg(ra),
19430de80192f57cd132b31b233c65734de04939ce65sewardj                       narrowTo(Ity_I8, getIReg(rb))));
19440de80192f57cd132b31b233c65734de04939ce65sewardj
19450de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
19460de80192f57cd132b31b233c65734de04939ce65sewardj      break;
19470de80192f57cd132b31b233c65734de04939ce65sewardj    case 200:  /* "shrsi" */
19480de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
19490de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Sar64, getIReg(ra),
19500de80192f57cd132b31b233c65734de04939ce65sewardj                       mkU8(imm)));
19510de80192f57cd132b31b233c65734de04939ce65sewardj
19520de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
19530de80192f57cd132b31b233c65734de04939ce65sewardj      break;
19540de80192f57cd132b31b233c65734de04939ce65sewardj    case 201:  /* "shru" */
19550de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
19560de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Shr64,
19570de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(ra),
19580de80192f57cd132b31b233c65734de04939ce65sewardj                       narrowTo(Ity_I8, (getIReg(rb)))));
19590de80192f57cd132b31b233c65734de04939ce65sewardj
19600de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
19610de80192f57cd132b31b233c65734de04939ce65sewardj      break;
19620de80192f57cd132b31b233c65734de04939ce65sewardj    case 202:  /* "shrui" */
19630de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
19640de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Shr64, getIReg(ra), mkU8(imm)));
19650de80192f57cd132b31b233c65734de04939ce65sewardj
19660de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
19670de80192f57cd132b31b233c65734de04939ce65sewardj      break;
19680de80192f57cd132b31b233c65734de04939ce65sewardj    case 203:  /* "shrux" */
19690de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
19700de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, unop(Iop_32Sto64,
19710de80192f57cd132b31b233c65734de04939ce65sewardj                      (binop(Iop_Shr32,
19720de80192f57cd132b31b233c65734de04939ce65sewardj                             narrowTo(Ity_I32, getIReg(ra)),
19730de80192f57cd132b31b233c65734de04939ce65sewardj                             narrowTo(Ity_I8, getIReg(rb))))));
19740de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
19750de80192f57cd132b31b233c65734de04939ce65sewardj      break;
19760de80192f57cd132b31b233c65734de04939ce65sewardj    case 204:  /* "shruxi" */
19770de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
19780de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, unop(Iop_32Sto64,
19790de80192f57cd132b31b233c65734de04939ce65sewardj                      (binop(Iop_Shr32,
19800de80192f57cd132b31b233c65734de04939ce65sewardj                             narrowTo(Ity_I32, getIReg(ra)),
19810de80192f57cd132b31b233c65734de04939ce65sewardj                             mkU8(imm)))));
19820de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
19830de80192f57cd132b31b233c65734de04939ce65sewardj      break;
19840de80192f57cd132b31b233c65734de04939ce65sewardj    case 205:  /* "shufflebytes" */
19850de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
19860de80192f57cd132b31b233c65734de04939ce65sewardj      break;
19870de80192f57cd132b31b233c65734de04939ce65sewardj    case 206:  /* "st" */
19880de80192f57cd132b31b233c65734de04939ce65sewardj      store(getIReg(ra),  getIReg(rb));
19890de80192f57cd132b31b233c65734de04939ce65sewardj      break;
19900de80192f57cd132b31b233c65734de04939ce65sewardj    case 207:  /* "st1" */
19910de80192f57cd132b31b233c65734de04939ce65sewardj      store(getIReg(ra),  narrowTo(Ity_I8, getIReg(rb)));
19920de80192f57cd132b31b233c65734de04939ce65sewardj      break;
19930de80192f57cd132b31b233c65734de04939ce65sewardj    case 208:  /* "st1_add" */
19940de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
19950de80192f57cd132b31b233c65734de04939ce65sewardj      store(getIReg(opd[0]),  narrowTo(Ity_I8, getIReg(opd[1])));
19960de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64, getIReg(opd[0]), mkU64(opd[2])));
19970de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(opd[0], t2);
19980de80192f57cd132b31b233c65734de04939ce65sewardj      break;
19990de80192f57cd132b31b233c65734de04939ce65sewardj    case 209:  /* "st2" */
20000de80192f57cd132b31b233c65734de04939ce65sewardj      store(getIReg(ra),  narrowTo(Ity_I16, getIReg(rb)));
20010de80192f57cd132b31b233c65734de04939ce65sewardj      break;
20020de80192f57cd132b31b233c65734de04939ce65sewardj    case 210:  /* "st2_add" */
20030de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
20040de80192f57cd132b31b233c65734de04939ce65sewardj      store(getIReg(opd[0]),  narrowTo(Ity_I16, getIReg(opd[1])));
20050de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64, getIReg(opd[0]), mkU64(opd[2])));
20060de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(opd[0], t2);
20070de80192f57cd132b31b233c65734de04939ce65sewardj      break;
20080de80192f57cd132b31b233c65734de04939ce65sewardj    case 211:  /* "st4" */
20090de80192f57cd132b31b233c65734de04939ce65sewardj      store(getIReg(ra),  narrowTo(Ity_I32, getIReg(rb)));
20100de80192f57cd132b31b233c65734de04939ce65sewardj      break;
20110de80192f57cd132b31b233c65734de04939ce65sewardj    case 212:  /* "st4_add" */
20120de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
20130de80192f57cd132b31b233c65734de04939ce65sewardj      store(getIReg(opd[0]),  narrowTo(Ity_I32, getIReg(opd[1])));
20140de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64, getIReg(opd[0]), mkU64(opd[2])));
20150de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(opd[0], t2);
20160de80192f57cd132b31b233c65734de04939ce65sewardj      break;
20170de80192f57cd132b31b233c65734de04939ce65sewardj    case 213:  /* "st_add" */
20180de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
20190de80192f57cd132b31b233c65734de04939ce65sewardj      store(getIReg(opd[0]),  getIReg(opd[1]));
20200de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64, getIReg(opd[0]), mkU64(opd[2])));
20210de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(opd[0], t2);
20220de80192f57cd132b31b233c65734de04939ce65sewardj      break;
20230de80192f57cd132b31b233c65734de04939ce65sewardj    case 214:  /* "stnt" */
20240de80192f57cd132b31b233c65734de04939ce65sewardj      store(getIReg(ra),  getIReg(rb));
20250de80192f57cd132b31b233c65734de04939ce65sewardj      break;
20260de80192f57cd132b31b233c65734de04939ce65sewardj    case 215:  /* "stnt1" */
20270de80192f57cd132b31b233c65734de04939ce65sewardj      store(getIReg(ra),  narrowTo(Ity_I8, getIReg(rb)));
20280de80192f57cd132b31b233c65734de04939ce65sewardj      break;
20290de80192f57cd132b31b233c65734de04939ce65sewardj    case 216:  /* "stnt1_add" */
20300de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
20310de80192f57cd132b31b233c65734de04939ce65sewardj      store(getIReg(opd[0]),  narrowTo(Ity_I8, getIReg(opd[1])));
20320de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64, getIReg(opd[0]), mkU64(opd[2])));
20330de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(opd[0], t2);
20340de80192f57cd132b31b233c65734de04939ce65sewardj      break;
20350de80192f57cd132b31b233c65734de04939ce65sewardj    case 217:  /* "stnt2" */
20360de80192f57cd132b31b233c65734de04939ce65sewardj      store(getIReg(ra),  narrowTo(Ity_I16, getIReg(rb)));
20370de80192f57cd132b31b233c65734de04939ce65sewardj      break;
20380de80192f57cd132b31b233c65734de04939ce65sewardj    case 218:  /* "stnt2_add" */
20390de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
20400de80192f57cd132b31b233c65734de04939ce65sewardj      store(getIReg(opd[0]),  narrowTo(Ity_I16, getIReg(opd[1])));
20410de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64, getIReg(opd[0]), mkU64(opd[2])));
20420de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(opd[0], t2);
20430de80192f57cd132b31b233c65734de04939ce65sewardj      break;
20440de80192f57cd132b31b233c65734de04939ce65sewardj    case 219:  /* "stnt4" */
20450de80192f57cd132b31b233c65734de04939ce65sewardj      store(getIReg(ra),  narrowTo(Ity_I32, getIReg(rb)));
20460de80192f57cd132b31b233c65734de04939ce65sewardj      break;
20470de80192f57cd132b31b233c65734de04939ce65sewardj    case 220:  /* "stnt4_add" */
20480de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
20490de80192f57cd132b31b233c65734de04939ce65sewardj      store(getIReg(opd[0]),  narrowTo(Ity_I32, getIReg(opd[1])));
20500de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64, getIReg(opd[0]), mkU64(opd[2])));
20510de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(opd[0], t2);
20520de80192f57cd132b31b233c65734de04939ce65sewardj      break;
20530de80192f57cd132b31b233c65734de04939ce65sewardj    case 221:  /* "stnt_add" */
20540de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
20550de80192f57cd132b31b233c65734de04939ce65sewardj      store(getIReg(opd[0]),  getIReg(opd[1]));
20560de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Add64, getIReg(opd[0]), mkU64(opd[2])));
20570de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(opd[0], t2);
20580de80192f57cd132b31b233c65734de04939ce65sewardj      break;
20590de80192f57cd132b31b233c65734de04939ce65sewardj    case 222:  /* "sub" */
20600de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
20610de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Sub64, getIReg(ra),
20620de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(rb)));
20630de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
20640de80192f57cd132b31b233c65734de04939ce65sewardj      break;
20650de80192f57cd132b31b233c65734de04939ce65sewardj    case 223:  /* "subx" */
20660de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
20670de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2,  unop(Iop_32Sto64,
20680de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_Sub32,
20690de80192f57cd132b31b233c65734de04939ce65sewardj                             narrowTo(Ity_I32, getIReg(ra)),
20700de80192f57cd132b31b233c65734de04939ce65sewardj                             narrowTo(Ity_I32, getIReg(rb)))));
20710de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
20720de80192f57cd132b31b233c65734de04939ce65sewardj      break;
20730de80192f57cd132b31b233c65734de04939ce65sewardj    case 224:  /* "subxsc" */
20740de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
20750de80192f57cd132b31b233c65734de04939ce65sewardj      break;
20760de80192f57cd132b31b233c65734de04939ce65sewardj    case 225:  /* "swint0" */
20770de80192f57cd132b31b233c65734de04939ce65sewardj      vex_printf( "\n *** swint0 ***\n");
20780de80192f57cd132b31b233c65734de04939ce65sewardj      vassert(0);
20790de80192f57cd132b31b233c65734de04939ce65sewardj      break;
20800de80192f57cd132b31b233c65734de04939ce65sewardj    case 226:  /* "swint1" */
20810de80192f57cd132b31b233c65734de04939ce65sewardj      next = mkU64(guest_PC_curr_instr + 8);
20820de80192f57cd132b31b233c65734de04939ce65sewardj      jumpkind = Ijk_Sys_syscall;
20830de80192f57cd132b31b233c65734de04939ce65sewardj      break;
20840de80192f57cd132b31b233c65734de04939ce65sewardj    case 227:  /* "swint2" */
20850de80192f57cd132b31b233c65734de04939ce65sewardj      vex_printf( "\n *** swint2 ***\n");
20860de80192f57cd132b31b233c65734de04939ce65sewardj      vassert(0);
20870de80192f57cd132b31b233c65734de04939ce65sewardj      break;
20880de80192f57cd132b31b233c65734de04939ce65sewardj    case 228:  /* "swint3" */
20890de80192f57cd132b31b233c65734de04939ce65sewardj      vex_printf( "\n *** swint3 ***\n");
20900de80192f57cd132b31b233c65734de04939ce65sewardj      vassert(0);
20910de80192f57cd132b31b233c65734de04939ce65sewardj      break;
20920de80192f57cd132b31b233c65734de04939ce65sewardj    case 229:
20930de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
20940de80192f57cd132b31b233c65734de04939ce65sewardj    case 230:
20950de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
20960de80192f57cd132b31b233c65734de04939ce65sewardj    case 231:
20970de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
20980de80192f57cd132b31b233c65734de04939ce65sewardj    case 232:
20990de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21000de80192f57cd132b31b233c65734de04939ce65sewardj    case 233:
210132de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
210232de7768a661c2dcd5e13dba881ad020161073abzliu      break;
21030de80192f57cd132b31b233c65734de04939ce65sewardj    case 234:
210432de7768a661c2dcd5e13dba881ad020161073abzliu      opd[3] = V1EXP(opd[3]);
210532de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
210632de7768a661c2dcd5e13dba881ad020161073abzliu      break;
21070de80192f57cd132b31b233c65734de04939ce65sewardj    case 235:
21080de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21090de80192f57cd132b31b233c65734de04939ce65sewardj    case 236:
21100de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21110de80192f57cd132b31b233c65734de04939ce65sewardj    case 237:
21120de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
21130de80192f57cd132b31b233c65734de04939ce65sewardj      break;
21140de80192f57cd132b31b233c65734de04939ce65sewardj    case 238:  /* "v1cmpeq" */
21150de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
21160de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_CmpEQ8x8, getIReg(ra),
21170de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(rb)));
21180de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
21190de80192f57cd132b31b233c65734de04939ce65sewardj      break;
21200de80192f57cd132b31b233c65734de04939ce65sewardj    case 239:  /* "v1cmpeqi" */
21210de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
21220de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_CmpEQ8x8, getIReg(ra),
21230de80192f57cd132b31b233c65734de04939ce65sewardj                       mkU64(imm)));
21240de80192f57cd132b31b233c65734de04939ce65sewardj
21250de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
21260de80192f57cd132b31b233c65734de04939ce65sewardj      break;
21270de80192f57cd132b31b233c65734de04939ce65sewardj    case 240:
21280de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21290de80192f57cd132b31b233c65734de04939ce65sewardj    case 241:
21300de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21310de80192f57cd132b31b233c65734de04939ce65sewardj    case 242:
213232de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
213332de7768a661c2dcd5e13dba881ad020161073abzliu      break;
21340de80192f57cd132b31b233c65734de04939ce65sewardj    case 243:
213532de7768a661c2dcd5e13dba881ad020161073abzliu      opd[3] = V1EXP(opd[3]);
213632de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
213732de7768a661c2dcd5e13dba881ad020161073abzliu      break;
21380de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21390de80192f57cd132b31b233c65734de04939ce65sewardj    case 244:
214032de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
214132de7768a661c2dcd5e13dba881ad020161073abzliu      break;
21420de80192f57cd132b31b233c65734de04939ce65sewardj    case 245:
214332de7768a661c2dcd5e13dba881ad020161073abzliu      opd[3] = V1EXP(opd[3]);
21440de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
21450de80192f57cd132b31b233c65734de04939ce65sewardj      break;
21460de80192f57cd132b31b233c65734de04939ce65sewardj    case 246:  /* "v1cmpne" */
21470de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
21480de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_CmpEQ8x8,
21490de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_CmpEQ8x8, getIReg(ra),
21500de80192f57cd132b31b233c65734de04939ce65sewardj                             getIReg(rb)),
21510de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(63)));
21520de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
21530de80192f57cd132b31b233c65734de04939ce65sewardj      break;
21540de80192f57cd132b31b233c65734de04939ce65sewardj    case 247:
21550de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21560de80192f57cd132b31b233c65734de04939ce65sewardj    case 248:
21570de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21580de80192f57cd132b31b233c65734de04939ce65sewardj    case 249:
21590de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21600de80192f57cd132b31b233c65734de04939ce65sewardj    case 250:
21610de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21620de80192f57cd132b31b233c65734de04939ce65sewardj    case 251:
21630de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21640de80192f57cd132b31b233c65734de04939ce65sewardj    case 252:
21650de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21660de80192f57cd132b31b233c65734de04939ce65sewardj    case 253:
21670de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21680de80192f57cd132b31b233c65734de04939ce65sewardj    case 254:
21690de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21700de80192f57cd132b31b233c65734de04939ce65sewardj    case 255:
21710de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21720de80192f57cd132b31b233c65734de04939ce65sewardj    case 256:
21730de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21740de80192f57cd132b31b233c65734de04939ce65sewardj    case 257:
21750de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21760de80192f57cd132b31b233c65734de04939ce65sewardj    case 258:
21770de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21780de80192f57cd132b31b233c65734de04939ce65sewardj    case 259:
217932de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
218032de7768a661c2dcd5e13dba881ad020161073abzliu      break;
21810de80192f57cd132b31b233c65734de04939ce65sewardj    case 260:
218232de7768a661c2dcd5e13dba881ad020161073abzliu      opd[3] = V1EXP(opd[3]);
218332de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
218432de7768a661c2dcd5e13dba881ad020161073abzliu      break;
21850de80192f57cd132b31b233c65734de04939ce65sewardj    case 261:
218632de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
218732de7768a661c2dcd5e13dba881ad020161073abzliu      break;
21880de80192f57cd132b31b233c65734de04939ce65sewardj    case 262:
218932de7768a661c2dcd5e13dba881ad020161073abzliu      opd[3] = V1EXP(opd[3]);
219032de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
219132de7768a661c2dcd5e13dba881ad020161073abzliu      break;
21920de80192f57cd132b31b233c65734de04939ce65sewardj    case 263:
21930de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21940de80192f57cd132b31b233c65734de04939ce65sewardj    case 264:
21950de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21960de80192f57cd132b31b233c65734de04939ce65sewardj    case 265:
21970de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
21980de80192f57cd132b31b233c65734de04939ce65sewardj    case 266:
21990de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
22000de80192f57cd132b31b233c65734de04939ce65sewardj    case 267:
22010de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
22020de80192f57cd132b31b233c65734de04939ce65sewardj    case 268:
22030de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
22040de80192f57cd132b31b233c65734de04939ce65sewardj    case 269:
22050de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
22060de80192f57cd132b31b233c65734de04939ce65sewardj    case 270:
220732de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
220832de7768a661c2dcd5e13dba881ad020161073abzliu      break;
22090de80192f57cd132b31b233c65734de04939ce65sewardj    case 271:
221032de7768a661c2dcd5e13dba881ad020161073abzliu      opd[3] = V1EXP(opd[3]);
221132de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
221232de7768a661c2dcd5e13dba881ad020161073abzliu      break;
22130de80192f57cd132b31b233c65734de04939ce65sewardj    case 272:
221432de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
221532de7768a661c2dcd5e13dba881ad020161073abzliu      break;
22160de80192f57cd132b31b233c65734de04939ce65sewardj    case 273:
221732de7768a661c2dcd5e13dba881ad020161073abzliu      opd[3] = V1EXP(opd[3]);
221832de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
221932de7768a661c2dcd5e13dba881ad020161073abzliu      break;
22200de80192f57cd132b31b233c65734de04939ce65sewardj    case 274:
22210de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
22220de80192f57cd132b31b233c65734de04939ce65sewardj      break;
22230de80192f57cd132b31b233c65734de04939ce65sewardj    case 275:  /* "v1shrui" */
22240de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
22250de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Shr8x8,
22260de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(ra),
22270de80192f57cd132b31b233c65734de04939ce65sewardj                       mkU64(imm)));
22280de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
22290de80192f57cd132b31b233c65734de04939ce65sewardj      break;
22300de80192f57cd132b31b233c65734de04939ce65sewardj    case 276:
22310de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
22320de80192f57cd132b31b233c65734de04939ce65sewardj    case 277:
22330de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
22340de80192f57cd132b31b233c65734de04939ce65sewardj    case 278:
223532de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
223632de7768a661c2dcd5e13dba881ad020161073abzliu      break;
22370de80192f57cd132b31b233c65734de04939ce65sewardj    case 279:
223832de7768a661c2dcd5e13dba881ad020161073abzliu      opd[3] = V2EXP(opd[3]);
223932de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
224032de7768a661c2dcd5e13dba881ad020161073abzliu      break;
22410de80192f57cd132b31b233c65734de04939ce65sewardj    case 280:
22420de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
22430de80192f57cd132b31b233c65734de04939ce65sewardj    case 281:
22440de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
22450de80192f57cd132b31b233c65734de04939ce65sewardj    case 282:
22460de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
22470de80192f57cd132b31b233c65734de04939ce65sewardj    case 283:
224832de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
224932de7768a661c2dcd5e13dba881ad020161073abzliu      break;
22500de80192f57cd132b31b233c65734de04939ce65sewardj    case 284:
225132de7768a661c2dcd5e13dba881ad020161073abzliu      opd[3] = V2EXP(opd[3]);
225232de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
225332de7768a661c2dcd5e13dba881ad020161073abzliu      break;
22540de80192f57cd132b31b233c65734de04939ce65sewardj    case 285:
22550de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
22560de80192f57cd132b31b233c65734de04939ce65sewardj    case 286:
22570de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
22580de80192f57cd132b31b233c65734de04939ce65sewardj    case 287:
225932de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
226032de7768a661c2dcd5e13dba881ad020161073abzliu      break;
22610de80192f57cd132b31b233c65734de04939ce65sewardj    case 288:
226232de7768a661c2dcd5e13dba881ad020161073abzliu      opd[3] = V2EXP(opd[3]);
226332de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
226432de7768a661c2dcd5e13dba881ad020161073abzliu      break;
22650de80192f57cd132b31b233c65734de04939ce65sewardj    case 289:
226632de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
226732de7768a661c2dcd5e13dba881ad020161073abzliu      break;
22680de80192f57cd132b31b233c65734de04939ce65sewardj    case 290:
226932de7768a661c2dcd5e13dba881ad020161073abzliu      opd[3] = V2EXP(opd[3]);
227032de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
227132de7768a661c2dcd5e13dba881ad020161073abzliu      break;
22720de80192f57cd132b31b233c65734de04939ce65sewardj    case 291:
22730de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
22740de80192f57cd132b31b233c65734de04939ce65sewardj    case 292:
22750de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
22760de80192f57cd132b31b233c65734de04939ce65sewardj    case 293:
22770de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
22780de80192f57cd132b31b233c65734de04939ce65sewardj    case 294:
22790de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
22800de80192f57cd132b31b233c65734de04939ce65sewardj    case 295:
22810de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
22820de80192f57cd132b31b233c65734de04939ce65sewardj    case 296:
228332de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
228432de7768a661c2dcd5e13dba881ad020161073abzliu      break;
22850de80192f57cd132b31b233c65734de04939ce65sewardj    case 297:
228632de7768a661c2dcd5e13dba881ad020161073abzliu      opd[3] = V2EXP(opd[3]);
228732de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
228832de7768a661c2dcd5e13dba881ad020161073abzliu      break;
22890de80192f57cd132b31b233c65734de04939ce65sewardj    case 298:
229032de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
229132de7768a661c2dcd5e13dba881ad020161073abzliu      break;
22920de80192f57cd132b31b233c65734de04939ce65sewardj    case 299:
229332de7768a661c2dcd5e13dba881ad020161073abzliu      opd[3] = V2EXP(opd[3]);
229432de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
229532de7768a661c2dcd5e13dba881ad020161073abzliu      break;
22960de80192f57cd132b31b233c65734de04939ce65sewardj    case 300:
22970de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
22980de80192f57cd132b31b233c65734de04939ce65sewardj    case 301:
22990de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23000de80192f57cd132b31b233c65734de04939ce65sewardj    case 302:
23010de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23020de80192f57cd132b31b233c65734de04939ce65sewardj    case 303:
23030de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23040de80192f57cd132b31b233c65734de04939ce65sewardj    case 304:
23050de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23060de80192f57cd132b31b233c65734de04939ce65sewardj    case 305:
23070de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23080de80192f57cd132b31b233c65734de04939ce65sewardj    case 306:
23090de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23100de80192f57cd132b31b233c65734de04939ce65sewardj    case 307:
23110de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23120de80192f57cd132b31b233c65734de04939ce65sewardj    case 308:
23130de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23140de80192f57cd132b31b233c65734de04939ce65sewardj    case 309:
23150de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23160de80192f57cd132b31b233c65734de04939ce65sewardj    case 310:
23170de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23180de80192f57cd132b31b233c65734de04939ce65sewardj    case 311:
23190de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23200de80192f57cd132b31b233c65734de04939ce65sewardj    case 312:
232132de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
232232de7768a661c2dcd5e13dba881ad020161073abzliu      break;
23230de80192f57cd132b31b233c65734de04939ce65sewardj    case 313:
232432de7768a661c2dcd5e13dba881ad020161073abzliu      opd[3] = V2EXP(opd[3]);
232532de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
232632de7768a661c2dcd5e13dba881ad020161073abzliu      break;
23270de80192f57cd132b31b233c65734de04939ce65sewardj    case 314:
23280de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23290de80192f57cd132b31b233c65734de04939ce65sewardj    case 315:
233032de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
233132de7768a661c2dcd5e13dba881ad020161073abzliu      break;
23320de80192f57cd132b31b233c65734de04939ce65sewardj    case 316:
233332de7768a661c2dcd5e13dba881ad020161073abzliu      opd[3] = V2EXP(opd[3]);
233432de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
233532de7768a661c2dcd5e13dba881ad020161073abzliu      break;
23360de80192f57cd132b31b233c65734de04939ce65sewardj    case 317:
233732de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
233832de7768a661c2dcd5e13dba881ad020161073abzliu      break;
23390de80192f57cd132b31b233c65734de04939ce65sewardj    case 318:
234032de7768a661c2dcd5e13dba881ad020161073abzliu      opd[3] = V2EXP(opd[3]);
234132de7768a661c2dcd5e13dba881ad020161073abzliu      use_dirty_helper = 1;
234232de7768a661c2dcd5e13dba881ad020161073abzliu      break;
23430de80192f57cd132b31b233c65734de04939ce65sewardj    case 319:
23440de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23450de80192f57cd132b31b233c65734de04939ce65sewardj    case 320:
23460de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23470de80192f57cd132b31b233c65734de04939ce65sewardj    case 321:
23480de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23490de80192f57cd132b31b233c65734de04939ce65sewardj    case 322:
23500de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23510de80192f57cd132b31b233c65734de04939ce65sewardj    case 323:
23520de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
23530de80192f57cd132b31b233c65734de04939ce65sewardj      break;
23540de80192f57cd132b31b233c65734de04939ce65sewardj    case 324:   /* "v4int_l" */
23550de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
23560de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Or64,
23570de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_Shl64,
23580de80192f57cd132b31b233c65734de04939ce65sewardj                             getIReg(ra),
23590de80192f57cd132b31b233c65734de04939ce65sewardj                             mkU8(32)),
23600de80192f57cd132b31b233c65734de04939ce65sewardj                       binop(Iop_And64,
23610de80192f57cd132b31b233c65734de04939ce65sewardj                             getIReg(rb),
23620de80192f57cd132b31b233c65734de04939ce65sewardj                             mkU64(0xFFFFFFFF))));
23630de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
23640de80192f57cd132b31b233c65734de04939ce65sewardj      break;
23650de80192f57cd132b31b233c65734de04939ce65sewardj    case 325:
23660de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23670de80192f57cd132b31b233c65734de04939ce65sewardj    case 326:
23680de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23690de80192f57cd132b31b233c65734de04939ce65sewardj    case 327:
23700de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23710de80192f57cd132b31b233c65734de04939ce65sewardj    case 328:
23720de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23730de80192f57cd132b31b233c65734de04939ce65sewardj    case 329:
23740de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23750de80192f57cd132b31b233c65734de04939ce65sewardj    case 330:
23760de80192f57cd132b31b233c65734de04939ce65sewardj      /* Fall-through */
23770de80192f57cd132b31b233c65734de04939ce65sewardj    case 331:
23780de80192f57cd132b31b233c65734de04939ce65sewardj      use_dirty_helper = 1;
23790de80192f57cd132b31b233c65734de04939ce65sewardj      break;
23800de80192f57cd132b31b233c65734de04939ce65sewardj    case 332:   /* "wh64" */     /* Ignore store hint */
23810de80192f57cd132b31b233c65734de04939ce65sewardj      break;
23820de80192f57cd132b31b233c65734de04939ce65sewardj    case 333:   /* "xor" */
23830de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
23840de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Xor64,
23850de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(ra),
23860de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(rb)));
23870de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
23880de80192f57cd132b31b233c65734de04939ce65sewardj      break;
23890de80192f57cd132b31b233c65734de04939ce65sewardj    case 334:   /* "xori" */
23900de80192f57cd132b31b233c65734de04939ce65sewardj      t2 = newTemp(Ity_I64);
23910de80192f57cd132b31b233c65734de04939ce65sewardj      assign(t2, binop(Iop_Xor64,
23920de80192f57cd132b31b233c65734de04939ce65sewardj                       getIReg(ra),
23930de80192f57cd132b31b233c65734de04939ce65sewardj                       mkU64(imm)));
23940de80192f57cd132b31b233c65734de04939ce65sewardj      MARK_REG_WB(rd, t2);
23950de80192f57cd132b31b233c65734de04939ce65sewardj      break;
23960de80192f57cd132b31b233c65734de04939ce65sewardj    case 335:  /* "(null)" */   /* ignore */
23970de80192f57cd132b31b233c65734de04939ce65sewardj      break;
23980de80192f57cd132b31b233c65734de04939ce65sewardj    default:
23990de80192f57cd132b31b233c65734de04939ce65sewardj
24000de80192f57cd132b31b233c65734de04939ce65sewardj    decode_failure:
24010de80192f57cd132b31b233c65734de04939ce65sewardj      vex_printf("error: %d\n",  (Int)opcode);
24020de80192f57cd132b31b233c65734de04939ce65sewardj
24030de80192f57cd132b31b233c65734de04939ce65sewardj      /* All decode failures end up here. */
24040de80192f57cd132b31b233c65734de04939ce65sewardj      vex_printf("vex tilegx->IR: unhandled instruction: "
24050de80192f57cd132b31b233c65734de04939ce65sewardj                 "%s 0x%llx 0x%llx 0x%llx 0x%llx\n",
24060de80192f57cd132b31b233c65734de04939ce65sewardj                 decoded[n].opcode->name,
24070de80192f57cd132b31b233c65734de04939ce65sewardj                 opd[0], opd[1], opd[2], opd[3]);
24080de80192f57cd132b31b233c65734de04939ce65sewardj
24090de80192f57cd132b31b233c65734de04939ce65sewardj      /* Tell the dispatcher that this insn cannot be decoded, and so has
24100de80192f57cd132b31b233c65734de04939ce65sewardj         not been executed, and (is currently) the next to be executed. */
24110de80192f57cd132b31b233c65734de04939ce65sewardj      stmt(IRStmt_Put(offsetof(VexGuestTILEGXState, guest_pc),
24120de80192f57cd132b31b233c65734de04939ce65sewardj                      mkU64(guest_PC_curr_instr)));
24130de80192f57cd132b31b233c65734de04939ce65sewardj      dres.whatNext = Dis_StopHere;
24140de80192f57cd132b31b233c65734de04939ce65sewardj      dres.len = 0;
24150de80192f57cd132b31b233c65734de04939ce65sewardj      return dres;
24160de80192f57cd132b31b233c65734de04939ce65sewardj    }
24170de80192f57cd132b31b233c65734de04939ce65sewardj
24180de80192f57cd132b31b233c65734de04939ce65sewardj    /* Hook the dirty helper for rare instruxtions. */
24190de80192f57cd132b31b233c65734de04939ce65sewardj    if (use_dirty_helper)
24200de80192f57cd132b31b233c65734de04939ce65sewardj    {
24210de80192f57cd132b31b233c65734de04939ce65sewardj      Int i = 0;
24220de80192f57cd132b31b233c65734de04939ce65sewardj      Int wbc = 0;
24230de80192f57cd132b31b233c65734de04939ce65sewardj      IRExpr *opc_oprand[5];
24240de80192f57cd132b31b233c65734de04939ce65sewardj
24250de80192f57cd132b31b233c65734de04939ce65sewardj      opc_oprand[0] = mkU64(opcode);
24260de80192f57cd132b31b233c65734de04939ce65sewardj
24270de80192f57cd132b31b233c65734de04939ce65sewardj      /* Get the operand registers or immediate. */
24280de80192f57cd132b31b233c65734de04939ce65sewardj      for (i = 0 ; i < 4; i++)
24290de80192f57cd132b31b233c65734de04939ce65sewardj      {
24300de80192f57cd132b31b233c65734de04939ce65sewardj        opc_oprand[i + 1] = NULL;
24310de80192f57cd132b31b233c65734de04939ce65sewardj
24320de80192f57cd132b31b233c65734de04939ce65sewardj        if (opd_dst_map & (1ULL << i))
24330de80192f57cd132b31b233c65734de04939ce65sewardj        {
24340de80192f57cd132b31b233c65734de04939ce65sewardj          tb[wbc] = newTemp(Ity_I64);
24350de80192f57cd132b31b233c65734de04939ce65sewardj          wbc++;
24360de80192f57cd132b31b233c65734de04939ce65sewardj          opc_oprand[i + 1] = getIReg(opd[i]);
24370de80192f57cd132b31b233c65734de04939ce65sewardj        }
24380de80192f57cd132b31b233c65734de04939ce65sewardj        else if (opd_imm_map & (1ULL << i))
24390de80192f57cd132b31b233c65734de04939ce65sewardj          opc_oprand[i + 1] = mkU64(opd[i]);
24400de80192f57cd132b31b233c65734de04939ce65sewardj        else if (opd_src_map & (1ULL << i))
24410de80192f57cd132b31b233c65734de04939ce65sewardj          opc_oprand[i + 1] = getIReg(opd[i]);
24420de80192f57cd132b31b233c65734de04939ce65sewardj        else
24430de80192f57cd132b31b233c65734de04939ce65sewardj          opc_oprand[i + 1] = mkU64(0xfeee);
24440de80192f57cd132b31b233c65734de04939ce65sewardj      }
24450de80192f57cd132b31b233c65734de04939ce65sewardj
24460de80192f57cd132b31b233c65734de04939ce65sewardj      IRExpr **args = mkIRExprVec_5(opc_oprand[0], opc_oprand[1],
24470de80192f57cd132b31b233c65734de04939ce65sewardj                                    opc_oprand[2], opc_oprand[3],
24480de80192f57cd132b31b233c65734de04939ce65sewardj                                    opc_oprand[4]);
24490de80192f57cd132b31b233c65734de04939ce65sewardj      IRDirty *genIR = NULL;
24500de80192f57cd132b31b233c65734de04939ce65sewardj
24510de80192f57cd132b31b233c65734de04939ce65sewardj      switch (wbc) {
24520de80192f57cd132b31b233c65734de04939ce65sewardj      case 0:
24530de80192f57cd132b31b233c65734de04939ce65sewardj        {
24540de80192f57cd132b31b233c65734de04939ce65sewardj          genIR = unsafeIRDirty_0_N (0/*regparms*/,
24550de80192f57cd132b31b233c65734de04939ce65sewardj                                     "tilegx_dirtyhelper_gen",
24560de80192f57cd132b31b233c65734de04939ce65sewardj                                     &tilegx_dirtyhelper_gen,
24570de80192f57cd132b31b233c65734de04939ce65sewardj                                     args);
24580de80192f57cd132b31b233c65734de04939ce65sewardj        }
24590de80192f57cd132b31b233c65734de04939ce65sewardj        break;
24600de80192f57cd132b31b233c65734de04939ce65sewardj      case 1:
24610de80192f57cd132b31b233c65734de04939ce65sewardj        {
24620de80192f57cd132b31b233c65734de04939ce65sewardj          genIR = unsafeIRDirty_1_N (tb[0],
24630de80192f57cd132b31b233c65734de04939ce65sewardj                                     0/*regparms*/,
24640de80192f57cd132b31b233c65734de04939ce65sewardj                                     "tilegx_dirtyhelper_gen",
24650de80192f57cd132b31b233c65734de04939ce65sewardj                                     &tilegx_dirtyhelper_gen,
24660de80192f57cd132b31b233c65734de04939ce65sewardj                                     args);
24670de80192f57cd132b31b233c65734de04939ce65sewardj        }
24680de80192f57cd132b31b233c65734de04939ce65sewardj        break;
24690de80192f57cd132b31b233c65734de04939ce65sewardj      default:
24700de80192f57cd132b31b233c65734de04939ce65sewardj        vex_printf("opc = %d\n", (Int)opcode);
24710de80192f57cd132b31b233c65734de04939ce65sewardj        vassert(0);
24720de80192f57cd132b31b233c65734de04939ce65sewardj      }
24730de80192f57cd132b31b233c65734de04939ce65sewardj
24740de80192f57cd132b31b233c65734de04939ce65sewardj      stmt(IRStmt_Dirty(genIR));
24750de80192f57cd132b31b233c65734de04939ce65sewardj
24760de80192f57cd132b31b233c65734de04939ce65sewardj      wbc = 0;
24770de80192f57cd132b31b233c65734de04939ce65sewardj      for (i = 0 ; i < 4; i++)
24780de80192f57cd132b31b233c65734de04939ce65sewardj      {
24790de80192f57cd132b31b233c65734de04939ce65sewardj        if(opd_dst_map & (1 << i))
24800de80192f57cd132b31b233c65734de04939ce65sewardj        {
24810de80192f57cd132b31b233c65734de04939ce65sewardj          /* Queue the writeback destination registers. */
24820de80192f57cd132b31b233c65734de04939ce65sewardj          MARK_REG_WB(opd[i], tb[wbc]);
24830de80192f57cd132b31b233c65734de04939ce65sewardj          wbc++;
24840de80192f57cd132b31b233c65734de04939ce65sewardj        }
24850de80192f57cd132b31b233c65734de04939ce65sewardj      }
24860de80192f57cd132b31b233c65734de04939ce65sewardj    }
24870de80192f57cd132b31b233c65734de04939ce65sewardj  }
24880de80192f57cd132b31b233c65734de04939ce65sewardj
24890de80192f57cd132b31b233c65734de04939ce65sewardj  /* Write back registers for a bundle. Note have to get all source registers
24900de80192f57cd132b31b233c65734de04939ce65sewardj     for all instructions in a bundle before write the destinations b/c this is
24910de80192f57cd132b31b233c65734de04939ce65sewardj     an VLIW processor. */
24920de80192f57cd132b31b233c65734de04939ce65sewardj  for (n = 0; n < rd_wb_index; n++)
24930de80192f57cd132b31b233c65734de04939ce65sewardj    putIReg(rd_wb_reg[n], mkexpr(rd_wb_temp[n]));
24940de80192f57cd132b31b233c65734de04939ce65sewardj
24950de80192f57cd132b31b233c65734de04939ce65sewardj  /* Add branch IR if apply finally, only upto one branch per bundle. */
24960de80192f57cd132b31b233c65734de04939ce65sewardj  if (bstmt) {
24970de80192f57cd132b31b233c65734de04939ce65sewardj    stmt(bstmt);
24980de80192f57cd132b31b233c65734de04939ce65sewardj    dres.whatNext = Dis_StopHere;
24990de80192f57cd132b31b233c65734de04939ce65sewardj
25000de80192f57cd132b31b233c65734de04939ce65sewardj    dres.jk_StopHere = jumpkind;
25010de80192f57cd132b31b233c65734de04939ce65sewardj    stmt(IRStmt_Put(offsetof(VexGuestTILEGXState, guest_pc),
25020de80192f57cd132b31b233c65734de04939ce65sewardj                    mkU64(guest_PC_curr_instr + 8)));
25030de80192f57cd132b31b233c65734de04939ce65sewardj  } else if (next) {
25040de80192f57cd132b31b233c65734de04939ce65sewardj    if (steering_pc != -1ULL) {
25050de80192f57cd132b31b233c65734de04939ce65sewardj      if (resteerOkFn(callback_opaque, steering_pc)) {
25060de80192f57cd132b31b233c65734de04939ce65sewardj        dres.whatNext   = Dis_ResteerU;
25070de80192f57cd132b31b233c65734de04939ce65sewardj        dres.continueAt = steering_pc;
25080de80192f57cd132b31b233c65734de04939ce65sewardj        stmt(IRStmt_Put(offsetof(VexGuestTILEGXState, guest_pc),
25090de80192f57cd132b31b233c65734de04939ce65sewardj                        mkU64(steering_pc)));
25100de80192f57cd132b31b233c65734de04939ce65sewardj      } else {
25110de80192f57cd132b31b233c65734de04939ce65sewardj        dres.whatNext = Dis_StopHere;
25120de80192f57cd132b31b233c65734de04939ce65sewardj        dres.jk_StopHere = jumpkind;
25130de80192f57cd132b31b233c65734de04939ce65sewardj        stmt(IRStmt_Put(offsetof(VexGuestTILEGXState, guest_pc),
25140de80192f57cd132b31b233c65734de04939ce65sewardj                        mkU64(steering_pc)));
25150de80192f57cd132b31b233c65734de04939ce65sewardj      }
25160de80192f57cd132b31b233c65734de04939ce65sewardj    } else {
25170de80192f57cd132b31b233c65734de04939ce65sewardj      dres.whatNext = Dis_StopHere;
25180de80192f57cd132b31b233c65734de04939ce65sewardj      dres.jk_StopHere = jumpkind;
25190de80192f57cd132b31b233c65734de04939ce65sewardj      stmt(IRStmt_Put(offsetof(VexGuestTILEGXState, guest_pc), next));
25200de80192f57cd132b31b233c65734de04939ce65sewardj    }
25210de80192f57cd132b31b233c65734de04939ce65sewardj  } else {
25220de80192f57cd132b31b233c65734de04939ce65sewardj    /* As dafault dres.whatNext = Dis_Continue. */
25230de80192f57cd132b31b233c65734de04939ce65sewardj    stmt(IRStmt_Put(offsetof(VexGuestTILEGXState, guest_pc),
25240de80192f57cd132b31b233c65734de04939ce65sewardj                    mkU64(guest_PC_curr_instr + 8)));
25250de80192f57cd132b31b233c65734de04939ce65sewardj  }
25260de80192f57cd132b31b233c65734de04939ce65sewardj
25270de80192f57cd132b31b233c65734de04939ce65sewardj  irsb->jumpkind = Ijk_Boring;
25280de80192f57cd132b31b233c65734de04939ce65sewardj  irsb->next = NULL;
25290de80192f57cd132b31b233c65734de04939ce65sewardj  dres.len = 8;
25300de80192f57cd132b31b233c65734de04939ce65sewardj
25310de80192f57cd132b31b233c65734de04939ce65sewardj decode_success:
25320de80192f57cd132b31b233c65734de04939ce65sewardj
25330de80192f57cd132b31b233c65734de04939ce65sewardj  return dres;
25340de80192f57cd132b31b233c65734de04939ce65sewardj}
25350de80192f57cd132b31b233c65734de04939ce65sewardj
25360de80192f57cd132b31b233c65734de04939ce65sewardj/*------------------------------------------------------------*/
25370de80192f57cd132b31b233c65734de04939ce65sewardj/*--- Top-level fn                                         ---*/
25380de80192f57cd132b31b233c65734de04939ce65sewardj/*------------------------------------------------------------*/
25390de80192f57cd132b31b233c65734de04939ce65sewardj
25400de80192f57cd132b31b233c65734de04939ce65sewardj/* Disassemble a single instruction into IR.  The instruction
25410de80192f57cd132b31b233c65734de04939ce65sewardj   is located in host memory at &guest_code[delta]. */
25420de80192f57cd132b31b233c65734de04939ce65sewardj
25430de80192f57cd132b31b233c65734de04939ce65sewardjDisResult
25440de80192f57cd132b31b233c65734de04939ce65sewardjdisInstr_TILEGX ( IRSB* irsb_IN,
25450de80192f57cd132b31b233c65734de04939ce65sewardj                  Bool (*resteerOkFn) (void *, Addr),
25460de80192f57cd132b31b233c65734de04939ce65sewardj                  Bool resteerCisOk,
25470de80192f57cd132b31b233c65734de04939ce65sewardj                  void* callback_opaque,
25480de80192f57cd132b31b233c65734de04939ce65sewardj                  const UChar* guest_code_IN,
25490de80192f57cd132b31b233c65734de04939ce65sewardj                  Long delta,
25500de80192f57cd132b31b233c65734de04939ce65sewardj                  Addr guest_IP,
25510de80192f57cd132b31b233c65734de04939ce65sewardj                  VexArch guest_arch,
25520de80192f57cd132b31b233c65734de04939ce65sewardj                  const VexArchInfo* archinfo,
25530de80192f57cd132b31b233c65734de04939ce65sewardj                  const VexAbiInfo* abiinfo,
25540de80192f57cd132b31b233c65734de04939ce65sewardj                  VexEndness host_endness_IN,
25550de80192f57cd132b31b233c65734de04939ce65sewardj                  Bool sigill_diag_IN )
25560de80192f57cd132b31b233c65734de04939ce65sewardj{
25570de80192f57cd132b31b233c65734de04939ce65sewardj  DisResult dres;
25580de80192f57cd132b31b233c65734de04939ce65sewardj
25590de80192f57cd132b31b233c65734de04939ce65sewardj  /* Set globals (see top of this file) */
25600de80192f57cd132b31b233c65734de04939ce65sewardj  vassert(guest_arch == VexArchTILEGX);
25610de80192f57cd132b31b233c65734de04939ce65sewardj
25620de80192f57cd132b31b233c65734de04939ce65sewardj  guest_code = (UChar*)(Addr)guest_code_IN;
25630de80192f57cd132b31b233c65734de04939ce65sewardj  irsb = irsb_IN;
25640de80192f57cd132b31b233c65734de04939ce65sewardj  host_endness = host_endness_IN;
25650de80192f57cd132b31b233c65734de04939ce65sewardj  guest_PC_curr_instr = (Addr64) guest_IP;
25660de80192f57cd132b31b233c65734de04939ce65sewardj  guest_PC_bbstart = (Addr64) toUInt(guest_IP - delta);
25670de80192f57cd132b31b233c65734de04939ce65sewardj
25680de80192f57cd132b31b233c65734de04939ce65sewardj  dres = disInstr_TILEGX_WRK(resteerOkFn, resteerCisOk,
25690de80192f57cd132b31b233c65734de04939ce65sewardj                             callback_opaque,
25700de80192f57cd132b31b233c65734de04939ce65sewardj                             delta, archinfo, abiinfo, sigill_diag_IN);
257132bf4136270f100788bcad4edb7d47e1b43df254zliu
25720de80192f57cd132b31b233c65734de04939ce65sewardj  return dres;
25730de80192f57cd132b31b233c65734de04939ce65sewardj}
25740de80192f57cd132b31b233c65734de04939ce65sewardj
25750de80192f57cd132b31b233c65734de04939ce65sewardj/*--------------------------------------------------------------------*/
25760de80192f57cd132b31b233c65734de04939ce65sewardj/*--- end                                      guest_tilegx_toIR.c ---*/
25770de80192f57cd132b31b233c65734de04939ce65sewardj/*--------------------------------------------------------------------*/
2578