17 #ifndef CS_LLVM_TARGET_ARM_ARMADDRESSINGMODES_H
18 #define CS_LLVM_TARGET_ARM_ARMADDRESSINGMODES_H
20 #include "capstone/platform.h"
21 #include "../../MathExtras.h"
58 default:
return (
unsigned int)-1;
87 static inline unsigned rotr32(
unsigned Val,
unsigned Amt)
90 return (Val >> Amt) | (Val << ((32-Amt)&31));
95 static inline unsigned rotl32(
unsigned Val,
unsigned Amt)
98 return (Val << Amt) | (Val >> ((32-Amt)&31));
117 return ShOp | (Imm << 3);
141 return (Imm >> 8) * 2;
153 if ((Imm & ~255U) == 0)
return 0;
163 if ((
rotr32(Imm, RotAmt) & ~255U) == 0)
164 return (32-RotAmt)&31;
170 unsigned RotAmt2 = TZ2 & ~1;
171 if ((
rotr32(Imm, RotAmt2) & ~255U) == 0)
172 return (32-RotAmt2)&31;
178 return (32-RotAmt)&31;
189 if ((
Arg & ~255U) == 0)
return Arg;
198 return rotl32(
Arg, RotAmt) | ((RotAmt>>1) << 8);
240 if ((Imm & ~255U) == 0)
return 0;
261 if ((Imm & ~65535U) == 0)
return 0;
297 if ((
V & 0xffffff00) == 0)
301 Vs = ((
V & 0xff) == 0) ?
V >> 8 :
V;
305 u = Imm | (Imm << 16);
309 return (((Vs ==
V) ? 1 : 2) << 8) | Imm;
312 if (Vs == (u | (u << 8)))
313 return (3 << 8) | Imm;
329 if ((
rotr32(0xff000000U, RotAmt) &
V) ==
V)
330 return (
rotr32(
V, 24 - RotAmt) & 0x7f) | ((RotAmt + 8) << 7);
359 if ((
V & ~255U) == 0)
364 return (32 - RotAmt) & 31;
406 return Imm & 0xff00ff00U;
410 return Imm & 0x00ff00ffU;
447 return Imm12 | ((
int)isSub << 12) | (SO << 13) | (IdxMode << 16) ;
452 return AM2Opc & ((1 << 12)-1);
467 return (AM2Opc >> 16);
489 return ((
int)isSub << 8) |
Offset | (IdxMode << 9);
494 return AM3Opc & 0xFF;
504 return (AM3Opc >> 9);
547 return ((
int)isSub << 8) |
Offset;
551 return AM5Opc & 0xFF;
585 return (OpCmode << 8) | Val;
589 return (ModImm >> 8) & 0x1f;
593 return ModImm & 0xff;
606 if (OpCmode == 0xe) {
610 }
else if ((OpCmode & 0xc) == 0x8) {
612 ByteNum = (OpCmode & 0x6) >> 1;
613 Val = (
uint64_t)Imm8 << (8 * ByteNum);
615 }
else if ((OpCmode & 0x8) == 0) {
617 ByteNum = (OpCmode & 0x6) >> 1;
618 Val = (
uint64_t)Imm8 << (8 * ByteNum);
620 }
else if ((OpCmode & 0xe) == 0xc) {
622 ByteNum = 1 + (OpCmode & 0x1);
623 Val = (Imm8 << (8 * ByteNum)) | (0xffff >> (8 * (2 - ByteNum)));
625 }
else if (OpCmode == 0x1e) {
627 for (ByteNum = 0; ByteNum < 8; ++ByteNum) {
628 if ((ModImm >> ByteNum) & 1)
629 Val |= (
uint64_t)0xff << (8 * ByteNum);
651 uint8_t Sign = (Imm >> 7) & 0x1;
652 uint8_t Exp = (Imm >> 4) & 0x7;
661 FPUnion.I |= ((
uint32_t) Sign) << 31;
662 FPUnion.I |= ((Exp & 0x4) != 0 ? 0 : 1) << 30;
663 FPUnion.I |= ((Exp & 0x4) != 0 ? 0x1f : 0) << 25;
664 FPUnion.I |= (Exp & 0x3) << 23;
665 FPUnion.I |= Mantissa << 19;
static uint64_t ARM_AM_decodeNEONModImm(unsigned ModImm, unsigned *EltBits)
static unsigned getAM4ModeImm(ARM_AM_AMSubMode SubMode)
ARM_AM_AMSubMode getLoadStoreMultipleSubMode(int Opcode)
static unsigned getSORegOpc(ARM_AM_ShiftOpc ShOp, unsigned Imm)
static unsigned getAM2IdxMode(unsigned AM2Opc)
static unsigned getNEONModImmOpCmode(unsigned ModImm)
static unsigned ARM_AM_getAM5Opc(ARM_AM_AddrOpc Opc, unsigned char Offset)
getAM5Opc - This function encodes the addrmode5 opc field.
static int getT2SOImmValSplatVal(unsigned V)
static unsigned ARM_AM_getShiftOpcEncoding(ARM_AM_ShiftOpc Op)
static ARM_AM_ShiftOpc getAM2ShiftOpc(unsigned AM2Opc)
static bool isT2SOImmTwoPartVal(unsigned Imm)
static ARM_AM_AMSubMode getAM4SubMode(unsigned Mode)
static unsigned getSOImmValRot(unsigned Imm)
static unsigned char getAM3Offset(unsigned AM3Opc)
static unsigned getSOImmValImm(unsigned Imm)
static unsigned getAM3IdxMode(unsigned AM3Opc)
static unsigned getSOImmTwoPartSecond(unsigned V)
static bool isThumbImm16ShiftedVal(unsigned V)
static unsigned getThumbImm16ValShift(unsigned Imm)
static const char * ARM_AM_getAMSubModeStr(ARM_AM_AMSubMode Mode)
static unsigned getSORegOffset(unsigned Op)
static unsigned createNEONModImm(unsigned OpCmode, unsigned Val)
static ARM_AM_ShiftOpc ARM_AM_getSORegShOp(unsigned Op)
static unsigned ARM_AM_getAM2Opc(ARM_AM_AddrOpc Opc, unsigned Imm12, ARM_AM_ShiftOpc SO, unsigned IdxMode)
static int getT2SOImmValRotateVal(unsigned V)
static unsigned getNEONModImmVal(unsigned ModImm)
static unsigned getSOImmValRotate(unsigned Imm)
static const char * ARM_AM_getAddrOpcStr(ARM_AM_AddrOpc Op)
static unsigned getThumbImmValShift(unsigned Imm)
static unsigned getT2SOImmTwoPartSecond(unsigned Imm)
ARM_AM_ShiftOpc
ARM_AM - ARM Addressing Mode Stuff.
static unsigned rotr32(unsigned Val, unsigned Amt)
static const char * ARM_AM_getShiftOpcStr(ARM_AM_ShiftOpc Op)
static unsigned char ARM_AM_getAM5Offset(unsigned AM5Opc)
static unsigned getAM3Opc(ARM_AM_AddrOpc Opc, unsigned char Offset, unsigned IdxMode)
getAM3Opc - This function encodes the addrmode3 opc field.
static ARM_AM_AddrOpc getAM2Op(unsigned AM2Opc)
static ARM_AM_AddrOpc getAM3Op(unsigned AM3Opc)
static ARM_AM_AddrOpc ARM_AM_getAM5Op(unsigned AM5Opc)
static int getSOImmVal(unsigned Arg)
static unsigned getAM2Offset(unsigned AM2Opc)
static int getT2SOImmVal(unsigned Arg)
static unsigned getThumbImmNonShiftedVal(unsigned V)
static bool isSOImmTwoPartVal(unsigned V)
static unsigned getSOImmTwoPartFirst(unsigned V)
static unsigned getT2SOImmTwoPartFirst(unsigned Imm)
static unsigned rotl32(unsigned Val, unsigned Amt)
static float getFPImmFloat(unsigned Imm)
static bool isThumbImmShiftedVal(unsigned V)
static unsigned getT2SOImmValRotate(unsigned V)
#define V(handle, symbol)