Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changeset 621

Show
Ignore:
Timestamp:
08/21/10 08:36:24 (14 years ago)
Author:
walter
Message:

more 64, mostly inline assembler

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/dmd-1.x/src/backend/cod1.c

    r619 r621  
    11461146                c = cdisscaledindex(e11,&idxregs,keepmsk); 
    11471147                reg = findreg(idxregs); 
    11481148                pcs->Irm = modregrm(0,0,4); 
    11491149                pcs->Isib = modregrm(ss,reg & 7,5); 
    11501150                if (reg & 8) 
    11511151                    pcs->Irex |= REX_X; 
    11521152            } 
    11531153            else 
    11541154            { 
    11551155                c = scodelem(e11,&idxregs,keepmsk,TRUE); // load index reg 
    11561156                setaddrmode(pcs, idxregs); 
    11571157            } 
    11581158            goto Lptr; 
    11591159        } 
    11601160 
    11611161        /* Look for *(v1 + v2) 
    11621162         *      EA = [v1][v2] 
    11631163         */ 
    11641164 
    11651165        if (!I16 && e1isadd && (!e1->Ecount || !e1free) && 
    1166             tysize[e1ty] == REGSIZE
     1166            (tysize[e1ty] == REGSIZE || (I64 && tysize[e1ty] == 4))
    11671167        {   code *c2; 
    11681168            regm_t idxregs2; 
    11691169            unsigned base,index; 
    11701170            int ss; 
    11711171 
    11721172        L4: 
    11731173            // Look for *(v1 + v2 << scale) 
    11741174            ss = isscaledindex(e12); 
    11751175            if (ss) 
    11761176            { 
    11771177                c = scodelem(e11,&idxregs,keepmsk,TRUE); 
    11781178                idxregs2 = allregs & ~(idxregs | keepmsk); 
    11791179                c2 = cdisscaledindex(e12,&idxregs2,keepmsk | idxregs); 
    11801180            } 
    11811181 
    11821182            // Look for *(v1 << scale + v2) 
    11831183            else if ((ss = isscaledindex(e11)) != 0) 
    11841184            { 
    11851185                idxregs2 = idxregs; 
    11861186                c = cdisscaledindex(e11,&idxregs2,keepmsk); 
     
    35223522L3: 
    35233523    cssave(e,*pretregs,FALSE); 
    35243524    freenode(e); 
    35253525    return c; 
    35263526} 
    35273527 
    35283528 
    35293529/****************************** 
    35303530 * Generate code to load data into registers. 
    35313531 */ 
    35323532 
    35333533code *loaddata(elem *e,regm_t *pretregs) 
    35343534{ unsigned reg,nreg,op,sreg; 
    35353535  tym_t tym; 
    35363536  int sz; 
    35373537  code *c,*ce,cs; 
    35383538  regm_t flags,forregs,regm; 
    35393539 
    35403540#ifdef DEBUG 
    35413541  if (debugw) 
    3542         printf("loaddata(e = %p,*pretregs = x%x)\n",e,*pretregs); 
     3542        printf("loaddata(e = %p,*pretregs = %s)\n",e,regm_str(*pretregs)); 
    35433543  //elem_print(e); 
    35443544#endif 
    35453545  assert(e); 
    35463546  elem_debug(e); 
    35473547  if (*pretregs == 0) 
    35483548        return CNIL; 
    35493549  tym = tybasic(e->Ety); 
    35503550  if (tym == TYstruct) 
    35513551        return cdrelconst(e,pretregs); 
    35523552  if (tyfloating(tym)) 
    35533553  {     obj_fltused(); 
    35543554        if (config.inline8087) 
    35553555        {   if (*pretregs & mST0) 
    35563556                return load87(e,0,pretregs,NULL,-1); 
    35573557            else if (tycomplex(tym)) 
    35583558                return cload87(e, pretregs); 
    35593559        } 
    35603560  } 
    35613561  sz = tysize[tym]; 
    35623562  cs.Iflags = 0; 
  • branches/dmd-1.x/src/backend/ptrntab.c

    r619 r621  
    1515#include        <stdlib.h> 
    1616#include        <string.h> 
    1717#include        <time.h> 
    1818 
    1919#include        "cc.h" 
    2020#include        "code.h" 
    2121#include        "iasm.h" 
    2222 
    2323static char __file__[] = __FILE__;      /* for tassert.h                */ 
    2424#include        "tassert.h" 
    2525 
    2626// 
    2727// NOTE: For 0 operand instructions, the opcode is taken from 
    2828// the first entry and no subsequent entries are required. 
    2929// for instructions with operands, a NULL entry is required at the end 
    3030// as a terminator 
    3131// 
    3232// 0 Operand instructions 
    3333// 
    3434 
    35 PTRNTAB0 aptb0AAA[] = /* AAA */ { 
    36         { 0x37, _modax }, 
    37 }; 
    38  
    39 PTRNTAB0 aptb0AAD[] = /* AAD */ { 
    40         { 0xd50a, _modax } 
    41 }; 
    42  
    43 PTRNTAB0 aptb0AAM[] = /* AAM */ { 
    44         { 0xd40a, _modax } 
    45 }; 
    46 PTRNTAB0 aptb0AAS[] = /* AAS */ { 
    47         { 0x3f, _modax } 
    48 }; 
    49 PTRNTAB0 aptb0CBW[] = /* CBW */ { 
    50         { 0x98, _16_bit | _modax } 
    51 }; 
    52 PTRNTAB0 aptb0CWDE[] = /* CWDE */ { 
    53         { 0x98, _32_bit | _I386 | _modax } 
    54 }; 
    55 PTRNTAB0 aptb0CDQE[] = /* CDQE */ { 
    56         { 0x98, _64_bit | _modax } 
    57 }; 
    58 PTRNTAB0 aptb0CLC[] =  /* CLC */ { 
    59         { 0xf8, 0 } 
    60 }; 
    61  
    62 PTRNTAB0 aptb0CLD[] = /* CLD */ { 
    63         { 0xfc, 0 } 
    64 }; 
    65 PTRNTAB0 aptb0CLI[] =  /* CLI */ { 
    66         { 0xfa, 0 } 
    67 }; 
    68  
    69 PTRNTAB0 aptb0CLTS[] =  /* CLTS */ { 
    70         { 0x0f06, 0 } 
    71 }; 
    72  
    73 PTRNTAB0 aptb0CMC[] =  /* CMC */ { 
    74         { 0xf5, 0 } 
    75 }; 
    76  
    77 PTRNTAB0 aptb0CMPSB[] =  /* CMPSB */ { 
    78         { 0xa6, _modsidi } 
    79 }; 
    80  
    81 PTRNTAB0 aptb0CMPSW[] =  /* CMPSW */ { 
    82         { 0xa7, _16_bit | _modsidi } 
    83 }; 
    84  
    85 #if 0 
    86 PTRNTAB0 aptb0CMPSD[] =  /* CMPSD */ { 
    87         { 0xa7, _32_bit | _I386 | _modsidi } 
    88 }; 
    89 #endif 
    90  
    91 PTRNTAB0 aptb0CWD[] =  /* CWD */ { 
    92         { 0x99, _16_bit | _modaxdx } 
    93 }; 
    94  
    95 PTRNTAB0 aptb0CDQ[] =  /* CDQ */ { 
    96         { 0x99, _32_bit | _I386 | _modaxdx } 
    97 }; 
    98  
    99 PTRNTAB0 aptb0CQO[] =  /* CQO */ { 
    100         { 0x99, _64_bit | _modaxdx } 
    101 }; 
    102  
    103 PTRNTAB0 aptb0DAA[] =  /* DAA */ { 
    104         { 0x27, _modax } 
    105 }; 
    106  
    107 PTRNTAB0 aptb0DAS[] =  /* DAS */ { 
    108         { 0x2f, _modax } 
    109 }; 
    110  
    111 PTRNTAB0 aptb0HLT[] =  /* HLT */ { 
    112         { 0xf4, 0 } 
    113 }; 
    114  
    115 PTRNTAB0 aptb0INSB[] =  /* INSB */ { 
    116         { 0x6c,  _I386 | _modsi } 
    117 }; 
    118  
    119 PTRNTAB0 aptb0INSW[] =  /* INSW */ { 
    120         { 0x6d, _16_bit | _I386 | _modsi } 
    121 }; 
    122  
    123 PTRNTAB0 aptb0INSD[] =  /* INSD */ { 
    124         { 0x6d, _32_bit | _I386 | _modsi } 
    125 }; 
    126  
    127 PTRNTAB0 aptb0INTO[] =  /* INTO */ { 
    128         { 0xce, 0 } 
    129 }; 
    130 PTRNTAB0 aptb0INVD[] = /* INVD */ { 
    131         { 0x0f08, _I386 }               // Actually a 486 only instruction 
    132 }; 
    133 PTRNTAB0 aptb0IRET[] =  /* IRET */ { 
    134         { 0xcf, _16_bit } 
    135 }; 
    136  
    137 PTRNTAB0 aptb0IRETD[] =  /* IRETD */ { 
    138         { 0xcf, _32_bit | _I386 } 
    139 }; 
    140  
    141 PTRNTAB0 aptb0LAHF[] =  /* LAHF */ { 
    142         { 0x9f, _modax } 
    143 }; 
    144  
    145 PTRNTAB0 aptb0LEAVE[] =  /* LEAVE */ { 
    146         { 0xc9, _I386 } 
    147 }; 
    148  
    149 PTRNTAB0 aptb0LOCK[] =  /* LOCK */ { 
    150         { 0xf0, 0 } 
    151 }; 
    152  
    153 PTRNTAB0 aptb0LODSB[] =  /* LODSB */ { 
    154         { 0xac, _modsiax } 
    155 }; 
    156  
    157 PTRNTAB0 aptb0LODSW[] =  /* LODSW */ { 
    158         { 0xad, _16_bit | _modsiax } 
    159 }; 
    160  
    161 PTRNTAB0 aptb0LODSD[] =  /* LODSD */ { 
    162         { 0xad, _32_bit | _I386 | _modsiax  } 
    163 }; 
    164  
    165 PTRNTAB0 aptb0MOVSB[] =  /* MOVSB */ { 
    166         { 0xa4, _modsidi} 
    167 }; 
    168  
    169 PTRNTAB0 aptb0MOVSW[] =  /* MOVSW */ { 
    170         { 0xa5, _16_bit | _modsidi } 
    171 }; 
     35#define OPTABLE0(str,op,mod) PTRNTAB0 aptb0##str[] = { { op, mod }, }; 
     36 
     37OPTABLE0(AAA,     0x37,_modax); 
     38OPTABLE0(AAD,     0xd50a,_modax); 
     39OPTABLE0(AAM,     0xd40a,_modax); 
     40OPTABLE0(AAS,     0x3f,_modax); 
     41OPTABLE0(CBW,     0x98,_16_bit | _modax); 
     42OPTABLE0(CWDE,    0x98,_32_bit | _I386 | _modax); 
     43OPTABLE0(CDQE,    0x98,_64_bit | _modax); 
     44OPTABLE0(CLC,     0xf8,0); 
     45OPTABLE0(CLD,     0xfc,0); 
     46OPTABLE0(CLI,     0xfa,0); 
     47OPTABLE0(CLTS,    0x0f06,0); 
     48OPTABLE0(CMC,     0xf5,0); 
     49OPTABLE0(CMPSB,   0xa6,_modsidi); 
     50OPTABLE0(CMPSW,   0xa7,_16_bit | _modsidi); 
     51//OPTABLE0(CMPSD, 0xa7,_32_bit | _I386 | _modsidi); 
     52OPTABLE0(CMPSQ,   0xa7,_64_bit | _modsidi); 
     53OPTABLE0(CWD,     0x99, _16_bit | _modaxdx); 
     54OPTABLE0(CDQ,     0x99,_32_bit | _I386 | _modaxdx); 
     55OPTABLE0(CQO,     0x99, _64_bit | _modaxdx); 
     56OPTABLE0(DAA,     0x27,_modax); 
     57OPTABLE0(DAS,     0x2f,_modax); 
     58OPTABLE0(HLT,     0xf4,0); 
     59OPTABLE0(INSB,    0x6c,_I386 | _modsi); 
     60OPTABLE0(INSW,    0x6d,_16_bit | _I386 | _modsi); 
     61OPTABLE0(INSD,    0x6d,_32_bit | _I386 | _modsi); 
     62OPTABLE0(INTO,    0xce,0); 
     63OPTABLE0(INVD,    0x0f08,_I386);               // Actually a 486 only instruction 
     64OPTABLE0(IRET,    0xcf,_16_bit); 
     65OPTABLE0(IRETD,   0xcf,_32_bit | _I386); 
     66OPTABLE0(LAHF,    0x9f,_modax); 
     67OPTABLE0(LEAVE,   0xc9,_I386); 
     68OPTABLE0(LOCK,    0xf0,0); 
     69OPTABLE0(LODSB,   0xac,_modsiax); 
     70OPTABLE0(LODSW,   0xad,_16_bit | _modsiax); 
     71OPTABLE0(LODSD,   0xad,_32_bit | _I386 | _modsiax); 
     72OPTABLE0(LODSQ,   0xad,_64_bit | _modsiax); 
     73OPTABLE0(MOVSB,   0xa4, _modsidi); 
     74OPTABLE0(MOVSW,   0xa5, _16_bit | _modsidi); 
     75OPTABLE0(MOVSQ,   0xa5, _64_bit | _modsidi); 
     76OPTABLE0(NOP,     0x90, 0); 
     77OPTABLE0(OUTSB,   0x6e, _I386 | _modsi); 
     78OPTABLE0(OUTSW,   0x6f, _16_bit | _I386 | _modsi); 
     79OPTABLE0(OUTSD,   0x6f, _32_bit | _I386 | _modsi); 
     80OPTABLE0(POPA,    0x61, _16_bit | _I386 | _modall); 
     81OPTABLE0(POPAD,   0x61, _32_bit | _I386 | _modall); 
     82OPTABLE0(POPF,    0x9d, _16_bit); 
     83OPTABLE0(POPFD,   0x9d, _32_bit | _I386); 
     84OPTABLE0(PUSHA,   0x60, _16_bit | _I386); 
     85OPTABLE0(PUSHAD,  0x60, _32_bit | _I386); 
     86OPTABLE0(PUSHF,   0x9c, _16_bit); 
     87OPTABLE0(PUSHFD,  0x9c, _32_bit | _I386); 
     88OPTABLE0(REP,     0xf3, _modcx); 
     89OPTABLE0(REPNE,   0xf2, _modcx); 
     90OPTABLE0(SAHF,    0x9e, 0); 
     91OPTABLE0(SCASB,   0xAE, _moddi); 
     92OPTABLE0(SCASW,   0xAF, _16_bit | _moddi); 
     93OPTABLE0(SCASD,   0xAF, _32_bit | _I386 | _moddi); 
     94OPTABLE0(SCASQ,   0xAF, _64_bit | _moddi); 
     95OPTABLE0(STC,     0xf9, 0); 
     96OPTABLE0(STD,     0xfd, 0); 
     97OPTABLE0(STI,     0xfb, 0); 
     98OPTABLE0(STOSB,   0xaa, _moddi); 
     99OPTABLE0(STOSW,   0xAB, _16_bit | _moddi); 
     100OPTABLE0(STOSD,   0xAB, _32_bit | _I386 | _moddi); 
     101OPTABLE0(STOSQ,   0xAB, _64_bit | _moddi); 
     102OPTABLE0(WAIT,    0x9B, 0); 
     103OPTABLE0(WBINVD,  0x0f09, _I386);                        // Really a 486 opcode 
     104OPTABLE0(XLATB,   0xd7, _modax); 
     105OPTABLE0(CPUID,   0x0fa2, _I386 | _modall); 
     106OPTABLE0(RDMSR,   0x0f32, _I386 | _modaxdx); 
     107OPTABLE0(RDPMC,   0x0f33, _I386 | _modaxdx); 
     108OPTABLE0(RDTSC,   0x0f31, _I386 | _modaxdx); 
     109OPTABLE0(WRMSR,   0x0f30, _I386); 
     110OPTABLE0(RSM,     0x0faa,   _I386); 
    172111 
    173112PTRNTAB2 aptb2MOVSD[] =  /* MOVSD */ { 
    174113        { 0xa5, _32_bit | _I386 | _modsidi }, 
    175114        { 0xF20F10, _r, _xmm, _xmm_m64 }, 
    176115        { 0xF20F11, _r, _xmm_m64, _xmm }, 
    177116}; 
    178117 
    179 PTRNTAB0 aptb0NOP[] =  /* NOP */ { 
    180         { 0x90, 0 } 
    181 }; 
    182  
    183 PTRNTAB0 aptb0OUTSB[] =  /* OUTSB */ { 
    184         { 0x6e, _I386 | _modsi } 
    185 }; 
    186  
    187 PTRNTAB0 aptb0OUTSW[] =  /* OUTSW */ { 
    188         { 0x6f, _16_bit | _I386 | _modsi } 
    189 }; 
    190  
    191 PTRNTAB0 aptb0OUTSD[] =  /* OUTSD */ { 
    192         { 0x6f, _32_bit | _I386 | _modsi } 
    193 }; 
    194  
    195 PTRNTAB0 aptb0POPA[] =  /* POPA */ { 
    196         { 0x61, _16_bit | _I386 | _modall } 
    197 }; 
    198  
    199 PTRNTAB0 aptb0POPAD[] =  /* POPAD */ { 
    200         { 0x61, _32_bit | _I386 | _modall } 
    201 }; 
    202  
    203 PTRNTAB0 aptb0POPF[] =  /* POPF */ { 
    204         { 0x9d, _16_bit } 
    205 }; 
    206  
    207 PTRNTAB0 aptb0POPFD[] =  /* POPFD */ { 
    208         { 0x9d, _32_bit | _I386 } 
    209 }; 
    210  
    211 PTRNTAB0 aptb0PUSHA[] =  /* PUSHA */ { 
    212         { 0x60, _16_bit | _I386 } 
    213 }; 
    214  
    215 PTRNTAB0 aptb0PUSHAD[] =  /* PUSHAD */ { 
    216         { 0x60, _32_bit | _I386 } 
    217 }; 
    218  
    219 PTRNTAB0 aptb0PUSHF[]= /* PUSHF */ { 
    220         {0x9c, _16_bit } 
    221 }; 
    222  
    223 PTRNTAB0 aptb0PUSHFD[] =  /* PUSHFD */ { 
    224         { 0x9c, _32_bit | _I386 } 
    225 }; 
    226  
    227 PTRNTAB0 aptb0REP[] = /* REP */ { 
    228         { 0xf3, _modcx } 
    229 }; 
    230  
    231 PTRNTAB0 aptb0REPNE[] = /* REPNE */ { 
    232         { 0xf2, _modcx } 
    233 }; 
    234  
    235 PTRNTAB0 aptb0SAHF[] = /* SAHF */ { 
    236         { 0x9e, 0 } 
    237 }; 
    238  
    239 PTRNTAB0 aptb0SCASB[] = /* SCASB */ { 
    240         { 0xAE, _moddi } 
    241 }; 
    242  
    243 PTRNTAB0 aptb0SCASW[] = /* SCASW */ { 
    244         { 0xAF, _16_bit | _moddi} 
    245 }; 
    246  
    247 PTRNTAB0 aptb0SCASD[] = /* SCASD */ { 
    248         { 0xAF, _32_bit | _I386 | _moddi } 
    249 }; 
    250  
    251 PTRNTAB0 aptb0STC[] = /* STC */ { 
    252         { 0xf9, 0 } 
    253 }; 
    254  
    255 PTRNTAB0 aptb0STD[] = /* STD */ { 
    256         { 0xfd, 0 } 
    257 }; 
    258  
    259 PTRNTAB0 aptb0STI[] = /* STI */ { 
    260         { 0xfb, 0 } 
    261 }; 
    262 PTRNTAB0 aptb0STOSB[] = /* STOSB */ { 
    263         { 0xaa, _moddi } 
    264 }; 
    265  
    266 PTRNTAB0 aptb0STOSW[] = /* STOSW */ { 
    267         { 0xAB, _16_bit | _moddi } 
    268 }; 
    269  
    270 PTRNTAB0 aptb0STOSD[] = /* STOSD */ { 
    271         { 0xAB, _32_bit | _I386 | _moddi } 
    272 }; 
    273  
    274 PTRNTAB0 aptb0WAIT[] = /* WAIT */ { 
    275         { 0x9B, 0 } 
    276 }; 
    277 PTRNTAB0 aptb0WBINVD[] = /* WBINVD */ { 
    278         { 0xf09, _I386 }                        // Really a 486 opcode 
    279 }; 
    280 PTRNTAB0 aptb0XLATB[] = /* XLATB */ { 
    281         { 0xd7, _modax } 
    282 }; 
    283 PTRNTAB0 aptb0CPUID[] = { 
    284     { 0x0fa2, _I386 | _modall } 
    285 }; 
    286  
    287 PTRNTAB0 aptb0RDMSR[] = { 
    288     { 0x0f32, _I386 | _modaxdx } 
    289 }; 
    290  
    291 PTRNTAB0 aptb0RDPMC[] = { 
    292     { 0x0f33, _I386 | _modaxdx } 
    293 }; 
    294  
    295 PTRNTAB0 aptb0RDTSC[] = { 
    296     { 0x0f31, _I386 | _modaxdx } 
    297 }; 
    298  
    299 PTRNTAB0 aptb0WRMSR[] = { 
    300     { 0x0f30, _I386 } 
    301 }; 
    302  
    303 PTRNTAB0 aptb0RSM[] = { 
    304     { 0x0faa,   _I386 } 
    305 }; 
    306118// 
    307119// Now come the one operand instructions 
    308120// These will prove to be a little more challenging than the 0 
    309121// operand instructions 
    310122// 
    311123PTRNTAB1 aptb1BSWAP[] = /* BSWAP */ { 
    312124                                // Really is a 486 only instruction 
    313125        { 0x0fc8, _I386, _plus_r | _r32 }, 
    314126        { ASM_END, 0, 0 } 
    315127}; 
    316128 
    317129PTRNTAB1 aptb1CALL[] = /* CALL */ { 
    318130        { 0xe8, _cw | _modall , _rel16  }, 
    319131        { 0xff, _2 | _16_bit | _modall, _r16 }, 
    320132        { 0xff, _2 | _modall ,  _m16 }, 
    321133        { 0x9a, _cd | _modall , _p1616  }, 
    322134        { 0xff, _3 | _modall ,  _m1616  }, 
    323135        { 0xe8, _cd | _modall , _rel32  }, 
    324136        { 0xff, _2 | _32_bit | _modall ,        _r32  }, 
     137        { 0xff, _2 | _64_bit | _modall ,        _r64  }, 
    325138        { 0xff, _2 | _modall ,  _m32  }, 
     139        { 0xff, _2 | _64_bit | _modall ,  _m64  }, 
    326140        { 0x9a, _cp | _modall , _p1632 }, 
    327141        { 0xff, _3 | _modall ,  _m1632  }, 
    328142        { ASM_END, 0, 0 } 
    329143}; 
    330144 
    331145PTRNTAB1 aptb1DEC[] = /* DEC */ { 
    332146        { 0xfe, _1,             _rm8 }, 
    333147        { 0xff, _1 | _16_bit,           _m16 },         // Also _r16 synonym 
    334148        { 0xff, _1 | _32_bit,           _m32 },         // Also _r32 synonym 
     149        { 0xff, _1 | _64_bit,           _rm64 },        // Also _r64 synonym 
    335150        { 0x48, _rw | _16_bit,          _r16 | _plus_r }, 
    336151        { 0x48, _rw | _32_bit,          _r32 | _plus_r }, 
    337152        { ASM_END, 0, 0 } 
    338153}; 
    339154 
    340155PTRNTAB1 aptb1INC[] = /* INC */ { 
    341156        { 0xfe, _0,     _rm8 }, 
    342157        { 0xff, _0 | _16_bit,   _m16 },                 // Also _r16 synonym 
    343158        { 0xff, _0 | _32_bit,   _m32 },                 // Also _r32 synonym 
     159        { 0xff, _0 | _64_bit,   _rm64 },                // Also _r64 synonym 
    344160        { 0x40, _rw | _16_bit,_r16 | _plus_r }, 
    345161        { 0x40, _rd | _32_bit,_r32 | _plus_r }, 
    346162        { ASM_END, 0, 0 } 
    347163}; 
    348164// INT and INT 3 
    349165PTRNTAB1 aptb1INT[]= /* INT */ { 
    350166        { 0xcc, 3,              0 },    // The ulFlags here are meant to 
    351167                                        // be the value of the immediate 
    352168                                        // operand 
    353169        { 0xcd, 0,              _imm8 }, 
    354170        { ASM_END, 0, 0 } 
    355171}; 
    356172PTRNTAB1 aptb1INVLPG[] = /* INVLPG */ {         // 486 only instruction 
    357173        { 0x0f01,       _I386|_7, _m8 | _m16 | _m32 | _m48 }, 
    358174        { ASM_END, 0, 0 } 
    359175}; 
    360176 
    361 PTRNTAB1 aptb1JB[] = /* JB */ { 
    362         { 0x72, _cb,_rel8 }, 
    363         { 0x0f82,       _cw,_rel16 }, 
    364         { 0x0f82,       _cd,_rel32 }, 
    365         { ASM_END, 0, 0 } 
    366 }; 
    367 PTRNTAB1 aptb1JBE[] = /* JBE */ { 
    368         { 0x76, _cb,_rel8 }, 
    369         { 0x0f86,       _cw,_rel16 }, 
    370         { 0x0f86,       _cd,_rel32 }, 
    371         { ASM_END, 0, 0 } 
    372 }; 
     177#define OPTABLE(str,op) \ 
     178PTRNTAB1 aptb1##str[] = {               \ 
     179        { 0x70|op,   _cb,_rel8 },       \ 
     180        { 0x0f80|op, _cw,_rel16 },      \ 
     181        { 0x0f80|op, _cd,_rel32 },      \ 
     182        { ASM_END, 0, 0 }               \ 
     183
     184 
     185OPTABLE(JO,0); 
     186OPTABLE(JNO,1); 
     187OPTABLE(JB,2); 
     188OPTABLE(JNB,3); 
     189OPTABLE(JZ,4); 
     190OPTABLE(JNZ,5); 
     191OPTABLE(JBE,6); 
     192OPTABLE(JNBE,7); 
     193OPTABLE(JS,8); 
     194OPTABLE(JNS,9); 
     195OPTABLE(JP,0xA); 
     196OPTABLE(JNP,0xB); 
     197OPTABLE(JL,0xC); 
     198OPTABLE(JNL,0xD); 
     199OPTABLE(JLE,0xE); 
     200OPTABLE(JNLE,0xF); 
     201 
     202#undef OPTABLE 
     203 
    373204PTRNTAB1 aptb1JCXZ[] = /* JCXZ */ { 
    374205        { 0xe3, _cb | _16_bit_addr,_rel8 }, 
    375206        { ASM_END, 0, 0 } 
    376207}; 
    377208PTRNTAB1 aptb1JECXZ[] = /* JECXZ */ { 
    378209        { 0xe3, _cb | _32_bit_addr | _I386,_rel8 }, 
    379         { ASM_END, 0, 0 } 
    380 }; 
    381 PTRNTAB1 aptb1JZ[] = /* JZ */ { 
    382         { 0x74, _cb,_rel8 }, 
    383         { 0x0f84,       _cw,_rel16 }, 
    384         { 0x0f84,       _cd,_rel32 }, 
    385         { ASM_END, 0, 0 } 
    386 }; 
    387 PTRNTAB1 aptb1JL[] = /* JL */ { 
    388         { 0x7c, _cb,_rel8 }, 
    389         { 0x0f8c,       _cw,_rel16 }, 
    390         { 0x0f8c,       _cd,_rel32 }, 
    391         { ASM_END, 0, 0 } 
    392 }; 
    393 PTRNTAB1 aptb1JLE[] = /* JLE */ { 
    394         { 0x7e, _cb,_rel8 }, 
    395         { 0x0f8e,       _cw,_rel16 }, 
    396         { 0x0f8e,       _cd,_rel32 }, 
    397         { ASM_END, 0, 0 } 
    398 }; 
    399 PTRNTAB1 aptb1JNB[] = /* JNB */ { 
    400         { 0x73, _cb,_rel8 }, 
    401         { 0x0f83,       _cw,_rel16 }, 
    402         { 0x0f83,       _cd,_rel32 }, 
    403         { ASM_END, 0, 0 } 
    404 }; 
    405 PTRNTAB1 aptb1JNBE[] = /* JNBE */ { 
    406         { 0x77, _cb,_rel8 }, 
    407         { 0x0f87,       _cw,_rel16 }, 
    408         { 0x0f87,       _cd,_rel32 }, 
    409         { ASM_END, 0, 0 } 
    410 }; 
    411 PTRNTAB1 aptb1JNL[] = /* JNL */ { 
    412         { 0x7d, _cb,_rel8 }, 
    413         { 0x0f8d,       _cw,_rel16 }, 
    414         { 0x0f8d,       _cd,_rel32 }, 
    415         { ASM_END, 0, 0 } 
    416 }; 
    417 PTRNTAB1 aptb1JNLE[] = /* JNLE */ { 
    418         { 0x7f, _cb,_rel8 }, 
    419         { 0x0f8f,       _cw,_rel16 }, 
    420         { 0x0f8f,       _cd,_rel32 }, 
    421         { ASM_END, 0, 0 } 
    422 }; 
    423 PTRNTAB1 aptb1JNO[] = /* JNO */ { 
    424         { 0x71, _cb,_rel8 }, 
    425         { 0x0f81,       _cw,_rel16 }, 
    426         { 0x0f81,       _cd,_rel32 }, 
    427         { ASM_END, 0, 0 } 
    428 }; 
    429 PTRNTAB1 aptb1JNP[] = /* JNP */ { 
    430         { 0x7b, _cb,_rel8 }, 
    431         { 0x0f8b,       _cw,_rel16 }, 
    432         { 0x0f8b,       _cd,_rel32 }, 
    433         { ASM_END, 0, 0 } 
    434 }; 
    435 PTRNTAB1 aptb1JNS[] = /* JNS */ { 
    436         { 0x79, _cb,_rel8 }, 
    437         { 0x0f89,       _cw,_rel16 }, 
    438         { 0x0f89,       _cd,_rel32 }, 
    439         { ASM_END, 0, 0 } 
    440 }; 
    441 PTRNTAB1 aptb1JNZ[] = /* JNZ */ { 
    442         { 0x75, _cb,_rel8 }, 
    443         { 0x0f85,       _cw,_rel16 }, 
    444         { 0x0f85,       _cd,_rel32 }, 
    445         { ASM_END, 0, 0 } 
    446 }; 
    447 PTRNTAB1 aptb1JO[] = /* JO */ { 
    448         { 0x70, _cb,_rel8 }, 
    449         { 0x0f80,       _cw,_rel16 }, 
    450         { 0x0f80,       _cd,_rel32 }, 
    451         { ASM_END, 0, 0 } 
    452 }; 
    453 PTRNTAB1 aptb1JP[] = /* JP */ { 
    454         { 0x7a, _cb,_rel8 }, 
    455         { 0x0f8a,       _cw,_rel16 }, 
    456         { 0x0f8a,       _cd,_rel32 }, 
    457         { ASM_END, 0, 0 } 
    458 }; 
    459 PTRNTAB1 aptb1JS[] = /* JS */ { 
    460         { 0x78, _cb,_rel8 }, 
    461         { 0x0f88,       _cw,_rel16 }, 
    462         { 0x0f88,       _cd,_rel32 }, 
    463210        { ASM_END, 0, 0 } 
    464211}; 
    465212PTRNTAB1 aptb1JMP[] = /* JMP */ { 
    466213        { 0xe9, _cw,_rel16 }, 
    467214        { 0xe9, _cd,_rel32 }, 
    468215        { 0xeb, _cb,_rel8 }, 
    469216        { 0xff, _4 | _16_bit,   _rm16 }, 
    470217        { 0xea, _cd,_p1616 }, 
    471218        { 0xff, _5,     _m1616 }, 
    472219        { 0xff, _4 | _32_bit,   _rm32 }, 
    473220        { 0xea, _cp,_p1632 }, 
    474221        { 0xff, _5,     _m1632 }, 
    475222        { ASM_END, 0, 0 } 
    476223}; 
    477224PTRNTAB1 aptb1LGDT[] = /* LGDT */ { 
    478225        { 0x0f01,       _2,     _m48 }, 
    479226        { ASM_END, 0, 0 } 
    480227}; 
    481228PTRNTAB1 aptb1LIDT[] = /* LIDT */ { 
    482229        { 0x0f01,       _3,     _m48 }, 
    483230        { ASM_END, 0, 0 } 
    484231}; 
    485232PTRNTAB1 aptb1LLDT[] = /* LLDT */ { 
    486233        { 0x0f00,       _2|_modnot1,    _rm16 }, 
    487234        { ASM_END, 0, 0 } 
    488235}; 
    489236PTRNTAB1 aptb1LMSW[] = /* LMSW */ { 
    490237        { 0x0f01,       _6|_modnot1,    _rm16 }, 
    491238        { ASM_END, 0, 0 } 
    492239}; 
    493240PTRNTAB1 aptb1LODS[] = /* LODS */ { 
    494241        { 0xac, _modax,_m8 }, 
    495242        { 0xad, _16_bit | _modax,_m16 }, 
    496243        { 0xad, _32_bit | _I386 | _modax,_m32 }, 
    497244        { ASM_END, 0, 0 } 
    498245}; 
    499246PTRNTAB1 aptb1LOOP[] = /* LOOP */ { 
    500247        { 0xe2, _cb | _modcx,_rel8 }, 
    501248        { ASM_END, 0, 0 } 
    502249}; 
    503 PTRNTAB1 aptb1LOOPE[] = /* LOOPE */ { 
     250PTRNTAB1 aptb1LOOPE[] = /* LOOPE/LOOPZ */ { 
    504251        { 0xe1, _cb | _modcx,_rel8 }, 
    505252        { ASM_END, 0, 0 } 
    506253}; 
    507 PTRNTAB1 aptb1LOOPZ[] = /* LOOPZ */ { 
    508         { 0xe1, _cb | _modcx,_rel8 }, 
    509         { ASM_END, 0, 0 } 
    510 }; 
    511 PTRNTAB1 aptb1LOOPNE[] = /* LOOPNE */ { 
    512         { 0xe0, _cb | _modcx,_rel8 }, 
    513         { ASM_END, 0, 0 } 
    514 }; 
    515 PTRNTAB1 aptb1LOOPNZ[] = /* LOOPNZ */ { 
     254PTRNTAB1 aptb1LOOPNE[] = /* LOOPNE/LOOPNZ */ { 
    516255        { 0xe0, _cb | _modcx,_rel8 }, 
    517256        { ASM_END, 0, 0 } 
    518257}; 
    519258PTRNTAB1 aptb1LTR[] = /* LTR */ { 
    520259        { 0x0f00,       _3|_modnot1,    _rm16 }, 
    521260        { ASM_END, 0, 0 } 
    522261}; 
    523262PTRNTAB1 aptb1NEG[] = /* NEG */ { 
    524263        { 0xf6, _3,     _rm8 }, 
    525264        { 0xf7, _3 | _16_bit,   _rm16 }, 
    526265        { 0xf7, _3 | _32_bit,   _rm32 }, 
    527266        { 0xf7, _3 | _64_bit,   _rm64 }, 
    528267        { ASM_END, 0, 0 } 
    529268}; 
    530269PTRNTAB1 aptb1NOT[] = /* NOT */ { 
    531270        { 0xf6, _2,     _rm8 }, 
    532271        { 0xf7, _2 | _16_bit,   _rm16 }, 
    533272        { 0xf7, _2 | _32_bit,   _rm32 }, 
     273        { 0xf7, _2 | _64_bit,   _rm64 }, 
    534274        { ASM_END, 0, 0 } 
    535275}; 
    536276PTRNTAB1 aptb1POP[] = /* POP */ { 
    537277        { 0x8f, _0 | _16_bit, _m16 }, 
    538278        { 0x8f, _0 | _32_bit,   _m32}, 
    539279        { 0x58, _rw | _16_bit, _r16 | _plus_r }, 
    540280        { 0x58, _rd | _32_bit, _r32 | _plus_r }, 
    541281        { 0x58, _r | _64_bit,   _r64 | _plus_r }, 
    542282        { 0x1f, 0,      _ds | _seg }, 
    543283        { 0x07, _modes, _es | _seg}, 
    544284        { 0x17, 0,      _ss | _seg}, 
    545285        { 0x0fa1,       0,      _fs | _seg}, 
    546286        { 0x0fa9,       0,      _gs | _seg}, 
    547287        { ASM_END, 0, 0 } 
    548288}; 
    549289PTRNTAB1 aptb1PUSH[] = /* PUSH */ { 
    550290        { 0xff, _6 | _16_bit,   _m16 }, 
    551291        { 0xff, _6 | _32_bit,   _m32 }, 
    552292        { 0xff, _6 | _64_bit,   _m64 }, 
    553293        { 0x50, _r | _16_bit,   _r16 | _plus_r }, 
     
    566306        { 0x0fa8,       0,_gs | _seg}, 
    567307        { ASM_END, 0, 0 } 
    568308}; 
    569309PTRNTAB1 aptb1RET[] = /* RET */ { 
    570310        { 0xc3, 0,      0 }, 
    571311        { 0xc2, _iw,    _imm16 }, 
    572312        { ASM_END, 0, 0 } 
    573313}; 
    574314PTRNTAB1 aptb1RETF[] = /* RETF */ { 
    575315        { 0xcb, 0, 0 }, 
    576316        { 0xca, _iw, _imm16 }, 
    577317        { ASM_END, 0, 0 } 
    578318}; 
    579319PTRNTAB1 aptb1SCAS[] = /* SCAS */ { 
    580320        { 0xae, _moddi, _m8 }, 
    581321        { 0xaf, _16_bit | _moddi, _m16 }, 
    582322        { 0xaf, _32_bit | _moddi, _m32 }, 
    583323        { ASM_END, 0, 0 } 
    584324}; 
    585325 
    586 PTRNTAB1 aptb1SETB[] = /* SETB */ { 
    587         { 0xf92, _cb, _rm8 }, 
    588         { ASM_END, 0, 0 } 
    589 }; 
    590 PTRNTAB1  aptb1SETBE[] = /* SETBE */ { 
    591         { 0xf96, _cb, _rm8 }, 
    592         { ASM_END, 0, 0 } 
    593 }; 
    594 PTRNTAB1  aptb1SETL[] = /* SETL */ { 
    595         { 0xf9c, _cb, _rm8 }, 
    596         { ASM_END, 0, 0 } 
    597 }; 
    598 PTRNTAB1  aptb1SETLE[] = /* SETLE */ { 
    599         { 0xf9e, _cb, _rm8 }, 
    600         { ASM_END, 0, 0 } 
    601 }; 
    602 PTRNTAB1  aptb1SETNB[] = /* SETNB */ { 
    603         { 0xf93, _cb, _rm8 }, 
    604         { ASM_END, 0, 0 } 
    605 }; 
    606 PTRNTAB1  aptb1SETNBE[] = /* SETNBE */ { 
    607         { 0xf97, _cb, _rm8 }, 
    608         { ASM_END, 0, 0 } 
    609 }; 
    610 PTRNTAB1  aptb1SETNL[] = /* SETNL */ { 
    611         { 0xf9d, _cb, _rm8 }, 
    612         { ASM_END, 0, 0 } 
    613 }; 
    614 PTRNTAB1  aptb1SETNLE[] = /* SETNLE */ { 
    615         { 0xf9f, _cb, _rm8 }, 
    616         { ASM_END, 0, 0 } 
    617 }; 
    618 PTRNTAB1  aptb1SETNO[] = /* SETNO */ { 
    619         { 0xf91, _cb, _rm8 }, 
    620         { ASM_END, 0, 0 } 
    621 }; 
    622 PTRNTAB1  aptb1SETNP[] = /* SETNP */ { 
    623         { 0xf9b, _cb, _rm8 }, 
    624         { ASM_END, 0, 0 } 
    625 }; 
    626 PTRNTAB1  aptb1SETNS[] = /* SETNS */ { 
    627         { 0xf99, _cb, _rm8 }, 
    628         { ASM_END, 0, 0 } 
    629 }; 
    630 PTRNTAB1  aptb1SETNZ[] = /* SETNZ */ { 
    631         { 0xf95, _cb, _rm8 }, 
    632         { ASM_END, 0, 0 } 
    633 }; 
    634 PTRNTAB1  aptb1SETO[] = /* SETO */ { 
    635         { 0xf90, _cb, _rm8 }, 
    636         { ASM_END, 0, 0 } 
    637 }; 
    638 PTRNTAB1  aptb1SETP[] = /* SETP */ { 
    639         { 0xf9a, _cb, _rm8 }, 
    640         { ASM_END, 0, 0 } 
    641 }; 
    642 PTRNTAB1  aptb1SETS[] = /* SETS */ { 
    643         { 0xf98, _cb, _rm8 }, 
    644         { ASM_END, 0, 0 } 
    645 }; 
    646 PTRNTAB1  aptb1SETZ[] = /* SETZ */ { 
    647         { 0xf94, _cb, _rm8 }, 
    648         { ASM_END, 0, 0 } 
    649 }; 
     326#define OPTABLE(str,op) \ 
     327PTRNTAB1 aptb1##str[] = {       \ 
     328        { 0xf90|op, _cb, _rm8 },        \ 
     329        { ASM_END, 0, 0 }       \ 
     330
     331 
     332OPTABLE(SETO,0); 
     333OPTABLE(SETNO,1); 
     334OPTABLE(SETB,2); 
     335OPTABLE(SETNB,3); 
     336OPTABLE(SETZ,4); 
     337OPTABLE(SETNZ,5); 
     338OPTABLE(SETBE,6); 
     339OPTABLE(SETNBE,7); 
     340OPTABLE(SETS,8); 
     341OPTABLE(SETNS,9); 
     342OPTABLE(SETP,0xA); 
     343OPTABLE(SETNP,0xB); 
     344OPTABLE(SETL,0xC); 
     345OPTABLE(SETNL,0xD); 
     346OPTABLE(SETLE,0xE); 
     347OPTABLE(SETNLE,0xF); 
     348 
     349#undef OPTABLE 
     350 
    650351PTRNTAB1  aptb1SGDT[]= /* SGDT */ { 
    651352        { 0xf01, _0, _m48 }, 
    652353        { ASM_END, 0, 0 } 
    653354}; 
    654355PTRNTAB1  aptb1SIDT[] = /* SIDT */ { 
    655356        { 0xf01, _1, _m48 }, 
    656357        { ASM_END, 0, 0 } 
    657358}; 
    658359PTRNTAB1  aptb1SLDT[] = /* SLDT */ { 
    659360        { 0xf00, _0, _rm16 }, 
    660361        { ASM_END, 0, 0 } 
    661362}; 
    662363PTRNTAB1  aptb1SMSW[] = /* SMSW */ { 
    663364        { 0xf01, _4, _rm16 }, 
    664365        { 0xf01, _4, _r32 }, 
    665366        { ASM_END, 0, 0 } 
    666367}; 
    667368PTRNTAB1  aptb1STOS[] = /* STOS */ { 
    668369        { 0xaa, _moddi, _m8 }, 
    669370        { 0xab, _16_bit | _moddi, _m16 }, 
     
    674375        { 0xf00, _1, _rm16 }, 
    675376        { ASM_END, 0, 0 } 
    676377}; 
    677378PTRNTAB1  aptb1VERR[] = /* VERR */ { 
    678379        { 0xf00, _4|_modnot1, _rm16 }, 
    679380        { ASM_END, 0, 0 } 
    680381}; 
    681382PTRNTAB1  aptb1VERW[] = /* VERW */ { 
    682383        { 0xf00, _5|_modnot1, _rm16 }, 
    683384        { ASM_END, 0, 0 } 
    684385}; 
    685386PTRNTAB1  aptb1XLAT[] = /* XLAT */ { 
    686387        { 0xd7, _modax, 0 }, 
    687388        { 0xd7, _modax, _m8 }, 
    688389        { ASM_END, 0, 0 } 
    689390}; 
    690391PTRNTAB1  aptb1CMPXCH8B[] = { 
    691392    { 0x0fc7, _1 | _modaxdx | _I386 , _m64 }, 
    692393        { ASM_END, 0, 0 } 
    693394}; 
    694 PTRNTAB2  aptb2ADC[] = /* ADC */ { 
    695         { 0x14, _ib,                _al,                _imm8 }, 
    696         { 0x83, _2|_ib|_16_bit,     _rm16,      _imm8 }, 
    697         { 0x15, _iw|_16_bit,        _ax,                _imm16 }, 
    698         { 0x83, _2|_ib|_32_bit,     _rm32,  _imm8 }, 
    699         { 0x15, _id|_32_bit,        _eax,       _imm32 }, 
    700         { 0x80, _2|_ib,             _rm8,       _imm8 }, 
    701         { 0x81, _2|_iw|_16_bit,     _rm16,      _imm16 }, 
    702         { 0x81, _2|_id|_32_bit,     _rm32,  _imm32 }, 
    703         { 0x10, _r,                 _rm8,       _r8 }, 
    704         { 0x11, _r|_16_bit,         _rm16,      _r16 }, 
    705         { 0x11, _r|_32_bit,         _rm32,      _r32 }, 
    706         { 0x12, _r,                 _r8,        _rm8 }, 
    707         { 0x13, _r|_16_bit,         _r16,       _rm16 }, 
    708         { 0x13, _r|_32_bit,         _r32,       _rm32 }, 
    709         { ASM_END, 0, 0, 0 } 
    710 }; 
    711 PTRNTAB2  aptb2ADD[] = /* ADD */ { 
    712         { 0x04, _ib,            _al,    _imm8 }, 
    713         { 0x83, _0|_ib|_16_bit, _rm16,  _imm8 }, 
    714         { 0x05, _iw | _16_bit,  _ax,    _imm16 }, 
    715         { 0x83, _0|_ib|_32_bit, _rm32,  _imm8 }, 
    716         { 0x05, _id | _32_bit,  _eax,   _imm32 }, 
    717         { 0x80, _0|_ib,         _rm8,   _imm8 }, 
    718         { 0x81, _0|_iw|_16_bit, _rm16,  _imm16 }, 
    719         { 0x81, _0|_id|_32_bit, _rm32,  _imm32 }, 
    720         { 0x00, _r,             _rm8,   _r8 }, 
    721         { 0x01, _r|_16_bit,     _rm16,  _r16 }, 
    722         { 0x01, _r|_32_bit,     _rm32,  _r32 }, 
    723         { 0x2,  _r,             _r8,    _rm8 }, 
    724         { 0x3,  _r|_16_bit,     _r16,   _rm16 }, 
    725         { 0x3,  _r|_32_bit,     _r32,   _rm32 }, 
    726         { ASM_END, 0, 0, 0 } 
    727 }; 
    728  
    729 PTRNTAB2  aptb2AND[] = /* AND */ { 
    730         { 0x24, _ib,            _al,    _imm8 }, 
    731         { 0x83, _4|_ib|_16_bit, _rm16,  _imm8 }, 
    732         { 0x25, _iw|_16_bit,    _ax,    _imm16 }, 
    733         { 0x83, _4|_ib|_32_bit, _rm32,  _imm8 }, 
    734         { 0x25, _id|_32_bit,    _eax,   _imm32 }, 
    735         { 0x80, _4|_ib,         _rm8,   _imm8 }, 
    736         { 0x81, _4|_iw|_16_bit, _rm16,  _imm16 }, 
    737         { 0x81, _4|_id|_32_bit, _rm32,  _imm32 }, 
    738         { 0x20, _r,             _rm8,   _r8 }, 
    739         { 0x21, _r|_16_bit,     _rm16,  _r16 }, 
    740         { 0x21, _r|_32_bit,     _rm32,  _r32 }, 
    741         { 0x22, _r,             _r8,    _rm8 }, 
    742         { 0x23, _r|_16_bit,     _r16,   _rm16 }, 
    743         { 0x23, _r|_32_bit,     _r32,   _rm32 }, 
    744         { ASM_END, 0, 0, 0 } 
    745 }; 
     395 
     396#define OPTABLE(str,op,rr,m) \ 
     397PTRNTAB2  aptb2##str[] = {                                      \ 
     398        { op+4,  _ib|m,                _al,        _imm8 },     \ 
     399        { 0x83, rr|_ib|_16_bit|m,     _rm16,      _imm8 },      \ 
     400        { op+5, _iw|_16_bit|m,        _ax,        _imm16 },     \ 
     401        { 0x83, rr|_ib|_32_bit|m,     _rm32,      _imm8 },      \ 
     402        { 0x83, rr|_ib|_64_bit|m,     _rm64,      _imm8 },      \ 
     403        { op+5, _id|_32_bit|m,        _eax,       _imm32 },     \ 
     404        { op+5, _id|_64_bit|m,        _rax,       _imm32 },     \ 
     405        { 0x80, rr|_ib|m,             _rm8,       _imm8 },      \ 
     406        { 0x81, rr|_iw|_16_bit|m,     _rm16,      _imm16 },     \ 
     407        { 0x81, rr|_id|_32_bit|m,     _rm32,      _imm32 },     \ 
     408        { 0x81, rr|_id|_64_bit|m,     _rm64,      _imm32 },     \ 
     409        { op+0, _r|m,                 _rm8,       _r8 },        \ 
     410        { op+1, _r|_16_bit|m,         _rm16,      _r16 },       \ 
     411        { op+1, _r|_32_bit|m,         _rm32,      _r32 },       \ 
     412        { op+1, _r|_64_bit|m,         _rm64,      _r64 },       \ 
     413        { op+2, _r|m,                 _r8,        _rm8 },       \ 
     414        { op+3, _r|_16_bit|m,         _r16,       _rm16 },      \ 
     415        { op+3, _r|_32_bit|m,         _r32,       _rm32 },      \ 
     416        { op+3, _r|_64_bit|m,         _r64,       _rm64 },      \ 
     417        { ASM_END, 0, 0, 0 }                                    \ 
     418
     419 
     420OPTABLE(ADD,0x00,_0,0); 
     421OPTABLE(OR, 0x08,_1,0); 
     422OPTABLE(ADC,0x10,_2,0); 
     423OPTABLE(SBB,0x18,_3,0); 
     424OPTABLE(AND,0x20,_4,0); 
     425OPTABLE(SUB,0x28,_5,0); 
     426OPTABLE(XOR,0x30,_6,0); 
     427OPTABLE(CMP,0x38,_7,_modnot1); 
     428 
     429#undef OPTABLE 
     430 
    746431PTRNTAB2  aptb2ARPL[] = /* ARPL */ { 
    747432        { 0x63, _r,                     _rm16,  _r16 }, 
    748433        { ASM_END, 0, 0, 0 } 
    749434}; 
    750435PTRNTAB2  aptb2BOUND[] = /* BOUND */ { 
    751436        { 0x62, _r|_16_bit|_modnot1,_r16,_m16 },// Should really b3 _m16_16 
    752437        { 0x62, _r|_32_bit|_modnot1,_r32,_m32 },// Should really be _m32_32 
    753438        { ASM_END, 0, 0, 0 } 
    754439}; 
    755440PTRNTAB2  aptb2BSF[] = /* BSF */ { 
    756441        { 0x0fbc,       _cw | _16_bit,          _r16,   _rm16 }, 
    757442        { 0x0fbc,       _cd|_32_bit,            _r32,   _rm32 }, 
     443        { 0x0fbc,       _cd|_64_bit,            _r64,   _rm64 }, 
    758444        { ASM_END, 0, 0, 0 } 
    759445}; 
    760446PTRNTAB2  aptb2BSR[] = /* BSR */ { 
    761447        { 0x0fbd,       _cw|_16_bit,            _r16,   _rm16 }, 
    762448        { 0x0fbd,       _cd|_32_bit,            _r32,   _rm32 }, 
     449        { 0x0fbd,       _cd|_64_bit,            _r64,   _rm64 }, 
    763450        { ASM_END, 0, 0, 0 } 
    764451}; 
    765452PTRNTAB2  aptb2BT[] = /* BT */ { 
    766453        { 0x0fa3,       _cw|_16_bit|_modnot1,           _rm16,  _r16 }, 
    767454        { 0x0fa3,       _cd|_32_bit|_modnot1,           _rm32,  _r32 }, 
     455        { 0x0fa3,       _cd|_64_bit|_modnot1,           _rm64,  _r64 }, 
    768456        { 0x0fba,       _4|_ib|_16_bit|_modnot1,        _rm16,  _imm8 }, 
    769457        { 0x0fba,       _4|_ib|_32_bit|_modnot1,        _rm32,  _imm8 }, 
     458        { 0x0fba,       _4|_ib|_64_bit|_modnot1,        _rm64,  _imm8 }, 
    770459        { ASM_END, 0, 0, 0 } 
    771460}; 
    772461PTRNTAB2  aptb2BTC[] = /* BTC */ { 
    773462        { 0x0fbb,       _cw|_16_bit,            _rm16,  _r16 }, 
    774463        { 0x0fbb,       _cd|_32_bit,            _rm32,  _r32 }, 
     464        { 0x0fbb,       _cd|_64_bit,            _rm64,  _r64 }, 
    775465        { 0x0fba,       _7|_ib|_16_bit, _rm16,  _imm8 }, 
    776466        { 0x0fba,       _7|_ib|_32_bit, _rm32,  _imm8 }, 
     467        { 0x0fba,       _7|_ib|_64_bit, _rm64,  _imm8 }, 
    777468        { ASM_END, 0, 0, 0 } 
    778469}; 
    779470PTRNTAB2  aptb2BTR[] = /* BTR */ { 
    780471        { 0x0fb3,       _cw|_16_bit,            _rm16,  _r16 }, 
    781472        { 0x0fb3,       _cd|_32_bit,            _rm32,  _r32 }, 
     473        { 0x0fb3,       _cd|_64_bit,            _rm64,  _r64 }, 
    782474        { 0x0fba,       _6|_ib|_16_bit,         _rm16,  _imm8 }, 
    783475        { 0x0fba,       _6|_ib|_32_bit,         _rm32,  _imm8 }, 
     476        { 0x0fba,       _6|_ib|_64_bit,         _rm64,  _imm8 }, 
    784477        { ASM_END, 0, 0, 0 } 
    785478}; 
    786479PTRNTAB2  aptb2BTS[] = /* BTS */ { 
    787480        { 0x0fab,       _cw|_16_bit,            _rm16,  _r16 }, 
    788481        { 0x0fab,       _cd|_32_bit,            _rm32,  _r32 }, 
     482        { 0x0fab,       _cd|_64_bit,            _rm64,  _r64 }, 
    789483        { 0x0fba,       _5|_ib|_16_bit,         _rm16,  _imm8 }, 
    790484        { 0x0fba,       _5|_ib|_32_bit,         _rm32,  _imm8 }, 
    791         { ASM_END, 0, 0, 0 } 
    792 }; 
    793 PTRNTAB2  aptb2CMP[] = /* CMP */ { 
    794         { 0x3c, _ib|_modnot1,           _al,    _imm8 }, 
    795         { 0x83, _7|_ib|_16_bit|_modnot1,        _rm16,  _imm8 }, 
    796         { 0x3d, _iw|_16_bit|_modnot1,   _ax,    _imm16 }, 
    797         { 0x83, _7|_ib|_32_bit|_modnot1,        _rm32,  _imm8 }, 
    798         { 0x3d, _id|_32_bit|_modnot1,   _eax,   _imm32 }, 
    799         { 0x80, _7|_ib|_modnot1,                _rm8,   _imm8 }, 
    800         { 0x81, _7|_iw|_16_bit|_modnot1,        _rm16,  _imm16 }, 
    801         { 0x81, _7|_id|_32_bit|_modnot1,        _rm32,  _imm32 }, 
    802         { 0x38, _r|_modnot1,            _rm8,   _r8 }, 
    803         { 0x39, _r|_16_bit|_modnot1,    _rm16,  _r16 }, 
    804         { 0x39, _r|_32_bit|_modnot1,    _rm32,  _r32 }, 
    805         { 0x3a, _r|_modnot1,            _r8,    _rm8 }, 
    806         { 0x3b, _r|_16_bit|_modnot1,    _r16,   _rm16 }, 
    807         { 0x3b, _r|_32_bit|_modnot1,    _r32,   _rm32 }, 
     485        { 0x0fba,       _5|_ib|_64_bit,         _rm64,  _imm8 }, 
    808486        { ASM_END, 0, 0, 0 } 
    809487}; 
    810488PTRNTAB2  aptb2CMPS[] = /* CMPS */ { 
    811489        { 0xa6, _modsidi,               _m8,    _m8 }, 
    812490        { 0xa7, _modsidi,       _m16,   _m16 }, 
    813491        { 0xa7, _modsidi,       _m32,   _m32 }, 
    814492        { ASM_END, 0, 0, 0 } 
    815493}; 
    816494PTRNTAB2  aptb2CMPXCHG[] = /* CMPXCHG */ { 
    817495        { 0xfb0, _I386 | _cb|_mod2,     _rm8,   _r8 }, 
    818496                                                // This is really a 486 only 
    819497                                                // instruction 
    820498        { 0xfb1, _I386 | _cw | _16_bit|_mod2,   _rm16,  _r16 }, 
    821499        { 0xfb1, _I386 | _cd | _32_bit|_mod2,   _rm32,  _r32 }, 
    822500        { 0xfb1, _I386 | _cq | _64_bit|_mod2,   _rm64,  _r64 }, 
    823501        { ASM_END, 0, 0, 0 } 
    824502}; 
    825503PTRNTAB2  aptb2DIV[] = /* DIV */ { 
    826504        { 0xf6, _6,                             _al,            _rm8 }, 
    827505        { 0xf7, _6 | _16_bit | _moddx,          _ax,            _rm16 }, 
     
    913591        { 0xa0, 0,              _al,            _moffs8         }, 
    914592        { 0xa1, _16_bit,        _ax,            _moffs16        }, 
    915593        { 0xa1, _32_bit,        _eax,           _moffs32        }, 
    916594        { 0xa2, 0,              _moffs8,        _al             }, 
    917595        { 0xa3, _16_bit,        _moffs16,       _ax             }, 
    918596        { 0xa3, _32_bit,        _moffs32,       _eax            }, 
    919597#endif 
    920598        { 0x88, _r,             _rm8,           _r8             }, 
    921599        { 0x89, _r|_16_bit,     _rm16,          _r16            }, 
    922600        { 0x89, _r|_32_bit,     _rm32,          _r32            }, 
    923601        { 0x89, _r|_64_bit,     _rm64,          _r64            }, 
    924602        { 0x8a, _r,             _r8,            _rm8            }, 
    925603        { 0x8b, _r|_16_bit,     _r16,           _rm16           }, 
    926604        { 0x8b, _r|_32_bit,     _r32,           _rm32           }, 
    927605        { 0x8b, _r|_64_bit,     _r64,           _rm64           }, 
    928606        { 0x8c, _r,             _rm16,          _seg|_ds|_es| _ss | _fs | _gs | _cs }, 
    929607        { 0x8e, _r,             _seg|_ds|_es|_ss|_fs|_gs|_cs,   _rm16 }, 
    930608        { 0xb0, _rb,            _r8 | _plus_r,  _imm8           }, 
    931609        { 0xb8, _rw | _16_bit,  _r16 | _plus_r, _imm16          }, 
    932610        { 0xb8, _rd|_32_bit,    _r32 | _plus_r, _imm32          }, 
     611        { 0xb8, _rd|_64_bit,    _r64 | _plus_r, _imm32          }, 
    933612        { 0xc6, _cb,            _rm8,           _imm8           }, 
    934613        { 0xc7, _cw|_16_bit,    _rm16,          _imm16          }, 
    935614        { 0xc7, _cd|_32_bit,    _rm32,          _imm32          }, 
    936615#if 0 // Let pinholeopt() do this 
    937616        { 0xc6, _cb,            _moffs8,        _imm8           }, 
    938617        { 0xc7, _cw|_16_bit,    _moffs16,       _imm16          }, 
    939618        { 0xc7, _cd|_32_bit,    _moffs32,       _imm32          }, 
    940619#endif 
    941620        { 0x0f20,       _r,     _r32,           _special | _crn }, 
    942621        { 0x0f22,       _r,     _special|_crn,  _r32            }, 
    943622        { 0x0f21,       _r,     _r32,           _special | _drn }, 
    944623        { 0x0f23,       _r,     _special|_drn,  _r32            }, 
    945624        { 0x0f24,       _r,     _r32,           _special | _trn }, 
    946625        { 0x0f26,       _r,     _special|_trn,  _r32            }, 
    947626        { ASM_END, 0, 0, 0 } 
    948627}; 
    949628 
    950629PTRNTAB2  aptb2MOVS[] = { 
    951630        { 0xa4, _modsidi ,              _m8,    _m8 }, 
    952631        { 0xa5, _modsidi | _16_bit,     _m16,   _m16 }, 
     
    969648        { 0x0fb6,       _r|_32_bit,                     _r32,   _rm8 }, 
    970649#if 1 
    971650        { 0x0fb7,       _r|_16_bit,             _r16,   _rm16 }, 
    972651        { 0x0fb7,       _r|_32_bit,             _r32,   _rm16 }, 
    973652#else 
    974653        { 0x0fb7,       _r,                     _r32,   _rm16 }, 
    975654#endif 
    976655        { ASM_END, 0, 0, 0 } 
    977656}; 
    978657PTRNTAB2  aptb2MUL[] = /* MUL */ { 
    979658        { 0xf6, _4,                     _al,    _rm8 }, 
    980659        { 0xf7, _4|_16_bit|_moddx,      _ax,    _rm16 }, 
    981660        { 0xf7, _4|_32_bit|_moddx,      _eax,   _rm32 }, 
    982661        { 0xf7, _4|_64_bit|_moddx,      _rax,   _rm64 }, 
    983662        { 0xf6, _4|_modax,              _rm8,   0 }, 
    984663        { 0xf7, _4|_16_bit|_modaxdx,    _rm16,  0 }, 
    985664        { 0xf7, _4|_32_bit|_modaxdx,    _rm32,  0 }, 
    986665        { 0xf7, _4|_64_bit|_modaxdx,    _rm64,  0 }, 
    987666        { ASM_END, 0, 0, 0 } 
    988667}; 
    989 PTRNTAB2  aptb2OR[] = /* OR */ { 
    990         { 0x0c, _ib,            _al,    _imm8 }, 
    991         { 0x83, _1|_ib|_16_bit,         _rm16,  _imm8 }, 
    992         { 0x0d, _iw|_16_bit,            _ax,    _imm16 }, 
    993         { 0x83, _1|_ib|_32_bit,         _rm32,  _imm8 }, 
    994         { 0x0d, _id|_32_bit,            _eax,   _imm32 }, 
    995         { 0x80, _1|_ib,         _rm8,   _imm8 }, 
    996         { 0x81, _1|_iw|_16_bit,         _rm16,  _imm16 }, 
    997         { 0x81, _1|_id|_32_bit,         _rm32,  _imm32 }, 
    998         { 0x08, _r,                     _rm8,   _r8 }, 
    999         { 0x09, _r|_16_bit,                     _rm16,  _r16 }, 
    1000         { 0x09, _r|_32_bit,                     _rm32,  _r32 }, 
    1001         { 0x0a, _r,                     _r8,    _rm8 }, 
    1002         { 0x0b, _r|_16_bit,                     _r16,   _rm16 }, 
    1003         { 0x0b, _r|_32_bit,                     _r32,   _rm32 }, 
    1004         { ASM_END, 0, 0, 0 } 
    1005 }; 
    1006668PTRNTAB2  aptb2OUT[] = { 
    1007669        { 0xe6, _ib,            _imm8,  _al }, 
    1008670        { 0xe7, _ib|_16_bit,            _imm8,  _ax }, 
    1009671        { 0xe7, _ib|_32_bit,            _imm8,  _eax }, 
    1010672        { 0xee, _modnot1,               _dx,            _al }, 
    1011673        { 0xef, _16_bit|_modnot1,               _dx,            _ax }, 
    1012674        { 0xef, _32_bit|_modnot1,               _dx,            _eax }, 
    1013675        { ASM_END, 0, 0, 0 } 
    1014676}; 
    1015677PTRNTAB2  aptb2OUTS[] = /* OUTS */ { 
    1016678        { 0x6e, _modsinot1,             _dx,            _rm8 }, 
    1017679        { 0x6f, _16_bit | _I386 |_modsinot1,    _dx,            _rm16 }, 
    1018680        { 0x6f, _32_bit | _I386| _modsinot1,    _dx,            _rm32 }, 
    1019681        { ASM_END, 0, 0, 0 } 
    1020682}; 
    1021 PTRNTAB2  aptb2RCL[] = /* RCL */{ 
    1022 //      { 0xd0, _2,                     _rm8,   0 }, 
    1023         { 0xd2, _2,                     _rm8,   _cl }, 
    1024         { 0xc0, _2|_ib,         _rm8,   _imm8 }, 
    1025 //      { 0xd1, _2|_16_bit,                     _rm16,  0 }, 
    1026         { 0xd3, _2|_16_bit,                     _rm16,  _cl }, 
    1027         { 0xc1, _2|_ib|_16_bit,         _rm16,  _imm8 }, 
    1028 //      { 0xd1, _2|_32_bit,                     _rm32,  0 }, 
    1029         { 0xd3, _2|_32_bit,                     _rm32,  _cl }, 
    1030         { 0xc1, _2|_ib|_32_bit,         _rm32,  _imm8, }, 
    1031         { ASM_END, 0, 0, 0 } 
    1032 }; 
    1033 PTRNTAB2  aptb2RCR[] = /* RCR */ { 
    1034 //      { 0xd0, _3,                     _rm8,   0 }, 
    1035         { 0xd2, _3,                     _rm8,   _cl }, 
    1036         { 0xc0, _3|_ib,         _rm8,   _imm8 }, 
    1037 //      { 0xd1, _3|_16_bit,                     _rm16,  0 }, 
    1038         { 0xd3, _3|_16_bit,                     _rm16,  _cl }, 
    1039         { 0xc1, _3|_ib|_16_bit,         _rm16,  _imm8 }, 
    1040 //      { 0xd1, _3|_32_bit,                     _rm32,  0 }, 
    1041         { 0xd3, _3|_32_bit,                     _rm32,  _cl }, 
    1042         { 0xc1, _3|_ib|_32_bit,         _rm32,  _imm8 }, 
    1043         { ASM_END, 0, 0, 0 } 
    1044 }; 
    1045 PTRNTAB2  aptb2ROL[] = /* ROL */ { 
    1046 //      { 0xd0, _0,                     _rm8,   0 }, 
    1047         { 0xd2, _0,                     _rm8,   _cl }, 
    1048         { 0xc0, _0,                     _rm8,   _imm8 }, 
    1049 //      { 0xd1, _0|_16_bit,                     _rm16,  0 }, 
    1050         { 0xd3, _0|_16_bit,                     _rm16,  _cl }, 
    1051         { 0xc1, _0|_16_bit,                     _rm16,  _imm8 }, 
    1052 //      { 0xd1, _0|_32_bit,                     _rm32,  0 }, 
    1053         { 0xd3, _0|_32_bit,                     _rm32,  _cl }, 
    1054         { 0xc1, _0|_32_bit,                     _rm32,  _imm8 }, 
    1055         { ASM_END, 0, 0, 0 } 
    1056 }; 
    1057 PTRNTAB2  aptb2ROR[] = /* ROR */ { 
    1058 //      { 0xd0, _1,                     _rm8, 0 }, 
    1059         { 0xd2, _1,                     _rm8, _cl }, 
    1060         { 0xc0, _1,                     _rm8, _imm8 }, 
    1061 //      { 0xd1, _1|_16_bit,                     _rm16, 0 }, 
    1062         { 0xd3, _1|_16_bit,                     _rm16, _cl }, 
    1063         { 0xc1, _1|_16_bit,                     _rm16, _imm8 }, 
    1064 //      { 0xd1, _1|_32_bit,                     _rm32, 0 }, 
    1065         { 0xd3, _1|_32_bit,                     _rm32, _cl }, 
    1066         { 0xc1, _1|_32_bit,                     _rm32,  _imm8 }, 
    1067         { ASM_END, 0, 0, 0 } 
    1068 }; 
    1069 PTRNTAB2  aptb2SAL[] = /* SAL */ { 
    1070 //      { 0xd0, _4,                     _rm8, 0 }, 
    1071         { 0xd2, _4,                     _rm8, _cl }, 
    1072         { 0xc0, _4,                     _rm8, _imm8 }, 
    1073 //      { 0xd1, _4|_16_bit,                     _rm16, 0 }, 
    1074         { 0xd3, _4|_16_bit,                     _rm16, _cl }, 
    1075         { 0xc1, _4|_16_bit,                     _rm16, _imm8 }, 
    1076 //      { 0xd1, _4|_32_bit,                     _rm32, 0 }, 
    1077         { 0xd3, _4|_32_bit,                     _rm32, _cl }, 
    1078         { 0xc1, _4|_32_bit,                     _rm32,  _imm8 }, 
    1079         { ASM_END, 0, 0, 0 } 
    1080 }; 
    1081 PTRNTAB2  aptb2SBB[] = /* SBB */ { 
    1082         { 0x1c, _ib,            _al,    _imm8 }, 
    1083         { 0x83, _3|_16_bit,                     _rm16,  _imm8 }, 
    1084         { 0x1d, _iw|_16_bit,            _ax,    _imm16 }, 
    1085         { 0x83, _3|_32_bit,                     _rm32,  _imm8 }, 
    1086         { 0x1d, _id|_32_bit,            _eax,   _imm32 }, 
    1087         { 0x80, _3 | _ib,       _rm8,   _imm8 }, 
    1088         { 0x81, _3 | _iw|_16_bit,       _rm16,  _imm16 }, 
    1089         { 0x81, _3 | _id|_32_bit,       _rm32,  _imm32 }, 
    1090         { 0x18, _r,                     _rm8,   _r8 }, 
    1091         { 0x19, _r|_16_bit,                     _rm16,  _r16 }, 
    1092         { 0x19, _r|_32_bit,                     _rm32,  _r32 }, 
    1093         { 0x1A, _r,                     _r8,    _rm8 }, 
    1094         { 0x1B, _r|_16_bit,                     _r16,   _rm16 }, 
    1095         { 0x1B, _r|_32_bit,                     _r32,   _rm32 }, 
    1096         { ASM_END, 0, 0, 0 } 
    1097 }; 
    1098  
    1099  
    1100 PTRNTAB2  aptb2SAR[] = /* SAR */ { 
    1101 //      { 0xd0, _7,                     _rm8, 0 }, 
    1102         { 0xd2, _7,                     _rm8, _cl }, 
    1103         { 0xc0, _7,                     _rm8, _imm8 }, 
    1104 //      { 0xd1, _7|_16_bit,                     _rm16, 0 }, 
    1105         { 0xd3, _7|_16_bit,                     _rm16, _cl }, 
    1106         { 0xc1, _7|_16_bit,                     _rm16, _imm8 }, 
    1107 //      { 0xd1, _7|_32_bit,                     _rm32, 0 }, 
    1108         { 0xd3, _7|_32_bit,                     _rm32, _cl }, 
    1109         { 0xc1, _7|_32_bit,                     _rm32,  _imm8 }, 
    1110         { ASM_END, 0, 0, 0 } 
    1111 }; 
    1112 PTRNTAB2  aptb2SHL[] = /* SHL */ { 
    1113 //      { 0xd0, _4,                     _rm8, 0 }, 
    1114         { 0xd2, _4,                     _rm8, _cl }, 
    1115         { 0xc0, _4,                     _rm8, _imm8 }, 
    1116 //      { 0xd1, _4|_16_bit,                     _rm16, 0 }, 
    1117         { 0xd3, _4|_16_bit,                     _rm16, _cl }, 
    1118         { 0xc1, _4|_16_bit,                     _rm16, _imm8 }, 
    1119 //      { 0xd1, _4|_32_bit,                     _rm32, 0 }, 
    1120         { 0xd3, _4|_32_bit,                     _rm32, _cl }, 
    1121         { 0xc1, _4|_32_bit,                     _rm32,  _imm8 }, 
    1122         { ASM_END, 0, 0, 0 } 
    1123 }; 
    1124 PTRNTAB2  aptb2SHR[] = /* SHR */ { 
    1125 //      { 0xd0, _5,                     _rm8, 0 }, 
    1126         { 0xd2, _5,                     _rm8, _cl }, 
    1127         { 0xc0, _5,                     _rm8, _imm8 }, 
    1128 //      { 0xd1, _5|_16_bit,                     _rm16, 0 }, 
    1129         { 0xd3, _5|_16_bit,                     _rm16, _cl }, 
    1130         { 0xc1, _5|_16_bit,                     _rm16, _imm8 }, 
    1131 //      { 0xd1, _5|_32_bit,                     _rm32, 0 }, 
    1132         { 0xd3, _5|_32_bit,                     _rm32, _cl }, 
    1133         { 0xc1, _5|_32_bit,                     _rm32,  _imm8 }, 
    1134         { ASM_END, 0, 0, 0 } 
    1135 }; 
    1136 PTRNTAB2  aptb2SUB[] = /* SUB */ { 
    1137         { 0x2c, _ib,            _al,    _imm8 }, 
    1138         { 0x83, _5|_16_bit,                     _rm16,  _imm8 }, 
    1139         { 0x2d, _iw|_16_bit,            _ax,    _imm16 }, 
    1140         { 0x83, _5|_32_bit,                     _rm32,  _imm8 }, 
    1141         { 0x2d, _id|_32_bit,            _eax,   _imm32 }, 
    1142         { 0x80, _5 | _ib,       _rm8,   _imm8 }, 
    1143         { 0x81, _5 | _iw|_16_bit,       _rm16,  _imm16 }, 
    1144         { 0x81, _5 | _id|_32_bit,       _rm32,  _imm32 }, 
    1145         { 0x28, _r,                     _rm8,   _r8 }, 
    1146         { 0x29, _r|_16_bit,                     _rm16,  _r16 }, 
    1147         { 0x29, _r|_32_bit,                     _rm32,  _r32 }, 
    1148         { 0x2A, _r,                     _r8,    _rm8 }, 
    1149         { 0x2B, _r|_16_bit,                     _r16,   _rm16 }, 
    1150         { 0x2B, _r|_32_bit,                     _r32,   _rm32 }, 
    1151         { ASM_END, 0, 0, 0 } 
    1152 }; 
     683 
     684#define OPTABLE(str,op) \ 
     685PTRNTAB2  aptb2##str[] = {      \ 
     686        { 0xd2, op,             _rm8,   _cl },  \ 
     687        { 0xc0, op|_ib,         _rm8,   _imm8 },        \ 
     688        { 0xd3, op|_16_bit,     _rm16,  _cl },  \ 
     689        { 0xc1, op|_ib|_16_bit, _rm16,  _imm8 },        \ 
     690        { 0xd3, op|_32_bit,     _rm32,  _cl },  \ 
     691        { 0xc1, op|_ib|_32_bit, _rm32,  _imm8, },       \ 
     692        { 0xd3, op|_64_bit,     _rm64,  _cl },  \ 
     693        { 0xc1, op|_ib|_64_bit, _rm64,  _imm8, },       \ 
     694        { ASM_END, 0, 0, 0 }    \ 
     695
     696 
     697OPTABLE(ROL,_0); 
     698OPTABLE(ROR,_1); 
     699OPTABLE(RCL,_2); 
     700OPTABLE(RCR,_3); 
     701OPTABLE(SHL,_4); 
     702OPTABLE(SHR,_5); 
     703OPTABLE(SAR,_7); 
     704 
     705#undef OPTABLE 
     706 
    1153707PTRNTAB2  aptb2TEST[] = /* TEST */ { 
    1154708        { 0xa8, _ib|_modnot1,           _al,    _imm8 }, 
    1155709        { 0xa9, _iw|_16_bit|_modnot1,   _ax,    _imm16 }, 
    1156710        { 0xa9, _id|_32_bit|_modnot1,   _eax,   _imm32 }, 
    1157711        { 0xf6, _0|_modnot1,            _rm8,   _imm8 }, 
    1158712        { 0xf7, _0|_16_bit|_modnot1,    _rm16,  _imm16 }, 
    1159713        { 0xf7, _0|_32_bit|_modnot1,    _rm32,  _imm32 }, 
    1160714        { 0x84, _r|_modnot1,            _rm8,   _r8 }, 
    1161715        { 0x85, _r|_16_bit|_modnot1,    _rm16,  _r16 }, 
    1162716        { 0x85, _r|_32_bit|_modnot1,    _rm32,  _r32 }, 
    1163717        { ASM_END, 0, 0, 0 } 
    1164718}; 
    1165719PTRNTAB2  aptb2XADD[] = /* XADD */ {                    // 486 only instruction 
    1166720//      { 0x0fc0,       _ib | _I386|_mod2, _rm8, _r8 }, 
    1167721//      { 0x0fc1,       _iw | _I386|_16_bit|_mod2, _rm16, _r16 }, 
    1168722//      { 0x0fc1,       _id | _I386|_32_bit|_mod2, _rm32, _r32 }, 
    1169723        { 0x0fc0,       _r | _I386|_mod2, _rm8, _r8 }, 
    1170724        { 0x0fc1,       _r | _I386|_16_bit|_mod2, _rm16, _r16 }, 
    1171725        { 0x0fc1,       _r | _I386|_32_bit|_mod2, _rm32, _r32 }, 
    1172726        { ASM_END, 0, 0, 0 } 
    1173727}; 
    1174728PTRNTAB2  aptb2XCHG[] = /* XCHG */ { 
    1175729        { 0x90, _r|_16_bit|_mod2,       _ax ,   _r16 | _plus_r }, 
    1176730        { 0x90, _r|_16_bit|_mod2,       _r16 | _plus_r, _ax  }, 
    1177731        { 0x90, _r|_32_bit|_mod2,       _eax,   _r32 | _plus_r }, 
    1178732        { 0x90, _r|_32_bit|_mod2,       _r32 | _plus_r, _eax }, 
    1179733        { 0x86, _r|_mod2,               _rm8,   _r8 }, 
    1180734        { 0x86, _r|_mod2,               _r8,    _rm8 }, 
    1181735        { 0x87, _r|_16_bit|_mod2,               _rm16,  _r16 }, 
    1182736        { 0x87, _r|_16_bit|_mod2,               _r16, _rm16 }, 
    1183737        { 0x87, _r|_32_bit|_mod2,               _rm32,  _r32 }, 
    1184738        { 0x87, _r|_32_bit|_mod2,               _r32, _rm32 }, 
    1185739        { ASM_END, 0, 0, 0 } 
    1186740}; 
    1187 PTRNTAB2  aptb2XOR[] = { 
    1188         { 0x34, _ib,    _al,    _imm8 }, 
    1189         { 0x83, _6|_16_bit,             _rm16,  _imm8 }, 
    1190         { 0x35, _iw|_16_bit,    _ax,    _imm16 }, 
    1191         { 0x83, _6|_32_bit,             _rm32,  _imm8 }, 
    1192         { 0x35, _id|_32_bit,    _eax,   _imm32 }, 
    1193         { 0x80, _6,             _rm8,   _imm8 }, 
    1194         { 0x81, _6|_16_bit,             _rm16,  _imm16 }, 
    1195         { 0x81, _6|_32_bit,             _rm32,  _imm32 }, 
    1196         { 0x30, _r,             _rm8, _r8 }, 
    1197         { 0x31, _r|_16_bit,             _rm16, _r16 }, 
    1198         { 0x31, _r|_32_bit,             _rm32, _r32 }, 
    1199         { 0x32, _r,             _r8,    _rm8 }, 
    1200         { 0x33, _r|_16_bit,             _r16,   _rm16 }, 
    1201         { 0x33, _r|_32_bit,             _r32,   _rm32 }, 
    1202         { ASM_END, 0, 0, 0 } 
    1203 }; 
    1204  
    1205 PTRNTAB2  aptb2CMOVO[] = { 
    1206         { 0x0F40, _r|_16_bit,   _r16,   _rm16 }, 
    1207         { 0x0F40, _r|_32_bit,   _r32,   _rm32 }, 
    1208         { ASM_END, 0, 0, 0 } 
    1209 }; 
    1210 PTRNTAB2  aptb2CMOVNO[] = { 
    1211         { 0x0F41, _r|_16_bit,   _r16,   _rm16 }, 
    1212         { 0x0F41, _r|_32_bit,   _r32,   _rm32 }, 
    1213         { ASM_END, 0, 0, 0 } 
    1214 }; 
    1215 PTRNTAB2  aptb2CMOVB[] = { 
    1216         { 0x0F42, _r|_16_bit,   _r16,   _rm16 }, 
    1217         { 0x0F42, _r|_32_bit,   _r32,   _rm32 }, 
    1218         { ASM_END, 0, 0, 0 } 
    1219 }; 
    1220 PTRNTAB2  aptb2CMOVNB[] = { 
    1221         { 0x0F43, _r|_16_bit,   _r16,   _rm16 }, 
    1222         { 0x0F43, _r|_32_bit,   _r32,   _rm32 }, 
    1223         { ASM_END, 0, 0, 0 } 
    1224 }; 
    1225 PTRNTAB2  aptb2CMOVZ[] = { 
    1226         { 0x0F44, _r|_16_bit,   _r16,   _rm16 }, 
    1227         { 0x0F44, _r|_32_bit,   _r32,   _rm32 }, 
    1228         { ASM_END, 0, 0, 0 } 
    1229 }; 
    1230 PTRNTAB2  aptb2CMOVNZ[] = { 
    1231         { 0x0F45, _r|_16_bit,   _r16,   _rm16 }, 
    1232         { 0x0F45, _r|_32_bit,   _r32,   _rm32 }, 
    1233         { ASM_END, 0, 0, 0 } 
    1234 }; 
    1235 PTRNTAB2  aptb2CMOVBE[] = { 
    1236         { 0x0F46, _r|_16_bit,   _r16,   _rm16 }, 
    1237         { 0x0F46, _r|_32_bit,   _r32,   _rm32 }, 
    1238         { ASM_END, 0, 0, 0 } 
    1239 }; 
    1240 PTRNTAB2  aptb2CMOVNBE[] = { 
    1241         { 0x0F47, _r|_16_bit,   _r16,   _rm16 }, 
    1242         { 0x0F47, _r|_32_bit,   _r32,   _rm32 }, 
    1243         { ASM_END, 0, 0, 0 } 
    1244 }; 
    1245 PTRNTAB2  aptb2CMOVS[] = { 
    1246         { 0x0F48, _r|_16_bit,   _r16,   _rm16 }, 
    1247         { 0x0F48, _r|_32_bit,   _r32,   _rm32 }, 
    1248         { ASM_END, 0, 0, 0 } 
    1249 }; 
    1250 PTRNTAB2  aptb2CMOVNS[] = { 
    1251         { 0x0F49, _r|_16_bit,   _r16,   _rm16 }, 
    1252         { 0x0F49, _r|_32_bit,   _r32,   _rm32 }, 
    1253         { ASM_END, 0, 0, 0 } 
    1254 }; 
    1255 PTRNTAB2  aptb2CMOVP[] = { 
    1256         { 0x0F4A, _r|_16_bit,   _r16,   _rm16 }, 
    1257         { 0x0F4A, _r|_32_bit,   _r32,   _rm32 }, 
    1258         { ASM_END, 0, 0, 0 } 
    1259 }; 
    1260 PTRNTAB2  aptb2CMOVNP[] = { 
    1261         { 0x0F4B, _r|_16_bit,   _r16,   _rm16 }, 
    1262         { 0x0F4B, _r|_32_bit,   _r32,   _rm32 }, 
    1263         { ASM_END, 0, 0, 0 } 
    1264 }; 
    1265 PTRNTAB2  aptb2CMOVL[] = { 
    1266         { 0x0F4C, _r|_16_bit,   _r16,   _rm16 }, 
    1267         { 0x0F4C, _r|_32_bit,   _r32,   _rm32 }, 
    1268         { ASM_END, 0, 0, 0 } 
    1269 }; 
    1270 PTRNTAB2  aptb2CMOVNL[] = { 
    1271         { 0x0F4D, _r|_16_bit,   _r16,   _rm16 }, 
    1272         { 0x0F4D, _r|_32_bit,   _r32,   _rm32 }, 
    1273         { ASM_END, 0, 0, 0 } 
    1274 }; 
    1275 PTRNTAB2  aptb2CMOVLE[] = { 
    1276         { 0x0F4E, _r|_16_bit,   _r16,   _rm16 }, 
    1277         { 0x0F4E, _r|_32_bit,   _r32,   _rm32 }, 
    1278         { ASM_END, 0, 0, 0 } 
    1279 }; 
    1280 PTRNTAB2  aptb2CMOVNLE[] = { 
    1281         { 0x0F4F, _r|_16_bit,   _r16,   _rm16 }, 
    1282         { 0x0F4F, _r|_32_bit,   _r32,   _rm32 }, 
    1283         { ASM_END, 0, 0, 0 } 
    1284 }; 
     741 
     742#define OPTABLE(str,op) \ 
     743PTRNTAB2  aptb2##str[] = {      \ 
     744        { 0x0F40|op, _r|_16_bit,   _r16,   _rm16 },     \ 
     745        { 0x0F40|op, _r|_32_bit,   _r32,   _rm32 },     \ 
     746        { 0x0F40|op, _r|_64_bit,   _r64,   _rm64 },     \ 
     747        { ASM_END, 0, 0, 0 }    \ 
     748
     749 
     750OPTABLE(CMOVO,0); 
     751OPTABLE(CMOVNO,1); 
     752OPTABLE(CMOVB,2); 
     753OPTABLE(CMOVNB,3); 
     754OPTABLE(CMOVZ,4); 
     755OPTABLE(CMOVNZ,5); 
     756OPTABLE(CMOVBE,6); 
     757OPTABLE(CMOVNBE,7); 
     758OPTABLE(CMOVS,8); 
     759OPTABLE(CMOVNS,9); 
     760OPTABLE(CMOVP,0xA); 
     761OPTABLE(CMOVNP,0xB); 
     762OPTABLE(CMOVL,0xC); 
     763OPTABLE(CMOVNL,0xD); 
     764OPTABLE(CMOVLE,0xE); 
     765OPTABLE(CMOVNLE,0xF); 
     766 
     767#undef OPTABLE 
    1285768 
    1286769PTRNTAB3  aptb3IMUL[] = /* IMUL */ { 
    1287770        { 0x0faf,       _r|_16_bit,             _r16,   _rm16, 0 }, 
    1288771        { 0x0faf,       _r|_32_bit,             _r32,   _rm32, 0 }, 
    1289772        { 0x0faf,       _r|_64_bit,             _r64,   _rm64, 0 }, 
    1290773        { 0xf6, _5|_modax,                      _rm8,   0, 0 }, 
    1291774        { 0xf7, _5|_16_bit|_modaxdx,            _rm16,  0, 0 }, 
    1292775        { 0xf7, _5|_32_bit|_modaxdx,            _rm32,  0, 0 }, 
    1293776        { 0xf7, _5|_64_bit|_modaxdx,            _rm64,  0, 0 }, 
    1294777        { 0x6b, _r|_ib|_16_bit,         _r16,   _imm8, 0 }, 
    1295778        { 0x6b, _r|_ib|_32_bit,         _r32,   _imm8, 0 }, 
    1296779        { 0x69, _r|_iw|_16_bit,         _r16,   _imm16, 0 }, 
    1297780        { 0x69, _r|_id|_32_bit,         _r32,   _imm32, 0 }, 
    1298781        { 0x69, _r|_id|_64_bit,         _r64,   _imm32, 0 }, 
    1299782        { 0x6b, _r|_ib|_16_bit,         _r16,   _rm16,  _imm8 }, 
    1300783        { 0x6b, _r|_ib|_32_bit,         _r32,   _rm32,  _imm8 }, 
    1301784        { 0x6b, _r|_ib|_64_bit,         _r64,   _rm64,  _imm8 }, 
    1302785        { 0x69, _r|_iw|_16_bit,         _r16,   _rm16,  _imm16 }, 
    1303786        { 0x69, _r|_id|_32_bit,         _r32,   _rm32,  _imm32 }, 
    1304787        { 0x69, _r|_id|_64_bit,         _r64,   _rm64,  _imm32 }, 
    1305788        { ASM_END, 0, 0, 0 } 
    1306789}; 
    1307790PTRNTAB3  aptb3SHLD[] = /* SHLD */ { 
    1308791        { 0x0fa4,       _cw|_16_bit, _rm16, _r16, _imm8 }, 
    1309792        { 0x0fa4,       _cd|_32_bit, _rm32, _r32, _imm8 }, 
    1310793        { 0x0fa5,       _cw|_16_bit, _rm16, _r16, _cl }, 
    1311794        { 0x0fa5,       _cd|_32_bit, _rm32, _r32, _cl }, 
    1312795        { ASM_END, 0, 0, 0 } 
    1313796}; 
    1314797PTRNTAB3  aptb3SHRD[] = /* SHRD */ { 
    1315798        { 0x0fac,       _cw|_16_bit, _rm16, _r16, _imm8 }, 
    1316799        { 0x0fac,       _cd|_32_bit, _rm32, _r32, _imm8 }, 
    1317800        { 0x0fad,       _cw|_16_bit, _rm16, _r16, _cl }, 
    1318801        { 0x0fad,       _cd|_32_bit, _rm32, _r32, _cl }, 
    1319802        { ASM_END, 0, 0, 0 } 
    1320803}; 
    1321804// 
    1322805// Floating point instructions which have entirely different flag 
    1323806// interpretations 
    1324807// 
    1325 PTRNTAB0  aptb0F2XM1[] = /* F2XM1 */ { 
    1326         { 0xd9f0, 0 } 
    1327 }; 
    1328 PTRNTAB0  aptb0FABS[] = /* FABS */ { 
    1329         { 0xd9e1, 0 } 
    1330 }; 
    1331 PTRNTAB0  aptb0FCHS[] = /* FCHS */ { 
    1332         { 0xd9e0, 0 } 
    1333 }; 
    1334 PTRNTAB0  aptb0FCLEX[] = /* FCLEX */ { 
    1335         { 0xdbe2, _fwait } 
    1336 }; 
    1337 PTRNTAB0  aptb0FNCLEX[] = /* FNCLEX */ { 
    1338         { 0xdbe2, _nfwait } 
    1339 }; 
    1340 PTRNTAB0  aptb0FCOMPP[] = /* FCOMPP */ { 
    1341         { 0xded9, 0 } 
    1342 }; 
    1343 PTRNTAB0  aptb0FCOS[] = /* FCOS */ { 
    1344         { 0xd9ff, 0 } 
    1345 }; 
    1346 PTRNTAB0  aptb0FUCOMPP[] = /* FUCOMPP */ { 
    1347         { 0xdae9, 0 } 
    1348 }; 
    1349 PTRNTAB0  aptb0FDECSTP[] = /* FDECSTP */ { 
    1350         { 0xd9f6, 0 } 
    1351 }; 
    1352 PTRNTAB0  aptb0FINCSTP[] = /* FINCSTP */ { 
    1353         { 0xd9f7, 0 } 
    1354 }; 
    1355 PTRNTAB0  aptb0FINIT[] = /* FINIT */ { 
    1356         { 0xdbe3, _fwait } 
    1357 }; 
    1358 PTRNTAB0  aptb0FNINIT[] = /* FNINIT */ { 
    1359         { 0xdbe3, _nfwait } 
    1360 }; 
    1361 PTRNTAB0  aptb0FENI[] = /* FENI */ { 
    1362         { 0xdbe0, _fwait } 
    1363 }; 
    1364 PTRNTAB0  aptb0FNENI[] = /* FNENI */ { 
    1365         { 0xdbe0, _nfwait } 
    1366 }; 
    1367 PTRNTAB0  aptb0FDISI[] = /* FDISI */ { 
    1368         { 0xdbe1, _fwait } 
    1369 }; 
    1370 PTRNTAB0  aptb0FNDISI[] = /* FNDISI */ { 
    1371         { 0xdbe1, _nfwait } 
    1372 }; 
    1373 PTRNTAB0  aptb0FLD1[] = /* FLD1 */ { 
    1374         { 0xd9e8, 0 } 
    1375 }; 
    1376 PTRNTAB0  aptb0FLDL2T[] = /* FLDL2T */ { 
    1377         { 0xd9e9, 0 } 
    1378 }; 
    1379 PTRNTAB0  aptb0FLDL2E[] = /* FLDL2E */ { 
    1380         { 0xd9ea, 0 } 
    1381 }; 
    1382 PTRNTAB0  aptb0FLDPI[] = /* FLDPI */ { 
    1383         { 0xd9eb, 0 } 
    1384 }; 
    1385 PTRNTAB0  aptb0FLDLG2[] = /* FLDLG2 */ { 
    1386         { 0xd9ec, 0 } 
    1387 }; 
    1388 PTRNTAB0  aptb0FLDLN2[] = /* FLDLN2 */ { 
    1389         { 0xd9ed, 0 } 
    1390 }; 
    1391 PTRNTAB0  aptb0FLDZ[] = /* FLDZ */ { 
    1392         { 0xd9ee, 0 } 
    1393 }; 
    1394 PTRNTAB0  aptb0FNOP[] = /* FNOP */ { 
    1395         { 0xd9d0, 0 } 
    1396 }; 
    1397 PTRNTAB0  aptb0FPATAN[] = /* FPATAN */ { 
    1398         { 0xd9f3, 0 } 
    1399 }; 
    1400 PTRNTAB0  aptb0FPREM[] = /* FPREM */ { 
    1401         { 0xd9f8, 0 } 
    1402 }; 
    1403 PTRNTAB0  aptb0FPREM1[] = /* FPREM1 */ { 
    1404         { 0xd9f5, 0 } 
    1405 }; 
    1406 PTRNTAB0  aptb0FPTAN[] = /* FPTAN */ { 
    1407         { 0xd9f2, 0 } 
    1408 }; 
    1409 PTRNTAB0  aptb0FRNDINT[] = /* FRNDINT */ { 
    1410         { 0xd9fc, 0 } 
    1411 }; 
    1412 PTRNTAB0  aptb0FSCALE[] = /* FSCALE */ { 
    1413         { 0xd9fd, 0 } 
    1414 }; 
    1415 PTRNTAB0  aptb0FSETPM[] = /* FSETPM */ { 
    1416         { 0xdbe4, 0 } 
    1417 }; 
    1418 PTRNTAB0  aptb0FSIN[] = /* FSIN */ { 
    1419         { 0xd9fe, 0 } 
    1420 }; 
    1421 PTRNTAB0  aptb0FSINCOS[] = /* FSINCOS */ { 
    1422         { 0xd9fb, 0 } 
    1423 }; 
    1424 PTRNTAB0  aptb0FSQRT[] = /* FSQRT */ { 
    1425         { 0xd9fa, 0 } 
    1426 }; 
    1427 PTRNTAB0  aptb0FTST[] = /* FTST */ { 
    1428         { 0xd9e4, 0 } 
    1429 }; 
    1430 PTRNTAB0  aptb0FWAIT[] = /* FWAIT */ { 
    1431         { 0x9b, 0 } 
    1432 }; 
    1433 PTRNTAB0  aptb0FXAM[] = /* FXAM */ { 
    1434         { 0xd9e5, 0 } 
    1435 }; 
    1436 PTRNTAB0  aptb0FXTRACT[] = /* FXTRACT */ { 
    1437         { 0xd9f4, 0 } 
    1438 }; 
    1439 PTRNTAB0  aptb0FYL2X[] = /* FYL2X */ { 
    1440         { 0xd9f1, 0 } 
    1441 }; 
    1442 PTRNTAB0  aptb0FYL2XP1[] = /* FYL2XP1 */ { 
    1443         { 0xd9f9, 0 } 
    1444 }; 
     808 
     809OPTABLE0(F2XM1,    0xd9f0,0); 
     810OPTABLE0(FABS,     0xd9e1,0); 
     811OPTABLE0(FCHS,     0xd9e0,0); 
     812OPTABLE0(FCLEX,    0xdbe2,_fwait); 
     813OPTABLE0(FNCLEX,   0xdbe2, _nfwait); 
     814OPTABLE0(FCOMPP,   0xded9, 0); 
     815OPTABLE0(FCOS,     0xd9ff, 0); 
     816OPTABLE0(FUCOMPP,  0xdae9, 0); 
     817OPTABLE0(FDECSTP,  0xd9f6, 0); 
     818OPTABLE0(FINCSTP,  0xd9f7, 0); 
     819OPTABLE0(FINIT,    0xdbe3, _fwait); 
     820OPTABLE0(FNINIT,   0xdbe3, _nfwait); 
     821OPTABLE0(FENI,     0xdbe0, _fwait); 
     822OPTABLE0(FNENI,    0xdbe0, _nfwait); 
     823OPTABLE0(FDISI,    0xdbe1, _fwait); 
     824OPTABLE0(FNDISI,   0xdbe1, _nfwait); 
     825OPTABLE0(FLD1,     0xd9e8, 0); 
     826OPTABLE0(FLDL2T,   0xd9e9, 0); 
     827OPTABLE0(FLDL2E,   0xd9ea, 0); 
     828OPTABLE0(FLDPI,    0xd9eb, 0); 
     829OPTABLE0(FLDLG2,   0xd9ec, 0); 
     830OPTABLE0(FLDLN2,   0xd9ed, 0); 
     831OPTABLE0(FLDZ,     0xd9ee, 0); 
     832OPTABLE0(FNOP,     0xd9d0, 0); 
     833OPTABLE0(FPATAN,   0xd9f3, 0); 
     834OPTABLE0(FPREM,    0xd9f8, 0); 
     835OPTABLE0(FPREM1,   0xd9f5, 0); 
     836OPTABLE0(FPTAN,    0xd9f2, 0); 
     837OPTABLE0(FRNDINT,  0xd9fc, 0); 
     838OPTABLE0(FSCALE,   0xd9fd, 0); 
     839OPTABLE0(FSETPM,   0xdbe4, 0); 
     840OPTABLE0(FSIN,     0xd9fe, 0); 
     841OPTABLE0(FSINCOS,  0xd9fb, 0); 
     842OPTABLE0(FSQRT,    0xd9fa, 0); 
     843OPTABLE0(FTST,     0xd9e4, 0); 
     844OPTABLE0(FWAIT,    0x9b, 0); 
     845OPTABLE0(FXAM,     0xd9e5, 0); 
     846OPTABLE0(FXTRACT,  0xd9f4, 0); 
     847OPTABLE0(FYL2X,    0xd9f1, 0); 
     848OPTABLE0(FYL2XP1,  0xd9f9, 0); 
    1445849// 
    1446850// Floating point instructions which have entirely different flag 
    1447851// interpretations but they overlap, only asm_determine_operator 
    1448852// flags needs to know the difference 
    1449853//      1 operand floating point instructions follow 
    1450854// 
    1451855PTRNTAB1  aptb1FBLD[] = /* FBLD */ { 
    1452856        { 0xdf, _4, _fm80 }, 
    1453857        { ASM_END, 0, 0 } 
    1454858}; 
    1455859 
    1456860PTRNTAB1  aptb1FBSTP[] = /* FBSTP */ { 
    1457861        { 0xdf, _6, _fm80 }, 
    1458862        { ASM_END, 0, 0 } 
    1459863}; 
    1460864PTRNTAB2  aptb2FCMOVB[] = /* FCMOVB */ { 
    1461865        { 0xdac0, 0, _st, _sti | _plus_r }, 
    1462866        { 0xdac1, 0, 0 }, 
    1463867        { ASM_END, 0, 0 } 
    1464868}; 
     
    32032607        X("cmovnge",    2,              (P) aptb2CMOVL ) \ 
    32042608        X("cmovnl",     2,              (P) aptb2CMOVNL ) \ 
    32052609        X("cmovnle",    2,              (P) aptb2CMOVNLE ) \ 
    32062610        X("cmovno",     2,              (P) aptb2CMOVNO ) \ 
    32072611        X("cmovnp",     2,              (P) aptb2CMOVNP ) \ 
    32082612        X("cmovns",     2,              (P) aptb2CMOVNS ) \ 
    32092613        X("cmovnz",     2,              (P) aptb2CMOVNZ ) \ 
    32102614        X("cmovo",      2,              (P) aptb2CMOVO ) \ 
    32112615        X("cmovp",      2,              (P) aptb2CMOVP ) \ 
    32122616        X("cmovpe",     2,              (P) aptb2CMOVP ) \ 
    32132617        X("cmovpo",     2,              (P) aptb2CMOVNP ) \ 
    32142618        X("cmovs",      2,              (P) aptb2CMOVS ) \ 
    32152619        X("cmovz",      2,              (P) aptb2CMOVZ ) \ 
    32162620        X("cmp",        2,              (P) aptb2CMP ) \ 
    32172621        X("cmppd",      3,              (P) aptb3CMPPD ) \ 
    32182622        X("cmpps",      3,              (P) aptb3CMPPS ) \ 
    32192623        X("cmps",       2,              (P) aptb2CMPS ) \ 
    32202624        X("cmpsb",      0,              aptb0CMPSB ) \ 
    32212625        /*X("cmpsd",    0,              aptb0CMPSD )*/ \ 
    32222626        X("cmpsd",      ITopt|3,        (P) aptb3CMPSD ) \ 
     2627        X("cmpsq",      0,              aptb0CMPSQ ) \ 
    32232628        X("cmpss",      3,              (P) aptb3CMPSS ) \ 
    32242629        X("cmpsw",      0,              aptb0CMPSW ) \ 
    32252630        X("cmpxch8b",   1,              (P) aptb1CMPXCH8B ) \ 
    32262631        X("cmpxchg",    2,              (P) aptb2CMPXCHG ) \ 
    32272632        X("comisd",     2,              (P) aptb2COMISD ) \ 
    32282633        X("comiss",     2,              (P) aptb2COMISS ) \ 
    32292634        X("cpuid",      0,              aptb0CPUID ) \ 
    32302635        X("cqo",        0,              aptb0CQO ) \ 
    32312636        X("cvtdq2pd",   2,              (P) aptb2CVTDQ2PD ) \ 
    32322637        X("cvtdq2ps",   2,              (P) aptb2CVTDQ2PS ) \ 
    32332638        X("cvtpd2dq",   2,              (P) aptb2CVTPD2DQ ) \ 
    32342639        X("cvtpd2pi",   2,              (P) aptb2CVTPD2PI ) \ 
    32352640        X("cvtpd2ps",   2,              (P) aptb2CVTPD2PS ) \ 
    32362641        X("cvtpi2pd",   2,              (P) aptb2CVTPI2PD ) \ 
    32372642        X("cvtpi2ps",   2,              (P) aptb2CVTPI2PS ) \ 
    32382643        X("cvtps2dq",   2,              (P) aptb2CVTPS2DQ ) \ 
    32392644        X("cvtps2pd",   2,              (P) aptb2CVTPS2PD ) \ 
    32402645        X("cvtps2pi",   2,              (P) aptb2CVTPS2PI ) \ 
    32412646        X("cvtsd2si",   2,              (P) aptb2CVTSD2SI ) \ 
    32422647        X("cvtsd2ss",   2,              (P) aptb2CVTSD2SS ) \ 
     
    34322837#define OPCODETABLE2    \ 
    34332838        X("lahf",       0,              aptb0LAHF ) \ 
    34342839        X("lar",        2,              (P) aptb2LAR ) \ 
    34352840        X("lddqu",      2,              (P) aptb2LDDQU ) \ 
    34362841        X("ldmxcsr",    1,              (P) aptb1LDMXCSR ) \ 
    34372842        X("lds",        2,              (P) aptb2LDS ) \ 
    34382843        X("lea",        2,              (P) aptb2LEA ) \ 
    34392844        X("leave",      0,              aptb0LEAVE ) \ 
    34402845        X("les",        2,              (P) aptb2LES ) \ 
    34412846        X("lfence",     0,              aptb0LFENCE) \ 
    34422847        X("lfs",        2,              (P) aptb2LFS ) \ 
    34432848        X("lgdt",       1,              (P) aptb1LGDT ) \ 
    34442849        X("lgs",        2,              (P) aptb2LGS ) \ 
    34452850        X("lidt",       1,              (P) aptb1LIDT ) \ 
    34462851        X("lldt",       1,              (P) aptb1LLDT ) \ 
    34472852        X("lmsw",       1,              (P) aptb1LMSW ) \ 
    34482853        X("lock",       ITprefix | 0,   aptb0LOCK ) \ 
    34492854        X("lods",       1,              (P) aptb1LODS ) \ 
    34502855        X("lodsb",      0,              aptb0LODSB ) \ 
    34512856        X("lodsd",      0,              aptb0LODSD ) \ 
     2857        X("lodsq",      0,              aptb0LODSQ ) \ 
    34522858        X("lodsw",      0,              aptb0LODSW ) \ 
    34532859        X("loop",       ITjump | 1,     (P) aptb1LOOP ) \ 
    34542860        X("loope",      ITjump | 1,     (P) aptb1LOOPE ) \ 
    34552861        X("loopne",     ITjump | 1,     (P) aptb1LOOPNE ) \ 
    3456         X("loopnz",     ITjump | 1,     (P) aptb1LOOPNZ ) \ 
    3457         X("loopz",      ITjump | 1,     (P) aptb1LOOPZ ) \ 
     2862        X("loopnz",     ITjump | 1,     (P) aptb1LOOPNE ) \ 
     2863        X("loopz",      ITjump | 1,     (P) aptb1LOOPE ) \ 
    34582864        X("lsl",        2,              (P) aptb2LSL ) \ 
    34592865        X("lss",        2,              (P) aptb2LSS ) \ 
    34602866        X("ltr",        1,              (P) aptb1LTR ) \ 
    34612867        X("maskmovdqu", 2,              (P) aptb2MASKMOVDQU ) \ 
    34622868        X("maskmovq",   2,              (P) aptb2MASKMOVQ ) \ 
    34632869        X("maxpd",      2,              (P) aptb2MAXPD ) \ 
    34642870        X("maxps",      2,              (P) aptb2MAXPS ) \ 
    34652871        X("maxsd",      2,              (P) aptb2MAXSD ) \ 
    34662872        X("maxss",      2,              (P) aptb2MAXSS ) \ 
    34672873        X("mfence",     0,              aptb0MFENCE) \ 
    34682874        X("minpd",      2,              (P) aptb2MINPD ) \ 
    34692875        X("minps",      2,              (P) aptb2MINPS ) \ 
    34702876        X("minsd",      2,              (P) aptb2MINSD ) \ 
    34712877        X("minss",      2,              (P) aptb2MINSS ) \ 
    34722878        X("monitor",    0,              (P) aptb0MONITOR ) \ 
    34732879        X("mov",        2,              (P) aptb2MOV ) \ 
    34742880        X("movapd",     2,              (P) aptb2MOVAPD ) \ 
    34752881        X("movaps",     2,              (P) aptb2MOVAPS ) \ 
    34762882        X("movd",       2,              (P) aptb2MOVD ) \ 
    34772883        X("movddup",    2,              (P) aptb2MOVDDUP ) \ 
     
    34812887        X("movhlps",    2,              (P) aptb2MOVHLPS ) \ 
    34822888        X("movhpd",     2,              (P) aptb2MOVHPD ) \ 
    34832889        X("movhps",     2,              (P) aptb2MOVHPS ) \ 
    34842890        X("movlhps",    2,              (P) aptb2MOVLHPS ) \ 
    34852891        X("movlpd",     2,              (P) aptb2MOVLPD ) \ 
    34862892        X("movlps",     2,              (P) aptb2MOVLPS ) \ 
    34872893        X("movmskpd",   2,              (P) aptb2MOVMSKPD ) \ 
    34882894        X("movmskps",   2,              (P) aptb2MOVMSKPS ) \ 
    34892895        X("movntdq",    2,              (P) aptb2MOVNTDQ ) \ 
    34902896        X("movnti",     2,              (P) aptb2MOVNTI ) \ 
    34912897        X("movntpd",    2,              (P) aptb2MOVNTPD ) \ 
    34922898        X("movntps",    2,              (P) aptb2MOVNTPS ) \ 
    34932899        X("movntq",     2,              (P) aptb2MOVNTQ ) \ 
    34942900        X("movq",       2,              (P) aptb2MOVQ ) \ 
    34952901        X("movq2dq",    2,              (P) aptb2MOVQ2DQ ) \ 
    34962902        X("movs",       2,              (P) aptb2MOVS ) \ 
    34972903        X("movsb",      0,              aptb0MOVSB ) \ 
    34982904        X("movsd",      ITopt | 2,      (P) aptb2MOVSD ) \ 
    34992905        X("movshdup",   2,              (P) aptb2MOVSHDUP ) \ 
    35002906        X("movsldup",   2,              (P) aptb2MOVSLDUP ) \ 
     2907        X("movsq",      0,              aptb0MOVSQ ) \ 
    35012908        X("movss",      2,              (P) aptb2MOVSS ) \ 
    35022909        X("movsw",      0,              aptb0MOVSW ) \ 
    35032910        X("movsx",      2,              (P) aptb2MOVSX ) \ 
    35042911        X("movupd",     2,              (P) aptb2MOVUPD ) \ 
    35052912        X("movups",     2,              (P) aptb2MOVUPS ) \ 
    35062913        X("movzx",      2,              (P) aptb2MOVZX ) \ 
    35072914        X("mul",        ITopt | 2,      (P) aptb2MUL ) \ 
    35082915        X("mulpd",      2,              (P) aptb2MULPD ) \ 
    35092916        X("mulps",      2,              (P) aptb2MULPS ) \ 
    35102917        X("mulsd",      2,              (P) aptb2MULSD ) \ 
    35112918        X("mulss",      2,              (P) aptb2MULSS ) \ 
    35122919        X("mwait",      0,              (P) aptb0MWAIT ) \ 
    35132920        X("neg",        1,              (P) aptb1NEG ) \ 
    35142921        X("nop",        0,              aptb0NOP ) \ 
    35152922        X("not",        1,              (P) aptb1NOT ) \ 
    35162923        X("or",         2,              (P) aptb2OR ) \ 
    35172924        X("orpd",       2,              (P) aptb2ORPD ) \ 
    35182925        X("orps",       2,              (P) aptb2ORPS ) \ 
    35192926        X("out",        2,              (P) aptb2OUT ) \ 
    35202927        X("outs",       2,              (P) aptb2OUTS ) \ 
     
    36273034        X("rcl",        ITshift | 2,    (P) aptb2RCL ) \ 
    36283035        X("rcpps",      2,              (P) aptb2RCPPS ) \ 
    36293036        X("rcpss",      2,              (P) aptb2RCPSS ) \ 
    36303037        X("rcr",        ITshift | 2,    (P) aptb2RCR ) \ 
    36313038        X("rdmsr",      0,              aptb0RDMSR ) \ 
    36323039        X("rdpmc",      0,              aptb0RDPMC ) \ 
    36333040        X("rdtsc",      0,              aptb0RDTSC ) \ 
    36343041        X("rep",        ITprefix | 0,   aptb0REP ) \ 
    36353042        X("repe",       ITprefix | 0,   aptb0REP ) \ 
    36363043        X("repne",      ITprefix | 0,   aptb0REPNE ) \ 
    36373044        X("repnz",      ITprefix | 0,   aptb0REPNE ) \ 
    36383045        X("repz",       ITprefix | 0,   aptb0REP ) \ 
    36393046        X("ret",        ITopt | 1,      (P) aptb1RET ) \ 
    36403047        X("retf",       ITopt | 1,      (P) aptb1RETF ) \ 
    36413048        X("rol",        ITshift | 2,    (P) aptb2ROL ) \ 
    36423049        X("ror",        ITshift | 2,    (P) aptb2ROR ) \ 
    36433050        X("rsm",        0,              aptb0RSM ) \ 
    36443051        X("rsqrtps",    2,              (P) aptb2RSQRTPS ) \ 
    36453052        X("rsqrtss",    2,              (P) aptb2RSQRTSS ) \ 
    36463053        X("sahf",       0,              aptb0SAHF ) \ 
    3647         X("sal",        ITshift | 2,    (P) aptb2SAL ) \ 
     3054        X("sal",        ITshift | 2,    (P) aptb2SHL ) \ 
    36483055        X("sar",        ITshift | 2,    (P) aptb2SAR ) \ 
    36493056        X("sbb",        2,              (P) aptb2SBB ) \ 
    36503057        X("scas",       1,              (P) aptb1SCAS ) \ 
    36513058        X("scasb",      0,              aptb0SCASB ) \ 
    36523059        X("scasd",      0,              aptb0SCASD ) \ 
     3060        X("scasq",      0,              aptb0SCASQ ) \ 
    36533061        X("scasw",      0,              aptb0SCASW ) \ 
    36543062        X("seta",       1,              (P) aptb1SETNBE ) \ 
    36553063        X("setae",      1,              (P) aptb1SETNB ) \ 
    36563064        X("setb",       1,              (P) aptb1SETB ) \ 
    36573065        X("setbe",      1,              (P) aptb1SETBE ) \ 
    36583066        X("setc",       1,              (P) aptb1SETB ) \ 
    36593067        X("sete",       1,              (P) aptb1SETZ ) \ 
    36603068        X("setg",       1,              (P) aptb1SETNLE ) \ 
    36613069        X("setge",      1,              (P) aptb1SETNL ) \ 
    36623070        X("setl",       1,              (P) aptb1SETL ) \ 
    36633071        X("setle",      1,              (P) aptb1SETLE ) \ 
    36643072        X("setna",      1,              (P) aptb1SETBE ) \ 
    36653073        X("setnae",     1,              (P) aptb1SETB ) \ 
    36663074        X("setnb",      1,              (P) aptb1SETNB ) \ 
    36673075        X("setnbe",     1,              (P) aptb1SETNBE ) \ 
    36683076        X("setnc",      1,              (P) aptb1SETNB ) \ 
    36693077        X("setne",      1,              (P) aptb1SETNZ ) \ 
    36703078        X("setng",      1,              (P) aptb1SETLE ) \ 
    36713079        X("setnge",     1,              (P) aptb1SETL ) \ 
    36723080        X("setnl",      1,              (P) aptb1SETNL ) \ 
     
    36863094        X("shl",        ITshift | 2,    (P) aptb2SHL ) \ 
    36873095        X("shld",       3,              (P) aptb3SHLD ) \ 
    36883096        X("shr",        ITshift | 2,    (P) aptb2SHR ) \ 
    36893097        X("shrd",       3,              (P) aptb3SHRD ) \ 
    36903098        X("shufpd",     3,              (P) aptb3SHUFPD ) \ 
    36913099        X("shufps",     3,              (P) aptb3SHUFPS ) \ 
    36923100        X("sidt",       1,              (P) aptb1SIDT ) \ 
    36933101        X("sldt",       1,              (P) aptb1SLDT ) \ 
    36943102        X("smsw",       1,              (P) aptb1SMSW ) \ 
    36953103        X("sqrtpd",     2,              (P) aptb2SQRTPD ) \ 
    36963104        X("sqrtps",     2,              (P) aptb2SQRTPS ) \ 
    36973105        X("sqrtsd",     2,              (P) aptb2SQRTSD ) \ 
    36983106        X("sqrtss",     2,              (P) aptb2SQRTSS ) \ 
    36993107        X("stc",        0,              aptb0STC ) \ 
    37003108        X("std",        0,              aptb0STD ) \ 
    37013109        X("sti",        0,              aptb0STI ) \ 
    37023110        X("stmxcsr",    1,              (P) aptb1STMXCSR ) \ 
    37033111        X("stos",       1,              (P) aptb1STOS ) \ 
    37043112        X("stosb",      0,              aptb0STOSB ) \ 
    37053113        X("stosd",      0,              aptb0STOSD ) \ 
     3114        X("stosq",      0,              aptb0STOSQ ) \ 
    37063115        X("stosw",      0,              aptb0STOSW ) \ 
    37073116        X("str",        1,              (P) aptb1STR ) \ 
    37083117        X("sub",        2,              (P) aptb2SUB ) \ 
    37093118        X("subpd",      2,              (P) aptb2SUBPD ) \ 
    37103119        X("subps",      2,              (P) aptb2SUBPS ) \ 
    37113120        X("subsd",      2,              (P) aptb2SUBSD ) \ 
    37123121        X("subss",      2,              (P) aptb2SUBSS ) \ 
    37133122        X("sysenter",   0,              aptb0SYSENTER ) \ 
    37143123        X("sysexit",    0,              aptb0SYSEXIT ) \ 
    37153124        X("test",       2,              (P) aptb2TEST ) \ 
    37163125        X("ucomisd",    2,              (P) aptb2UCOMISD ) \ 
    37173126        X("ucomiss",    2,              (P) aptb2UCOMISS ) \ 
    37183127        X("ud2",        0,              aptb0UD2 ) \ 
    37193128        X("unpckhpd",   2,              (P) aptb2UNPCKHPD ) \ 
    37203129        X("unpckhps",   2,              (P) aptb2UNPCKHPS ) \ 
    37213130        X("unpcklpd",   2,              (P) aptb2UNPCKLPD ) \ 
    37223131        X("unpcklps",   2,              (P) aptb2UNPCKLPS ) \ 
    37233132        X("verr",       1,              (P) aptb1VERR ) \ 
    37243133        X("verw",       1,              (P) aptb1VERW ) \ 
    37253134        X("wait",       0,              aptb0WAIT ) \ 
  • branches/dmd-1.x/src/e2ir.c

    r618 r621  
    41324132                elength = n1; 
    41334133                n1 = el_same(&elength); 
    41344134                elength = el_una(OP64_32, TYuint, elength); 
    41354135            L1: 
    41364136                n2x = n2; 
    41374137                n2 = el_same(&n2x); 
    41384138                n2x = el_bin(OPlt, TYint, n2x, elength); 
    41394139 
    41404140                // Construct: (n2x || ModuleAssert(line)) 
    41414141                Symbol *sassert; 
    41424142 
    41434143                sassert = irs->blx->module->toModuleArray(); 
    41444144                ea = el_bin(OPcall,TYvoid,el_var(sassert), 
    41454145                    el_long(TYint, loc.linnum)); 
    41464146                eb = el_bin(OPoror,TYvoid,n2x,ea); 
    41474147            } 
    41484148        } 
    41494149 
    41504150        n1 = array_toPtr(t1, n1); 
    41514151 
    4152         {   elem *escale; 
    4153  
    4154             escale = el_long(TYint, t1->nextOf()->size()); 
    4155             n2 = el_bin(OPmul, TYint, n2, escale); 
     4152        { 
     4153            elem *escale = el_long(TYsize_t, t1->nextOf()->size()); 
     4154            n2 = el_bin(OPmul, TYsize_t, n2, escale); 
    41564155            e = el_bin(OPadd, TYnptr, n1, n2); 
    41574156            e = el_una(OPind, type->totym(), e); 
    41584157            if (tybasic(e->Ety) == TYstruct || tybasic(e->Ety) == TYarray) 
    41594158            {   e->Ety = TYstruct; 
    41604159                e->Enumbytes = type->size(); 
    41614160            } 
    41624161        } 
    41634162 
    41644163        eb = el_combine(einit, eb); 
    41654164        e = el_combine(eb, e); 
    41664165    } 
    41674166    el_setLoc(e,loc); 
    41684167    return e; 
    41694168} 
    41704169 
    41714170 
    41724171elem *TupleExp::toElem(IRState *irs) 
    41734172{   elem *e = NULL; 
    41744173 
    41754174    //printf("TupleExp::toElem() %s\n", toChars()); 
  • branches/dmd-1.x/src/impcnvgen.c

    r428 r621  
    364364    Y(Tint64, Tuns16) 
    365365    Y(Tuns64, Tuns16) 
    366366 
    367367    Y(Tint16, Twchar) 
    368368    Y(Tint32, Twchar) 
    369369    Y(Tuns32, Twchar) 
    370370    Y(Tint64, Twchar) 
    371371    Y(Tuns64, Twchar) 
    372372 
    373373//    Y(Tuns32, Tint32) 
    374374    Y(Tint64, Tint32) 
    375375    Y(Tuns64, Tint32) 
    376376 
    377377//    Y(Tint32, Tuns32) 
    378378    Y(Tint64, Tuns32) 
    379379    Y(Tuns64, Tuns32) 
    380380 
    381381    Y(Tint64, Tdchar) 
    382382    Y(Tuns64, Tdchar) 
    383383 
    384     Y(Tint64, Tuns64) 
    385     Y(Tuns64, Tint64) 
     384//    Y(Tint64, Tuns64) 
     385//    Y(Tuns64, Tint64) 
    386386 
    387387    for (i = 0; i < TMAX; i++) 
    388388        for (j = 0; j < TMAX; j++) 
    389389        { 
    390390            if (impcnvResult[i][j] == Terror) 
    391391            { 
    392392                impcnvResult[i][j] = impcnvResult[j][i]; 
    393393                impcnvType1[i][j] = impcnvType2[j][i]; 
    394394                impcnvType2[i][j] = impcnvType1[j][i]; 
    395395            } 
    396396        } 
    397397} 
    398398 
    399399int main() 
    400400{   FILE *fp; 
    401401    int i; 
    402402    int j; 
    403403 
    404404    init(); 
    405405 
  • trunk/src/backend/cod1.c

    r619 r621  
    11461146                c = cdisscaledindex(e11,&idxregs,keepmsk); 
    11471147                reg = findreg(idxregs); 
    11481148                pcs->Irm = modregrm(0,0,4); 
    11491149                pcs->Isib = modregrm(ss,reg & 7,5); 
    11501150                if (reg & 8) 
    11511151                    pcs->Irex |= REX_X; 
    11521152            } 
    11531153            else 
    11541154            { 
    11551155                c = scodelem(e11,&idxregs,keepmsk,TRUE); // load index reg 
    11561156                setaddrmode(pcs, idxregs); 
    11571157            } 
    11581158            goto Lptr; 
    11591159        } 
    11601160 
    11611161        /* Look for *(v1 + v2) 
    11621162         *      EA = [v1][v2] 
    11631163         */ 
    11641164 
    11651165        if (!I16 && e1isadd && (!e1->Ecount || !e1free) && 
    1166             tysize[e1ty] == REGSIZE
     1166            (tysize[e1ty] == REGSIZE || (I64 && tysize[e1ty] == 4))
    11671167        {   code *c2; 
    11681168            regm_t idxregs2; 
    11691169            unsigned base,index; 
    11701170            int ss; 
    11711171 
    11721172        L4: 
    11731173            // Look for *(v1 + v2 << scale) 
    11741174            ss = isscaledindex(e12); 
    11751175            if (ss) 
    11761176            { 
    11771177                c = scodelem(e11,&idxregs,keepmsk,TRUE); 
    11781178                idxregs2 = allregs & ~(idxregs | keepmsk); 
    11791179                c2 = cdisscaledindex(e12,&idxregs2,keepmsk | idxregs); 
    11801180            } 
    11811181 
    11821182            // Look for *(v1 << scale + v2) 
    11831183            else if ((ss = isscaledindex(e11)) != 0) 
    11841184            { 
    11851185                idxregs2 = idxregs; 
    11861186                c = cdisscaledindex(e11,&idxregs2,keepmsk); 
     
    35223522L3: 
    35233523    cssave(e,*pretregs,FALSE); 
    35243524    freenode(e); 
    35253525    return c; 
    35263526} 
    35273527 
    35283528 
    35293529/****************************** 
    35303530 * Generate code to load data into registers. 
    35313531 */ 
    35323532 
    35333533code *loaddata(elem *e,regm_t *pretregs) 
    35343534{ unsigned reg,nreg,op,sreg; 
    35353535  tym_t tym; 
    35363536  int sz; 
    35373537  code *c,*ce,cs; 
    35383538  regm_t flags,forregs,regm; 
    35393539 
    35403540#ifdef DEBUG 
    35413541  if (debugw) 
    3542         printf("loaddata(e = %p,*pretregs = x%x)\n",e,*pretregs); 
     3542        printf("loaddata(e = %p,*pretregs = %s)\n",e,regm_str(*pretregs)); 
    35433543  //elem_print(e); 
    35443544#endif 
    35453545  assert(e); 
    35463546  elem_debug(e); 
    35473547  if (*pretregs == 0) 
    35483548        return CNIL; 
    35493549  tym = tybasic(e->Ety); 
    35503550  if (tym == TYstruct) 
    35513551        return cdrelconst(e,pretregs); 
    35523552  if (tyfloating(tym)) 
    35533553  {     obj_fltused(); 
    35543554        if (config.inline8087) 
    35553555        {   if (*pretregs & mST0) 
    35563556                return load87(e,0,pretregs,NULL,-1); 
    35573557            else if (tycomplex(tym)) 
    35583558                return cload87(e, pretregs); 
    35593559        } 
    35603560  } 
    35613561  sz = tysize[tym]; 
    35623562  cs.Iflags = 0; 
  • trunk/src/backend/ptrntab.c

    r619 r621  
    1515#include        <stdlib.h> 
    1616#include        <string.h> 
    1717#include        <time.h> 
    1818 
    1919#include        "cc.h" 
    2020#include        "code.h" 
    2121#include        "iasm.h" 
    2222 
    2323static char __file__[] = __FILE__;      /* for tassert.h                */ 
    2424#include        "tassert.h" 
    2525 
    2626// 
    2727// NOTE: For 0 operand instructions, the opcode is taken from 
    2828// the first entry and no subsequent entries are required. 
    2929// for instructions with operands, a NULL entry is required at the end 
    3030// as a terminator 
    3131// 
    3232// 0 Operand instructions 
    3333// 
    3434 
    35 PTRNTAB0 aptb0AAA[] = /* AAA */ { 
    36         { 0x37, _modax }, 
    37 }; 
    38  
    39 PTRNTAB0 aptb0AAD[] = /* AAD */ { 
    40         { 0xd50a, _modax } 
    41 }; 
    42  
    43 PTRNTAB0 aptb0AAM[] = /* AAM */ { 
    44         { 0xd40a, _modax } 
    45 }; 
    46 PTRNTAB0 aptb0AAS[] = /* AAS */ { 
    47         { 0x3f, _modax } 
    48 }; 
    49 PTRNTAB0 aptb0CBW[] = /* CBW */ { 
    50         { 0x98, _16_bit | _modax } 
    51 }; 
    52 PTRNTAB0 aptb0CWDE[] = /* CWDE */ { 
    53         { 0x98, _32_bit | _I386 | _modax } 
    54 }; 
    55 PTRNTAB0 aptb0CDQE[] = /* CDQE */ { 
    56         { 0x98, _64_bit | _modax } 
    57 }; 
    58 PTRNTAB0 aptb0CLC[] =  /* CLC */ { 
    59         { 0xf8, 0 } 
    60 }; 
    61  
    62 PTRNTAB0 aptb0CLD[] = /* CLD */ { 
    63         { 0xfc, 0 } 
    64 }; 
    65 PTRNTAB0 aptb0CLI[] =  /* CLI */ { 
    66         { 0xfa, 0 } 
    67 }; 
    68  
    69 PTRNTAB0 aptb0CLTS[] =  /* CLTS */ { 
    70         { 0x0f06, 0 } 
    71 }; 
    72  
    73 PTRNTAB0 aptb0CMC[] =  /* CMC */ { 
    74         { 0xf5, 0 } 
    75 }; 
    76  
    77 PTRNTAB0 aptb0CMPSB[] =  /* CMPSB */ { 
    78         { 0xa6, _modsidi } 
    79 }; 
    80  
    81 PTRNTAB0 aptb0CMPSW[] =  /* CMPSW */ { 
    82         { 0xa7, _16_bit | _modsidi } 
    83 }; 
    84  
    85 #if 0 
    86 PTRNTAB0 aptb0CMPSD[] =  /* CMPSD */ { 
    87         { 0xa7, _32_bit | _I386 | _modsidi } 
    88 }; 
    89 #endif 
    90  
    91 PTRNTAB0 aptb0CWD[] =  /* CWD */ { 
    92         { 0x99, _16_bit | _modaxdx } 
    93 }; 
    94  
    95 PTRNTAB0 aptb0CDQ[] =  /* CDQ */ { 
    96         { 0x99, _32_bit | _I386 | _modaxdx } 
    97 }; 
    98  
    99 PTRNTAB0 aptb0CQO[] =  /* CQO */ { 
    100         { 0x99, _64_bit | _modaxdx } 
    101 }; 
    102  
    103 PTRNTAB0 aptb0DAA[] =  /* DAA */ { 
    104         { 0x27, _modax } 
    105 }; 
    106  
    107 PTRNTAB0 aptb0DAS[] =  /* DAS */ { 
    108         { 0x2f, _modax } 
    109 }; 
    110  
    111 PTRNTAB0 aptb0HLT[] =  /* HLT */ { 
    112         { 0xf4, 0 } 
    113 }; 
    114  
    115 PTRNTAB0 aptb0INSB[] =  /* INSB */ { 
    116         { 0x6c,  _I386 | _modsi } 
    117 }; 
    118  
    119 PTRNTAB0 aptb0INSW[] =  /* INSW */ { 
    120         { 0x6d, _16_bit | _I386 | _modsi } 
    121 }; 
    122  
    123 PTRNTAB0 aptb0INSD[] =  /* INSD */ { 
    124         { 0x6d, _32_bit | _I386 | _modsi } 
    125 }; 
    126  
    127 PTRNTAB0 aptb0INTO[] =  /* INTO */ { 
    128         { 0xce, 0 } 
    129 }; 
    130 PTRNTAB0 aptb0INVD[] = /* INVD */ { 
    131         { 0x0f08, _I386 }               // Actually a 486 only instruction 
    132 }; 
    133 PTRNTAB0 aptb0IRET[] =  /* IRET */ { 
    134         { 0xcf, _16_bit } 
    135 }; 
    136  
    137 PTRNTAB0 aptb0IRETD[] =  /* IRETD */ { 
    138         { 0xcf, _32_bit | _I386 } 
    139 }; 
    140  
    141 PTRNTAB0 aptb0LAHF[] =  /* LAHF */ { 
    142         { 0x9f, _modax } 
    143 }; 
    144  
    145 PTRNTAB0 aptb0LEAVE[] =  /* LEAVE */ { 
    146         { 0xc9, _I386 } 
    147 }; 
    148  
    149 PTRNTAB0 aptb0LOCK[] =  /* LOCK */ { 
    150         { 0xf0, 0 } 
    151 }; 
    152  
    153 PTRNTAB0 aptb0LODSB[] =  /* LODSB */ { 
    154         { 0xac, _modsiax } 
    155 }; 
    156  
    157 PTRNTAB0 aptb0LODSW[] =  /* LODSW */ { 
    158         { 0xad, _16_bit | _modsiax } 
    159 }; 
    160  
    161 PTRNTAB0 aptb0LODSD[] =  /* LODSD */ { 
    162         { 0xad, _32_bit | _I386 | _modsiax  } 
    163 }; 
    164  
    165 PTRNTAB0 aptb0MOVSB[] =  /* MOVSB */ { 
    166         { 0xa4, _modsidi} 
    167 }; 
    168  
    169 PTRNTAB0 aptb0MOVSW[] =  /* MOVSW */ { 
    170         { 0xa5, _16_bit | _modsidi } 
    171 }; 
     35#define OPTABLE0(str,op,mod) PTRNTAB0 aptb0##str[] = { { op, mod }, }; 
     36 
     37OPTABLE0(AAA,     0x37,_modax); 
     38OPTABLE0(AAD,     0xd50a,_modax); 
     39OPTABLE0(AAM,     0xd40a,_modax); 
     40OPTABLE0(AAS,     0x3f,_modax); 
     41OPTABLE0(CBW,     0x98,_16_bit | _modax); 
     42OPTABLE0(CWDE,    0x98,_32_bit | _I386 | _modax); 
     43OPTABLE0(CDQE,    0x98,_64_bit | _modax); 
     44OPTABLE0(CLC,     0xf8,0); 
     45OPTABLE0(CLD,     0xfc,0); 
     46OPTABLE0(CLI,     0xfa,0); 
     47OPTABLE0(CLTS,    0x0f06,0); 
     48OPTABLE0(CMC,     0xf5,0); 
     49OPTABLE0(CMPSB,   0xa6,_modsidi); 
     50OPTABLE0(CMPSW,   0xa7,_16_bit | _modsidi); 
     51//OPTABLE0(CMPSD, 0xa7,_32_bit | _I386 | _modsidi); 
     52OPTABLE0(CMPSQ,   0xa7,_64_bit | _modsidi); 
     53OPTABLE0(CWD,     0x99, _16_bit | _modaxdx); 
     54OPTABLE0(CDQ,     0x99,_32_bit | _I386 | _modaxdx); 
     55OPTABLE0(CQO,     0x99, _64_bit | _modaxdx); 
     56OPTABLE0(DAA,     0x27,_modax); 
     57OPTABLE0(DAS,     0x2f,_modax); 
     58OPTABLE0(HLT,     0xf4,0); 
     59OPTABLE0(INSB,    0x6c,_I386 | _modsi); 
     60OPTABLE0(INSW,    0x6d,_16_bit | _I386 | _modsi); 
     61OPTABLE0(INSD,    0x6d,_32_bit | _I386 | _modsi); 
     62OPTABLE0(INTO,    0xce,0); 
     63OPTABLE0(INVD,    0x0f08,_I386);               // Actually a 486 only instruction 
     64OPTABLE0(IRET,    0xcf,_16_bit); 
     65OPTABLE0(IRETD,   0xcf,_32_bit | _I386); 
     66OPTABLE0(LAHF,    0x9f,_modax); 
     67OPTABLE0(LEAVE,   0xc9,_I386); 
     68OPTABLE0(LOCK,    0xf0,0); 
     69OPTABLE0(LODSB,   0xac,_modsiax); 
     70OPTABLE0(LODSW,   0xad,_16_bit | _modsiax); 
     71OPTABLE0(LODSD,   0xad,_32_bit | _I386 | _modsiax); 
     72OPTABLE0(LODSQ,   0xad,_64_bit | _modsiax); 
     73OPTABLE0(MOVSB,   0xa4, _modsidi); 
     74OPTABLE0(MOVSW,   0xa5, _16_bit | _modsidi); 
     75OPTABLE0(MOVSQ,   0xa5, _64_bit | _modsidi); 
     76OPTABLE0(NOP,     0x90, 0); 
     77OPTABLE0(OUTSB,   0x6e, _I386 | _modsi); 
     78OPTABLE0(OUTSW,   0x6f, _16_bit | _I386 | _modsi); 
     79OPTABLE0(OUTSD,   0x6f, _32_bit | _I386 | _modsi); 
     80OPTABLE0(POPA,    0x61, _16_bit | _I386 | _modall); 
     81OPTABLE0(POPAD,   0x61, _32_bit | _I386 | _modall); 
     82OPTABLE0(POPF,    0x9d, _16_bit); 
     83OPTABLE0(POPFD,   0x9d, _32_bit | _I386); 
     84OPTABLE0(PUSHA,   0x60, _16_bit | _I386); 
     85OPTABLE0(PUSHAD,  0x60, _32_bit | _I386); 
     86OPTABLE0(PUSHF,   0x9c, _16_bit); 
     87OPTABLE0(PUSHFD,  0x9c, _32_bit | _I386); 
     88OPTABLE0(REP,     0xf3, _modcx); 
     89OPTABLE0(REPNE,   0xf2, _modcx); 
     90OPTABLE0(SAHF,    0x9e, 0); 
     91OPTABLE0(SCASB,   0xAE, _moddi); 
     92OPTABLE0(SCASW,   0xAF, _16_bit | _moddi); 
     93OPTABLE0(SCASD,   0xAF, _32_bit | _I386 | _moddi); 
     94OPTABLE0(SCASQ,   0xAF, _64_bit | _moddi); 
     95OPTABLE0(STC,     0xf9, 0); 
     96OPTABLE0(STD,     0xfd, 0); 
     97OPTABLE0(STI,     0xfb, 0); 
     98OPTABLE0(STOSB,   0xaa, _moddi); 
     99OPTABLE0(STOSW,   0xAB, _16_bit | _moddi); 
     100OPTABLE0(STOSD,   0xAB, _32_bit | _I386 | _moddi); 
     101OPTABLE0(STOSQ,   0xAB, _64_bit | _moddi); 
     102OPTABLE0(WAIT,    0x9B, 0); 
     103OPTABLE0(WBINVD,  0x0f09, _I386);                        // Really a 486 opcode 
     104OPTABLE0(XLATB,   0xd7, _modax); 
     105OPTABLE0(CPUID,   0x0fa2, _I386 | _modall); 
     106OPTABLE0(RDMSR,   0x0f32, _I386 | _modaxdx); 
     107OPTABLE0(RDPMC,   0x0f33, _I386 | _modaxdx); 
     108OPTABLE0(RDTSC,   0x0f31, _I386 | _modaxdx); 
     109OPTABLE0(WRMSR,   0x0f30, _I386); 
     110OPTABLE0(RSM,     0x0faa,   _I386); 
    172111 
    173112PTRNTAB2 aptb2MOVSD[] =  /* MOVSD */ { 
    174113        { 0xa5, _32_bit | _I386 | _modsidi }, 
    175114        { 0xF20F10, _r, _xmm, _xmm_m64 }, 
    176115        { 0xF20F11, _r, _xmm_m64, _xmm }, 
    177116}; 
    178117 
    179 PTRNTAB0 aptb0NOP[] =  /* NOP */ { 
    180         { 0x90, 0 } 
    181 }; 
    182  
    183 PTRNTAB0 aptb0OUTSB[] =  /* OUTSB */ { 
    184         { 0x6e, _I386 | _modsi } 
    185 }; 
    186  
    187 PTRNTAB0 aptb0OUTSW[] =  /* OUTSW */ { 
    188         { 0x6f, _16_bit | _I386 | _modsi } 
    189 }; 
    190  
    191 PTRNTAB0 aptb0OUTSD[] =  /* OUTSD */ { 
    192         { 0x6f, _32_bit | _I386 | _modsi } 
    193 }; 
    194  
    195 PTRNTAB0 aptb0POPA[] =  /* POPA */ { 
    196         { 0x61, _16_bit | _I386 | _modall } 
    197 }; 
    198  
    199 PTRNTAB0 aptb0POPAD[] =  /* POPAD */ { 
    200         { 0x61, _32_bit | _I386 | _modall } 
    201 }; 
    202  
    203 PTRNTAB0 aptb0POPF[] =  /* POPF */ { 
    204         { 0x9d, _16_bit } 
    205 }; 
    206  
    207 PTRNTAB0 aptb0POPFD[] =  /* POPFD */ { 
    208         { 0x9d, _32_bit | _I386 } 
    209 }; 
    210  
    211 PTRNTAB0 aptb0PUSHA[] =  /* PUSHA */ { 
    212         { 0x60, _16_bit | _I386 } 
    213 }; 
    214  
    215 PTRNTAB0 aptb0PUSHAD[] =  /* PUSHAD */ { 
    216         { 0x60, _32_bit | _I386 } 
    217 }; 
    218  
    219 PTRNTAB0 aptb0PUSHF[]= /* PUSHF */ { 
    220         {0x9c, _16_bit } 
    221 }; 
    222  
    223 PTRNTAB0 aptb0PUSHFD[] =  /* PUSHFD */ { 
    224         { 0x9c, _32_bit | _I386 } 
    225 }; 
    226  
    227 PTRNTAB0 aptb0REP[] = /* REP */ { 
    228         { 0xf3, _modcx } 
    229 }; 
    230  
    231 PTRNTAB0 aptb0REPNE[] = /* REPNE */ { 
    232         { 0xf2, _modcx } 
    233 }; 
    234  
    235 PTRNTAB0 aptb0SAHF[] = /* SAHF */ { 
    236         { 0x9e, 0 } 
    237 }; 
    238  
    239 PTRNTAB0 aptb0SCASB[] = /* SCASB */ { 
    240         { 0xAE, _moddi } 
    241 }; 
    242  
    243 PTRNTAB0 aptb0SCASW[] = /* SCASW */ { 
    244         { 0xAF, _16_bit | _moddi} 
    245 }; 
    246  
    247 PTRNTAB0 aptb0SCASD[] = /* SCASD */ { 
    248         { 0xAF, _32_bit | _I386 | _moddi } 
    249 }; 
    250  
    251 PTRNTAB0 aptb0STC[] = /* STC */ { 
    252         { 0xf9, 0 } 
    253 }; 
    254  
    255 PTRNTAB0 aptb0STD[] = /* STD */ { 
    256         { 0xfd, 0 } 
    257 }; 
    258  
    259 PTRNTAB0 aptb0STI[] = /* STI */ { 
    260         { 0xfb, 0 } 
    261 }; 
    262 PTRNTAB0 aptb0STOSB[] = /* STOSB */ { 
    263         { 0xaa, _moddi } 
    264 }; 
    265  
    266 PTRNTAB0 aptb0STOSW[] = /* STOSW */ { 
    267         { 0xAB, _16_bit | _moddi } 
    268 }; 
    269  
    270 PTRNTAB0 aptb0STOSD[] = /* STOSD */ { 
    271         { 0xAB, _32_bit | _I386 | _moddi } 
    272 }; 
    273  
    274 PTRNTAB0 aptb0WAIT[] = /* WAIT */ { 
    275         { 0x9B, 0 } 
    276 }; 
    277 PTRNTAB0 aptb0WBINVD[] = /* WBINVD */ { 
    278         { 0xf09, _I386 }                        // Really a 486 opcode 
    279 }; 
    280 PTRNTAB0 aptb0XLATB[] = /* XLATB */ { 
    281         { 0xd7, _modax } 
    282 }; 
    283 PTRNTAB0 aptb0CPUID[] = { 
    284     { 0x0fa2, _I386 | _modall } 
    285 }; 
    286  
    287 PTRNTAB0 aptb0RDMSR[] = { 
    288     { 0x0f32, _I386 | _modaxdx } 
    289 }; 
    290  
    291 PTRNTAB0 aptb0RDPMC[] = { 
    292     { 0x0f33, _I386 | _modaxdx } 
    293 }; 
    294  
    295 PTRNTAB0 aptb0RDTSC[] = { 
    296     { 0x0f31, _I386 | _modaxdx } 
    297 }; 
    298  
    299 PTRNTAB0 aptb0WRMSR[] = { 
    300     { 0x0f30, _I386 } 
    301 }; 
    302  
    303 PTRNTAB0 aptb0RSM[] = { 
    304     { 0x0faa,   _I386 } 
    305 }; 
    306118// 
    307119// Now come the one operand instructions 
    308120// These will prove to be a little more challenging than the 0 
    309121// operand instructions 
    310122// 
    311123PTRNTAB1 aptb1BSWAP[] = /* BSWAP */ { 
    312124                                // Really is a 486 only instruction 
    313125        { 0x0fc8, _I386, _plus_r | _r32 }, 
    314126        { ASM_END, 0, 0 } 
    315127}; 
    316128 
    317129PTRNTAB1 aptb1CALL[] = /* CALL */ { 
    318130        { 0xe8, _cw | _modall , _rel16  }, 
    319131        { 0xff, _2 | _16_bit | _modall, _r16 }, 
    320132        { 0xff, _2 | _modall ,  _m16 }, 
    321133        { 0x9a, _cd | _modall , _p1616  }, 
    322134        { 0xff, _3 | _modall ,  _m1616  }, 
    323135        { 0xe8, _cd | _modall , _rel32  }, 
    324136        { 0xff, _2 | _32_bit | _modall ,        _r32  }, 
     137        { 0xff, _2 | _64_bit | _modall ,        _r64  }, 
    325138        { 0xff, _2 | _modall ,  _m32  }, 
     139        { 0xff, _2 | _64_bit | _modall ,  _m64  }, 
    326140        { 0x9a, _cp | _modall , _p1632 }, 
    327141        { 0xff, _3 | _modall ,  _m1632  }, 
    328142        { ASM_END, 0, 0 } 
    329143}; 
    330144 
    331145PTRNTAB1 aptb1DEC[] = /* DEC */ { 
    332146        { 0xfe, _1,             _rm8 }, 
    333147        { 0xff, _1 | _16_bit,           _m16 },         // Also _r16 synonym 
    334148        { 0xff, _1 | _32_bit,           _m32 },         // Also _r32 synonym 
     149        { 0xff, _1 | _64_bit,           _rm64 },        // Also _r64 synonym 
    335150        { 0x48, _rw | _16_bit,          _r16 | _plus_r }, 
    336151        { 0x48, _rw | _32_bit,          _r32 | _plus_r }, 
    337152        { ASM_END, 0, 0 } 
    338153}; 
    339154 
    340155PTRNTAB1 aptb1INC[] = /* INC */ { 
    341156        { 0xfe, _0,     _rm8 }, 
    342157        { 0xff, _0 | _16_bit,   _m16 },                 // Also _r16 synonym 
    343158        { 0xff, _0 | _32_bit,   _m32 },                 // Also _r32 synonym 
     159        { 0xff, _0 | _64_bit,   _rm64 },                // Also _r64 synonym 
    344160        { 0x40, _rw | _16_bit,_r16 | _plus_r }, 
    345161        { 0x40, _rd | _32_bit,_r32 | _plus_r }, 
    346162        { ASM_END, 0, 0 } 
    347163}; 
    348164// INT and INT 3 
    349165PTRNTAB1 aptb1INT[]= /* INT */ { 
    350166        { 0xcc, 3,              0 },    // The ulFlags here are meant to 
    351167                                        // be the value of the immediate 
    352168                                        // operand 
    353169        { 0xcd, 0,              _imm8 }, 
    354170        { ASM_END, 0, 0 } 
    355171}; 
    356172PTRNTAB1 aptb1INVLPG[] = /* INVLPG */ {         // 486 only instruction 
    357173        { 0x0f01,       _I386|_7, _m8 | _m16 | _m32 | _m48 }, 
    358174        { ASM_END, 0, 0 } 
    359175}; 
    360176 
    361 PTRNTAB1 aptb1JB[] = /* JB */ { 
    362         { 0x72, _cb,_rel8 }, 
    363         { 0x0f82,       _cw,_rel16 }, 
    364         { 0x0f82,       _cd,_rel32 }, 
    365         { ASM_END, 0, 0 } 
    366 }; 
    367 PTRNTAB1 aptb1JBE[] = /* JBE */ { 
    368         { 0x76, _cb,_rel8 }, 
    369         { 0x0f86,       _cw,_rel16 }, 
    370         { 0x0f86,       _cd,_rel32 }, 
    371         { ASM_END, 0, 0 } 
    372 }; 
     177#define OPTABLE(str,op) \ 
     178PTRNTAB1 aptb1##str[] = {               \ 
     179        { 0x70|op,   _cb,_rel8 },       \ 
     180        { 0x0f80|op, _cw,_rel16 },      \ 
     181        { 0x0f80|op, _cd,_rel32 },      \ 
     182        { ASM_END, 0, 0 }               \ 
     183
     184 
     185OPTABLE(JO,0); 
     186OPTABLE(JNO,1); 
     187OPTABLE(JB,2); 
     188OPTABLE(JNB,3); 
     189OPTABLE(JZ,4); 
     190OPTABLE(JNZ,5); 
     191OPTABLE(JBE,6); 
     192OPTABLE(JNBE,7); 
     193OPTABLE(JS,8); 
     194OPTABLE(JNS,9); 
     195OPTABLE(JP,0xA); 
     196OPTABLE(JNP,0xB); 
     197OPTABLE(JL,0xC); 
     198OPTABLE(JNL,0xD); 
     199OPTABLE(JLE,0xE); 
     200OPTABLE(JNLE,0xF); 
     201 
     202#undef OPTABLE 
     203 
    373204PTRNTAB1 aptb1JCXZ[] = /* JCXZ */ { 
    374205        { 0xe3, _cb | _16_bit_addr,_rel8 }, 
    375206        { ASM_END, 0, 0 } 
    376207}; 
    377208PTRNTAB1 aptb1JECXZ[] = /* JECXZ */ { 
    378209        { 0xe3, _cb | _32_bit_addr | _I386,_rel8 }, 
    379         { ASM_END, 0, 0 } 
    380 }; 
    381 PTRNTAB1 aptb1JZ[] = /* JZ */ { 
    382         { 0x74, _cb,_rel8 }, 
    383         { 0x0f84,       _cw,_rel16 }, 
    384         { 0x0f84,       _cd,_rel32 }, 
    385         { ASM_END, 0, 0 } 
    386 }; 
    387 PTRNTAB1 aptb1JL[] = /* JL */ { 
    388         { 0x7c, _cb,_rel8 }, 
    389         { 0x0f8c,       _cw,_rel16 }, 
    390         { 0x0f8c,       _cd,_rel32 }, 
    391         { ASM_END, 0, 0 } 
    392 }; 
    393 PTRNTAB1 aptb1JLE[] = /* JLE */ { 
    394         { 0x7e, _cb,_rel8 }, 
    395         { 0x0f8e,       _cw,_rel16 }, 
    396         { 0x0f8e,       _cd,_rel32 }, 
    397         { ASM_END, 0, 0 } 
    398 }; 
    399 PTRNTAB1 aptb1JNB[] = /* JNB */ { 
    400         { 0x73, _cb,_rel8 }, 
    401         { 0x0f83,       _cw,_rel16 }, 
    402         { 0x0f83,       _cd,_rel32 }, 
    403         { ASM_END, 0, 0 } 
    404 }; 
    405 PTRNTAB1 aptb1JNBE[] = /* JNBE */ { 
    406         { 0x77, _cb,_rel8 }, 
    407         { 0x0f87,       _cw,_rel16 }, 
    408         { 0x0f87,       _cd,_rel32 }, 
    409         { ASM_END, 0, 0 } 
    410 }; 
    411 PTRNTAB1 aptb1JNL[] = /* JNL */ { 
    412         { 0x7d, _cb,_rel8 }, 
    413         { 0x0f8d,       _cw,_rel16 }, 
    414         { 0x0f8d,       _cd,_rel32 }, 
    415         { ASM_END, 0, 0 } 
    416 }; 
    417 PTRNTAB1 aptb1JNLE[] = /* JNLE */ { 
    418         { 0x7f, _cb,_rel8 }, 
    419         { 0x0f8f,       _cw,_rel16 }, 
    420         { 0x0f8f,       _cd,_rel32 }, 
    421         { ASM_END, 0, 0 } 
    422 }; 
    423 PTRNTAB1 aptb1JNO[] = /* JNO */ { 
    424         { 0x71, _cb,_rel8 }, 
    425         { 0x0f81,       _cw,_rel16 }, 
    426         { 0x0f81,       _cd,_rel32 }, 
    427         { ASM_END, 0, 0 } 
    428 }; 
    429 PTRNTAB1 aptb1JNP[] = /* JNP */ { 
    430         { 0x7b, _cb,_rel8 }, 
    431         { 0x0f8b,       _cw,_rel16 }, 
    432         { 0x0f8b,       _cd,_rel32 }, 
    433         { ASM_END, 0, 0 } 
    434 }; 
    435 PTRNTAB1 aptb1JNS[] = /* JNS */ { 
    436         { 0x79, _cb,_rel8 }, 
    437         { 0x0f89,       _cw,_rel16 }, 
    438         { 0x0f89,       _cd,_rel32 }, 
    439         { ASM_END, 0, 0 } 
    440 }; 
    441 PTRNTAB1 aptb1JNZ[] = /* JNZ */ { 
    442         { 0x75, _cb,_rel8 }, 
    443         { 0x0f85,       _cw,_rel16 }, 
    444         { 0x0f85,       _cd,_rel32 }, 
    445         { ASM_END, 0, 0 } 
    446 }; 
    447 PTRNTAB1 aptb1JO[] = /* JO */ { 
    448         { 0x70, _cb,_rel8 }, 
    449         { 0x0f80,       _cw,_rel16 }, 
    450         { 0x0f80,       _cd,_rel32 }, 
    451         { ASM_END, 0, 0 } 
    452 }; 
    453 PTRNTAB1 aptb1JP[] = /* JP */ { 
    454         { 0x7a, _cb,_rel8 }, 
    455         { 0x0f8a,       _cw,_rel16 }, 
    456         { 0x0f8a,       _cd,_rel32 }, 
    457         { ASM_END, 0, 0 } 
    458 }; 
    459 PTRNTAB1 aptb1JS[] = /* JS */ { 
    460         { 0x78, _cb,_rel8 }, 
    461         { 0x0f88,       _cw,_rel16 }, 
    462         { 0x0f88,       _cd,_rel32 }, 
    463210        { ASM_END, 0, 0 } 
    464211}; 
    465212PTRNTAB1 aptb1JMP[] = /* JMP */ { 
    466213        { 0xe9, _cw,_rel16 }, 
    467214        { 0xe9, _cd,_rel32 }, 
    468215        { 0xeb, _cb,_rel8 }, 
    469216        { 0xff, _4 | _16_bit,   _rm16 }, 
    470217        { 0xea, _cd,_p1616 }, 
    471218        { 0xff, _5,     _m1616 }, 
    472219        { 0xff, _4 | _32_bit,   _rm32 }, 
    473220        { 0xea, _cp,_p1632 }, 
    474221        { 0xff, _5,     _m1632 }, 
    475222        { ASM_END, 0, 0 } 
    476223}; 
    477224PTRNTAB1 aptb1LGDT[] = /* LGDT */ { 
    478225        { 0x0f01,       _2,     _m48 }, 
    479226        { ASM_END, 0, 0 } 
    480227}; 
    481228PTRNTAB1 aptb1LIDT[] = /* LIDT */ { 
    482229        { 0x0f01,       _3,     _m48 }, 
    483230        { ASM_END, 0, 0 } 
    484231}; 
    485232PTRNTAB1 aptb1LLDT[] = /* LLDT */ { 
    486233        { 0x0f00,       _2|_modnot1,    _rm16 }, 
    487234        { ASM_END, 0, 0 } 
    488235}; 
    489236PTRNTAB1 aptb1LMSW[] = /* LMSW */ { 
    490237        { 0x0f01,       _6|_modnot1,    _rm16 }, 
    491238        { ASM_END, 0, 0 } 
    492239}; 
    493240PTRNTAB1 aptb1LODS[] = /* LODS */ { 
    494241        { 0xac, _modax,_m8 }, 
    495242        { 0xad, _16_bit | _modax,_m16 }, 
    496243        { 0xad, _32_bit | _I386 | _modax,_m32 }, 
    497244        { ASM_END, 0, 0 } 
    498245}; 
    499246PTRNTAB1 aptb1LOOP[] = /* LOOP */ { 
    500247        { 0xe2, _cb | _modcx,_rel8 }, 
    501248        { ASM_END, 0, 0 } 
    502249}; 
    503 PTRNTAB1 aptb1LOOPE[] = /* LOOPE */ { 
     250PTRNTAB1 aptb1LOOPE[] = /* LOOPE/LOOPZ */ { 
    504251        { 0xe1, _cb | _modcx,_rel8 }, 
    505252        { ASM_END, 0, 0 } 
    506253}; 
    507 PTRNTAB1 aptb1LOOPZ[] = /* LOOPZ */ { 
    508         { 0xe1, _cb | _modcx,_rel8 }, 
    509         { ASM_END, 0, 0 } 
    510 }; 
    511 PTRNTAB1 aptb1LOOPNE[] = /* LOOPNE */ { 
    512         { 0xe0, _cb | _modcx,_rel8 }, 
    513         { ASM_END, 0, 0 } 
    514 }; 
    515 PTRNTAB1 aptb1LOOPNZ[] = /* LOOPNZ */ { 
     254PTRNTAB1 aptb1LOOPNE[] = /* LOOPNE/LOOPNZ */ { 
    516255        { 0xe0, _cb | _modcx,_rel8 }, 
    517256        { ASM_END, 0, 0 } 
    518257}; 
    519258PTRNTAB1 aptb1LTR[] = /* LTR */ { 
    520259        { 0x0f00,       _3|_modnot1,    _rm16 }, 
    521260        { ASM_END, 0, 0 } 
    522261}; 
    523262PTRNTAB1 aptb1NEG[] = /* NEG */ { 
    524263        { 0xf6, _3,     _rm8 }, 
    525264        { 0xf7, _3 | _16_bit,   _rm16 }, 
    526265        { 0xf7, _3 | _32_bit,   _rm32 }, 
    527266        { 0xf7, _3 | _64_bit,   _rm64 }, 
    528267        { ASM_END, 0, 0 } 
    529268}; 
    530269PTRNTAB1 aptb1NOT[] = /* NOT */ { 
    531270        { 0xf6, _2,     _rm8 }, 
    532271        { 0xf7, _2 | _16_bit,   _rm16 }, 
    533272        { 0xf7, _2 | _32_bit,   _rm32 }, 
     273        { 0xf7, _2 | _64_bit,   _rm64 }, 
    534274        { ASM_END, 0, 0 } 
    535275}; 
    536276PTRNTAB1 aptb1POP[] = /* POP */ { 
    537277        { 0x8f, _0 | _16_bit, _m16 }, 
    538278        { 0x8f, _0 | _32_bit,   _m32}, 
    539279        { 0x58, _rw | _16_bit, _r16 | _plus_r }, 
    540280        { 0x58, _rd | _32_bit, _r32 | _plus_r }, 
    541281        { 0x58, _r | _64_bit,   _r64 | _plus_r }, 
    542282        { 0x1f, 0,      _ds | _seg }, 
    543283        { 0x07, _modes, _es | _seg}, 
    544284        { 0x17, 0,      _ss | _seg}, 
    545285        { 0x0fa1,       0,      _fs | _seg}, 
    546286        { 0x0fa9,       0,      _gs | _seg}, 
    547287        { ASM_END, 0, 0 } 
    548288}; 
    549289PTRNTAB1 aptb1PUSH[] = /* PUSH */ { 
    550290        { 0xff, _6 | _16_bit,   _m16 }, 
    551291        { 0xff, _6 | _32_bit,   _m32 }, 
    552292        { 0xff, _6 | _64_bit,   _m64 }, 
    553293        { 0x50, _r | _16_bit,   _r16 | _plus_r }, 
     
    566306        { 0x0fa8,       0,_gs | _seg}, 
    567307        { ASM_END, 0, 0 } 
    568308}; 
    569309PTRNTAB1 aptb1RET[] = /* RET */ { 
    570310        { 0xc3, 0,      0 }, 
    571311        { 0xc2, _iw,    _imm16 }, 
    572312        { ASM_END, 0, 0 } 
    573313}; 
    574314PTRNTAB1 aptb1RETF[] = /* RETF */ { 
    575315        { 0xcb, 0, 0 }, 
    576316        { 0xca, _iw, _imm16 }, 
    577317        { ASM_END, 0, 0 } 
    578318}; 
    579319PTRNTAB1 aptb1SCAS[] = /* SCAS */ { 
    580320        { 0xae, _moddi, _m8 }, 
    581321        { 0xaf, _16_bit | _moddi, _m16 }, 
    582322        { 0xaf, _32_bit | _moddi, _m32 }, 
    583323        { ASM_END, 0, 0 } 
    584324}; 
    585325 
    586 PTRNTAB1 aptb1SETB[] = /* SETB */ { 
    587         { 0xf92, _cb, _rm8 }, 
    588         { ASM_END, 0, 0 } 
    589 }; 
    590 PTRNTAB1  aptb1SETBE[] = /* SETBE */ { 
    591         { 0xf96, _cb, _rm8 }, 
    592         { ASM_END, 0, 0 } 
    593 }; 
    594 PTRNTAB1  aptb1SETL[] = /* SETL */ { 
    595         { 0xf9c, _cb, _rm8 }, 
    596         { ASM_END, 0, 0 } 
    597 }; 
    598 PTRNTAB1  aptb1SETLE[] = /* SETLE */ { 
    599         { 0xf9e, _cb, _rm8 }, 
    600         { ASM_END, 0, 0 } 
    601 }; 
    602 PTRNTAB1  aptb1SETNB[] = /* SETNB */ { 
    603         { 0xf93, _cb, _rm8 }, 
    604         { ASM_END, 0, 0 } 
    605 }; 
    606 PTRNTAB1  aptb1SETNBE[] = /* SETNBE */ { 
    607         { 0xf97, _cb, _rm8 }, 
    608         { ASM_END, 0, 0 } 
    609 }; 
    610 PTRNTAB1  aptb1SETNL[] = /* SETNL */ { 
    611         { 0xf9d, _cb, _rm8 }, 
    612         { ASM_END, 0, 0 } 
    613 }; 
    614 PTRNTAB1  aptb1SETNLE[] = /* SETNLE */ { 
    615         { 0xf9f, _cb, _rm8 }, 
    616         { ASM_END, 0, 0 } 
    617 }; 
    618 PTRNTAB1  aptb1SETNO[] = /* SETNO */ { 
    619         { 0xf91, _cb, _rm8 }, 
    620         { ASM_END, 0, 0 } 
    621 }; 
    622 PTRNTAB1  aptb1SETNP[] = /* SETNP */ { 
    623         { 0xf9b, _cb, _rm8 }, 
    624         { ASM_END, 0, 0 } 
    625 }; 
    626 PTRNTAB1  aptb1SETNS[] = /* SETNS */ { 
    627         { 0xf99, _cb, _rm8 }, 
    628         { ASM_END, 0, 0 } 
    629 }; 
    630 PTRNTAB1  aptb1SETNZ[] = /* SETNZ */ { 
    631         { 0xf95, _cb, _rm8 }, 
    632         { ASM_END, 0, 0 } 
    633 }; 
    634 PTRNTAB1  aptb1SETO[] = /* SETO */ { 
    635         { 0xf90, _cb, _rm8 }, 
    636         { ASM_END, 0, 0 } 
    637 }; 
    638 PTRNTAB1  aptb1SETP[] = /* SETP */ { 
    639         { 0xf9a, _cb, _rm8 }, 
    640         { ASM_END, 0, 0 } 
    641 }; 
    642 PTRNTAB1  aptb1SETS[] = /* SETS */ { 
    643         { 0xf98, _cb, _rm8 }, 
    644         { ASM_END, 0, 0 } 
    645 }; 
    646 PTRNTAB1  aptb1SETZ[] = /* SETZ */ { 
    647         { 0xf94, _cb, _rm8 }, 
    648         { ASM_END, 0, 0 } 
    649 }; 
     326#define OPTABLE(str,op) \ 
     327PTRNTAB1 aptb1##str[] = {       \ 
     328        { 0xf90|op, _cb, _rm8 },        \ 
     329        { ASM_END, 0, 0 }       \ 
     330
     331 
     332OPTABLE(SETO,0); 
     333OPTABLE(SETNO,1); 
     334OPTABLE(SETB,2); 
     335OPTABLE(SETNB,3); 
     336OPTABLE(SETZ,4); 
     337OPTABLE(SETNZ,5); 
     338OPTABLE(SETBE,6); 
     339OPTABLE(SETNBE,7); 
     340OPTABLE(SETS,8); 
     341OPTABLE(SETNS,9); 
     342OPTABLE(SETP,0xA); 
     343OPTABLE(SETNP,0xB); 
     344OPTABLE(SETL,0xC); 
     345OPTABLE(SETNL,0xD); 
     346OPTABLE(SETLE,0xE); 
     347OPTABLE(SETNLE,0xF); 
     348 
     349#undef OPTABLE 
     350 
    650351PTRNTAB1  aptb1SGDT[]= /* SGDT */ { 
    651352        { 0xf01, _0, _m48 }, 
    652353        { ASM_END, 0, 0 } 
    653354}; 
    654355PTRNTAB1  aptb1SIDT[] = /* SIDT */ { 
    655356        { 0xf01, _1, _m48 }, 
    656357        { ASM_END, 0, 0 } 
    657358}; 
    658359PTRNTAB1  aptb1SLDT[] = /* SLDT */ { 
    659360        { 0xf00, _0, _rm16 }, 
    660361        { ASM_END, 0, 0 } 
    661362}; 
    662363PTRNTAB1  aptb1SMSW[] = /* SMSW */ { 
    663364        { 0xf01, _4, _rm16 }, 
    664365        { 0xf01, _4, _r32 }, 
    665366        { ASM_END, 0, 0 } 
    666367}; 
    667368PTRNTAB1  aptb1STOS[] = /* STOS */ { 
    668369        { 0xaa, _moddi, _m8 }, 
    669370        { 0xab, _16_bit | _moddi, _m16 }, 
     
    674375        { 0xf00, _1, _rm16 }, 
    675376        { ASM_END, 0, 0 } 
    676377}; 
    677378PTRNTAB1  aptb1VERR[] = /* VERR */ { 
    678379        { 0xf00, _4|_modnot1, _rm16 }, 
    679380        { ASM_END, 0, 0 } 
    680381}; 
    681382PTRNTAB1  aptb1VERW[] = /* VERW */ { 
    682383        { 0xf00, _5|_modnot1, _rm16 }, 
    683384        { ASM_END, 0, 0 } 
    684385}; 
    685386PTRNTAB1  aptb1XLAT[] = /* XLAT */ { 
    686387        { 0xd7, _modax, 0 }, 
    687388        { 0xd7, _modax, _m8 }, 
    688389        { ASM_END, 0, 0 } 
    689390}; 
    690391PTRNTAB1  aptb1CMPXCH8B[] = { 
    691392    { 0x0fc7, _1 | _modaxdx | _I386 , _m64 }, 
    692393        { ASM_END, 0, 0 } 
    693394}; 
    694 PTRNTAB2  aptb2ADC[] = /* ADC */ { 
    695         { 0x14, _ib,                _al,                _imm8 }, 
    696         { 0x83, _2|_ib|_16_bit,     _rm16,      _imm8 }, 
    697         { 0x15, _iw|_16_bit,        _ax,                _imm16 }, 
    698         { 0x83, _2|_ib|_32_bit,     _rm32,  _imm8 }, 
    699         { 0x15, _id|_32_bit,        _eax,       _imm32 }, 
    700         { 0x80, _2|_ib,             _rm8,       _imm8 }, 
    701         { 0x81, _2|_iw|_16_bit,     _rm16,      _imm16 }, 
    702         { 0x81, _2|_id|_32_bit,     _rm32,  _imm32 }, 
    703         { 0x10, _r,                 _rm8,       _r8 }, 
    704         { 0x11, _r|_16_bit,         _rm16,      _r16 }, 
    705         { 0x11, _r|_32_bit,         _rm32,      _r32 }, 
    706         { 0x12, _r,                 _r8,        _rm8 }, 
    707         { 0x13, _r|_16_bit,         _r16,       _rm16 }, 
    708         { 0x13, _r|_32_bit,         _r32,       _rm32 }, 
    709         { ASM_END, 0, 0, 0 } 
    710 }; 
    711 PTRNTAB2  aptb2ADD[] = /* ADD */ { 
    712         { 0x04, _ib,            _al,    _imm8 }, 
    713         { 0x83, _0|_ib|_16_bit, _rm16,  _imm8 }, 
    714         { 0x05, _iw | _16_bit,  _ax,    _imm16 }, 
    715         { 0x83, _0|_ib|_32_bit, _rm32,  _imm8 }, 
    716         { 0x05, _id | _32_bit,  _eax,   _imm32 }, 
    717         { 0x80, _0|_ib,         _rm8,   _imm8 }, 
    718         { 0x81, _0|_iw|_16_bit, _rm16,  _imm16 }, 
    719         { 0x81, _0|_id|_32_bit, _rm32,  _imm32 }, 
    720         { 0x00, _r,             _rm8,   _r8 }, 
    721         { 0x01, _r|_16_bit,     _rm16,  _r16 }, 
    722         { 0x01, _r|_32_bit,     _rm32,  _r32 }, 
    723         { 0x2,  _r,             _r8,    _rm8 }, 
    724         { 0x3,  _r|_16_bit,     _r16,   _rm16 }, 
    725         { 0x3,  _r|_32_bit,     _r32,   _rm32 }, 
    726         { ASM_END, 0, 0, 0 } 
    727 }; 
    728  
    729 PTRNTAB2  aptb2AND[] = /* AND */ { 
    730         { 0x24, _ib,            _al,    _imm8 }, 
    731         { 0x83, _4|_ib|_16_bit, _rm16,  _imm8 }, 
    732         { 0x25, _iw|_16_bit,    _ax,    _imm16 }, 
    733         { 0x83, _4|_ib|_32_bit, _rm32,  _imm8 }, 
    734         { 0x25, _id|_32_bit,    _eax,   _imm32 }, 
    735         { 0x80, _4|_ib,         _rm8,   _imm8 }, 
    736         { 0x81, _4|_iw|_16_bit, _rm16,  _imm16 }, 
    737         { 0x81, _4|_id|_32_bit, _rm32,  _imm32 }, 
    738         { 0x20, _r,             _rm8,   _r8 }, 
    739         { 0x21, _r|_16_bit,     _rm16,  _r16 }, 
    740         { 0x21, _r|_32_bit,     _rm32,  _r32 }, 
    741         { 0x22, _r,             _r8,    _rm8 }, 
    742         { 0x23, _r|_16_bit,     _r16,   _rm16 }, 
    743         { 0x23, _r|_32_bit,     _r32,   _rm32 }, 
    744         { ASM_END, 0, 0, 0 } 
    745 }; 
     395 
     396#define OPTABLE(str,op,rr,m) \ 
     397PTRNTAB2  aptb2##str[] = {                                      \ 
     398        { op+4,  _ib|m,                _al,        _imm8 },     \ 
     399        { 0x83, rr|_ib|_16_bit|m,     _rm16,      _imm8 },      \ 
     400        { op+5, _iw|_16_bit|m,        _ax,        _imm16 },     \ 
     401        { 0x83, rr|_ib|_32_bit|m,     _rm32,      _imm8 },      \ 
     402        { 0x83, rr|_ib|_64_bit|m,     _rm64,      _imm8 },      \ 
     403        { op+5, _id|_32_bit|m,        _eax,       _imm32 },     \ 
     404        { op+5, _id|_64_bit|m,        _rax,       _imm32 },     \ 
     405        { 0x80, rr|_ib|m,             _rm8,       _imm8 },      \ 
     406        { 0x81, rr|_iw|_16_bit|m,     _rm16,      _imm16 },     \ 
     407        { 0x81, rr|_id|_32_bit|m,     _rm32,      _imm32 },     \ 
     408        { 0x81, rr|_id|_64_bit|m,     _rm64,      _imm32 },     \ 
     409        { op+0, _r|m,                 _rm8,       _r8 },        \ 
     410        { op+1, _r|_16_bit|m,         _rm16,      _r16 },       \ 
     411        { op+1, _r|_32_bit|m,         _rm32,      _r32 },       \ 
     412        { op+1, _r|_64_bit|m,         _rm64,      _r64 },       \ 
     413        { op+2, _r|m,                 _r8,        _rm8 },       \ 
     414        { op+3, _r|_16_bit|m,         _r16,       _rm16 },      \ 
     415        { op+3, _r|_32_bit|m,         _r32,       _rm32 },      \ 
     416        { op+3, _r|_64_bit|m,         _r64,       _rm64 },      \ 
     417        { ASM_END, 0, 0, 0 }                                    \ 
     418
     419 
     420OPTABLE(ADD,0x00,_0,0); 
     421OPTABLE(OR, 0x08,_1,0); 
     422OPTABLE(ADC,0x10,_2,0); 
     423OPTABLE(SBB,0x18,_3,0); 
     424OPTABLE(AND,0x20,_4,0); 
     425OPTABLE(SUB,0x28,_5,0); 
     426OPTABLE(XOR,0x30,_6,0); 
     427OPTABLE(CMP,0x38,_7,_modnot1); 
     428 
     429#undef OPTABLE 
     430 
    746431PTRNTAB2  aptb2ARPL[] = /* ARPL */ { 
    747432        { 0x63, _r,                     _rm16,  _r16 }, 
    748433        { ASM_END, 0, 0, 0 } 
    749434}; 
    750435PTRNTAB2  aptb2BOUND[] = /* BOUND */ { 
    751436        { 0x62, _r|_16_bit|_modnot1,_r16,_m16 },// Should really b3 _m16_16 
    752437        { 0x62, _r|_32_bit|_modnot1,_r32,_m32 },// Should really be _m32_32 
    753438        { ASM_END, 0, 0, 0 } 
    754439}; 
    755440PTRNTAB2  aptb2BSF[] = /* BSF */ { 
    756441        { 0x0fbc,       _cw | _16_bit,          _r16,   _rm16 }, 
    757442        { 0x0fbc,       _cd|_32_bit,            _r32,   _rm32 }, 
     443        { 0x0fbc,       _cd|_64_bit,            _r64,   _rm64 }, 
    758444        { ASM_END, 0, 0, 0 } 
    759445}; 
    760446PTRNTAB2  aptb2BSR[] = /* BSR */ { 
    761447        { 0x0fbd,       _cw|_16_bit,            _r16,   _rm16 }, 
    762448        { 0x0fbd,       _cd|_32_bit,            _r32,   _rm32 }, 
     449        { 0x0fbd,       _cd|_64_bit,            _r64,   _rm64 }, 
    763450        { ASM_END, 0, 0, 0 } 
    764451}; 
    765452PTRNTAB2  aptb2BT[] = /* BT */ { 
    766453        { 0x0fa3,       _cw|_16_bit|_modnot1,           _rm16,  _r16 }, 
    767454        { 0x0fa3,       _cd|_32_bit|_modnot1,           _rm32,  _r32 }, 
     455        { 0x0fa3,       _cd|_64_bit|_modnot1,           _rm64,  _r64 }, 
    768456        { 0x0fba,       _4|_ib|_16_bit|_modnot1,        _rm16,  _imm8 }, 
    769457        { 0x0fba,       _4|_ib|_32_bit|_modnot1,        _rm32,  _imm8 }, 
     458        { 0x0fba,       _4|_ib|_64_bit|_modnot1,        _rm64,  _imm8 }, 
    770459        { ASM_END, 0, 0, 0 } 
    771460}; 
    772461PTRNTAB2  aptb2BTC[] = /* BTC */ { 
    773462        { 0x0fbb,       _cw|_16_bit,            _rm16,  _r16 }, 
    774463        { 0x0fbb,       _cd|_32_bit,            _rm32,  _r32 }, 
     464        { 0x0fbb,       _cd|_64_bit,            _rm64,  _r64 }, 
    775465        { 0x0fba,       _7|_ib|_16_bit, _rm16,  _imm8 }, 
    776466        { 0x0fba,       _7|_ib|_32_bit, _rm32,  _imm8 }, 
     467        { 0x0fba,       _7|_ib|_64_bit, _rm64,  _imm8 }, 
    777468        { ASM_END, 0, 0, 0 } 
    778469}; 
    779470PTRNTAB2  aptb2BTR[] = /* BTR */ { 
    780471        { 0x0fb3,       _cw|_16_bit,            _rm16,  _r16 }, 
    781472        { 0x0fb3,       _cd|_32_bit,            _rm32,  _r32 }, 
     473        { 0x0fb3,       _cd|_64_bit,            _rm64,  _r64 }, 
    782474        { 0x0fba,       _6|_ib|_16_bit,         _rm16,  _imm8 }, 
    783475        { 0x0fba,       _6|_ib|_32_bit,         _rm32,  _imm8 }, 
     476        { 0x0fba,       _6|_ib|_64_bit,         _rm64,  _imm8 }, 
    784477        { ASM_END, 0, 0, 0 } 
    785478}; 
    786479PTRNTAB2  aptb2BTS[] = /* BTS */ { 
    787480        { 0x0fab,       _cw|_16_bit,            _rm16,  _r16 }, 
    788481        { 0x0fab,       _cd|_32_bit,            _rm32,  _r32 }, 
     482        { 0x0fab,       _cd|_64_bit,            _rm64,  _r64 }, 
    789483        { 0x0fba,       _5|_ib|_16_bit,         _rm16,  _imm8 }, 
    790484        { 0x0fba,       _5|_ib|_32_bit,         _rm32,  _imm8 }, 
    791         { ASM_END, 0, 0, 0 } 
    792 }; 
    793 PTRNTAB2  aptb2CMP[] = /* CMP */ { 
    794         { 0x3c, _ib|_modnot1,           _al,    _imm8 }, 
    795         { 0x83, _7|_ib|_16_bit|_modnot1,        _rm16,  _imm8 }, 
    796         { 0x3d, _iw|_16_bit|_modnot1,   _ax,    _imm16 }, 
    797         { 0x83, _7|_ib|_32_bit|_modnot1,        _rm32,  _imm8 }, 
    798         { 0x3d, _id|_32_bit|_modnot1,   _eax,   _imm32 }, 
    799         { 0x80, _7|_ib|_modnot1,                _rm8,   _imm8 }, 
    800         { 0x81, _7|_iw|_16_bit|_modnot1,        _rm16,  _imm16 }, 
    801         { 0x81, _7|_id|_32_bit|_modnot1,        _rm32,  _imm32 }, 
    802         { 0x38, _r|_modnot1,            _rm8,   _r8 }, 
    803         { 0x39, _r|_16_bit|_modnot1,    _rm16,  _r16 }, 
    804         { 0x39, _r|_32_bit|_modnot1,    _rm32,  _r32 }, 
    805         { 0x3a, _r|_modnot1,            _r8,    _rm8 }, 
    806         { 0x3b, _r|_16_bit|_modnot1,    _r16,   _rm16 }, 
    807         { 0x3b, _r|_32_bit|_modnot1,    _r32,   _rm32 }, 
     485        { 0x0fba,       _5|_ib|_64_bit,         _rm64,  _imm8 }, 
    808486        { ASM_END, 0, 0, 0 } 
    809487}; 
    810488PTRNTAB2  aptb2CMPS[] = /* CMPS */ { 
    811489        { 0xa6, _modsidi,               _m8,    _m8 }, 
    812490        { 0xa7, _modsidi,       _m16,   _m16 }, 
    813491        { 0xa7, _modsidi,       _m32,   _m32 }, 
    814492        { ASM_END, 0, 0, 0 } 
    815493}; 
    816494PTRNTAB2  aptb2CMPXCHG[] = /* CMPXCHG */ { 
    817495        { 0xfb0, _I386 | _cb|_mod2,     _rm8,   _r8 }, 
    818496                                                // This is really a 486 only 
    819497                                                // instruction 
    820498        { 0xfb1, _I386 | _cw | _16_bit|_mod2,   _rm16,  _r16 }, 
    821499        { 0xfb1, _I386 | _cd | _32_bit|_mod2,   _rm32,  _r32 }, 
    822500        { 0xfb1, _I386 | _cq | _64_bit|_mod2,   _rm64,  _r64 }, 
    823501        { ASM_END, 0, 0, 0 } 
    824502}; 
    825503PTRNTAB2  aptb2DIV[] = /* DIV */ { 
    826504        { 0xf6, _6,                             _al,            _rm8 }, 
    827505        { 0xf7, _6 | _16_bit | _moddx,          _ax,            _rm16 }, 
     
    913591        { 0xa0, 0,              _al,            _moffs8         }, 
    914592        { 0xa1, _16_bit,        _ax,            _moffs16        }, 
    915593        { 0xa1, _32_bit,        _eax,           _moffs32        }, 
    916594        { 0xa2, 0,              _moffs8,        _al             }, 
    917595        { 0xa3, _16_bit,        _moffs16,       _ax             }, 
    918596        { 0xa3, _32_bit,        _moffs32,       _eax            }, 
    919597#endif 
    920598        { 0x88, _r,             _rm8,           _r8             }, 
    921599        { 0x89, _r|_16_bit,     _rm16,          _r16            }, 
    922600        { 0x89, _r|_32_bit,     _rm32,          _r32            }, 
    923601        { 0x89, _r|_64_bit,     _rm64,          _r64            }, 
    924602        { 0x8a, _r,             _r8,            _rm8            }, 
    925603        { 0x8b, _r|_16_bit,     _r16,           _rm16           }, 
    926604        { 0x8b, _r|_32_bit,     _r32,           _rm32           }, 
    927605        { 0x8b, _r|_64_bit,     _r64,           _rm64           }, 
    928606        { 0x8c, _r,             _rm16,          _seg|_ds|_es| _ss | _fs | _gs | _cs }, 
    929607        { 0x8e, _r,             _seg|_ds|_es|_ss|_fs|_gs|_cs,   _rm16 }, 
    930608        { 0xb0, _rb,            _r8 | _plus_r,  _imm8           }, 
    931609        { 0xb8, _rw | _16_bit,  _r16 | _plus_r, _imm16          }, 
    932610        { 0xb8, _rd|_32_bit,    _r32 | _plus_r, _imm32          }, 
     611        { 0xb8, _rd|_64_bit,    _r64 | _plus_r, _imm32          }, 
    933612        { 0xc6, _cb,            _rm8,           _imm8           }, 
    934613        { 0xc7, _cw|_16_bit,    _rm16,          _imm16          }, 
    935614        { 0xc7, _cd|_32_bit,    _rm32,          _imm32          }, 
    936615#if 0 // Let pinholeopt() do this 
    937616        { 0xc6, _cb,            _moffs8,        _imm8           }, 
    938617        { 0xc7, _cw|_16_bit,    _moffs16,       _imm16          }, 
    939618        { 0xc7, _cd|_32_bit,    _moffs32,       _imm32          }, 
    940619#endif 
    941620        { 0x0f20,       _r,     _r32,           _special | _crn }, 
    942621        { 0x0f22,       _r,     _special|_crn,  _r32            }, 
    943622        { 0x0f21,       _r,     _r32,           _special | _drn }, 
    944623        { 0x0f23,       _r,     _special|_drn,  _r32            }, 
    945624        { 0x0f24,       _r,     _r32,           _special | _trn }, 
    946625        { 0x0f26,       _r,     _special|_trn,  _r32            }, 
    947626        { ASM_END, 0, 0, 0 } 
    948627}; 
    949628 
    950629PTRNTAB2  aptb2MOVS[] = { 
    951630        { 0xa4, _modsidi ,              _m8,    _m8 }, 
    952631        { 0xa5, _modsidi | _16_bit,     _m16,   _m16 }, 
     
    969648        { 0x0fb6,       _r|_32_bit,                     _r32,   _rm8 }, 
    970649#if 1 
    971650        { 0x0fb7,       _r|_16_bit,             _r16,   _rm16 }, 
    972651        { 0x0fb7,       _r|_32_bit,             _r32,   _rm16 }, 
    973652#else 
    974653        { 0x0fb7,       _r,                     _r32,   _rm16 }, 
    975654#endif 
    976655        { ASM_END, 0, 0, 0 } 
    977656}; 
    978657PTRNTAB2  aptb2MUL[] = /* MUL */ { 
    979658        { 0xf6, _4,                     _al,    _rm8 }, 
    980659        { 0xf7, _4|_16_bit|_moddx,      _ax,    _rm16 }, 
    981660        { 0xf7, _4|_32_bit|_moddx,      _eax,   _rm32 }, 
    982661        { 0xf7, _4|_64_bit|_moddx,      _rax,   _rm64 }, 
    983662        { 0xf6, _4|_modax,              _rm8,   0 }, 
    984663        { 0xf7, _4|_16_bit|_modaxdx,    _rm16,  0 }, 
    985664        { 0xf7, _4|_32_bit|_modaxdx,    _rm32,  0 }, 
    986665        { 0xf7, _4|_64_bit|_modaxdx,    _rm64,  0 }, 
    987666        { ASM_END, 0, 0, 0 } 
    988667}; 
    989 PTRNTAB2  aptb2OR[] = /* OR */ { 
    990         { 0x0c, _ib,            _al,    _imm8 }, 
    991         { 0x83, _1|_ib|_16_bit,         _rm16,  _imm8 }, 
    992         { 0x0d, _iw|_16_bit,            _ax,    _imm16 }, 
    993         { 0x83, _1|_ib|_32_bit,         _rm32,  _imm8 }, 
    994         { 0x0d, _id|_32_bit,            _eax,   _imm32 }, 
    995         { 0x80, _1|_ib,         _rm8,   _imm8 }, 
    996         { 0x81, _1|_iw|_16_bit,         _rm16,  _imm16 }, 
    997         { 0x81, _1|_id|_32_bit,         _rm32,  _imm32 }, 
    998         { 0x08, _r,                     _rm8,   _r8 }, 
    999         { 0x09, _r|_16_bit,                     _rm16,  _r16 }, 
    1000         { 0x09, _r|_32_bit,                     _rm32,  _r32 }, 
    1001         { 0x0a, _r,                     _r8,    _rm8 }, 
    1002         { 0x0b, _r|_16_bit,                     _r16,   _rm16 }, 
    1003         { 0x0b, _r|_32_bit,                     _r32,   _rm32 }, 
    1004         { ASM_END, 0, 0, 0 } 
    1005 }; 
    1006668PTRNTAB2  aptb2OUT[] = { 
    1007669        { 0xe6, _ib,            _imm8,  _al }, 
    1008670        { 0xe7, _ib|_16_bit,            _imm8,  _ax }, 
    1009671        { 0xe7, _ib|_32_bit,            _imm8,  _eax }, 
    1010672        { 0xee, _modnot1,               _dx,            _al }, 
    1011673        { 0xef, _16_bit|_modnot1,               _dx,            _ax }, 
    1012674        { 0xef, _32_bit|_modnot1,               _dx,            _eax }, 
    1013675        { ASM_END, 0, 0, 0 } 
    1014676}; 
    1015677PTRNTAB2  aptb2OUTS[] = /* OUTS */ { 
    1016678        { 0x6e, _modsinot1,             _dx,            _rm8 }, 
    1017679        { 0x6f, _16_bit | _I386 |_modsinot1,    _dx,            _rm16 }, 
    1018680        { 0x6f, _32_bit | _I386| _modsinot1,    _dx,            _rm32 }, 
    1019681        { ASM_END, 0, 0, 0 } 
    1020682}; 
    1021 PTRNTAB2  aptb2RCL[] = /* RCL */{ 
    1022 //      { 0xd0, _2,                     _rm8,   0 }, 
    1023         { 0xd2, _2,                     _rm8,   _cl }, 
    1024         { 0xc0, _2|_ib,         _rm8,   _imm8 }, 
    1025 //      { 0xd1, _2|_16_bit,                     _rm16,  0 }, 
    1026         { 0xd3, _2|_16_bit,                     _rm16,  _cl }, 
    1027         { 0xc1, _2|_ib|_16_bit,         _rm16,  _imm8 }, 
    1028 //      { 0xd1, _2|_32_bit,                     _rm32,  0 }, 
    1029         { 0xd3, _2|_32_bit,                     _rm32,  _cl }, 
    1030         { 0xc1, _2|_ib|_32_bit,         _rm32,  _imm8, }, 
    1031         { ASM_END, 0, 0, 0 } 
    1032 }; 
    1033 PTRNTAB2  aptb2RCR[] = /* RCR */ { 
    1034 //      { 0xd0, _3,                     _rm8,   0 }, 
    1035         { 0xd2, _3,                     _rm8,   _cl }, 
    1036         { 0xc0, _3|_ib,         _rm8,   _imm8 }, 
    1037 //      { 0xd1, _3|_16_bit,                     _rm16,  0 }, 
    1038         { 0xd3, _3|_16_bit,                     _rm16,  _cl }, 
    1039         { 0xc1, _3|_ib|_16_bit,         _rm16,  _imm8 }, 
    1040 //      { 0xd1, _3|_32_bit,                     _rm32,  0 }, 
    1041         { 0xd3, _3|_32_bit,                     _rm32,  _cl }, 
    1042         { 0xc1, _3|_ib|_32_bit,         _rm32,  _imm8 }, 
    1043         { ASM_END, 0, 0, 0 } 
    1044 }; 
    1045 PTRNTAB2  aptb2ROL[] = /* ROL */ { 
    1046 //      { 0xd0, _0,                     _rm8,   0 }, 
    1047         { 0xd2, _0,                     _rm8,   _cl }, 
    1048         { 0xc0, _0,                     _rm8,   _imm8 }, 
    1049 //      { 0xd1, _0|_16_bit,                     _rm16,  0 }, 
    1050         { 0xd3, _0|_16_bit,                     _rm16,  _cl }, 
    1051         { 0xc1, _0|_16_bit,                     _rm16,  _imm8 }, 
    1052 //      { 0xd1, _0|_32_bit,                     _rm32,  0 }, 
    1053         { 0xd3, _0|_32_bit,                     _rm32,  _cl }, 
    1054         { 0xc1, _0|_32_bit,                     _rm32,  _imm8 }, 
    1055         { ASM_END, 0, 0, 0 } 
    1056 }; 
    1057 PTRNTAB2  aptb2ROR[] = /* ROR */ { 
    1058 //      { 0xd0, _1,                     _rm8, 0 }, 
    1059         { 0xd2, _1,                     _rm8, _cl }, 
    1060         { 0xc0, _1,                     _rm8, _imm8 }, 
    1061 //      { 0xd1, _1|_16_bit,                     _rm16, 0 }, 
    1062         { 0xd3, _1|_16_bit,                     _rm16, _cl }, 
    1063         { 0xc1, _1|_16_bit,                     _rm16, _imm8 }, 
    1064 //      { 0xd1, _1|_32_bit,                     _rm32, 0 }, 
    1065         { 0xd3, _1|_32_bit,                     _rm32, _cl }, 
    1066         { 0xc1, _1|_32_bit,                     _rm32,  _imm8 }, 
    1067         { ASM_END, 0, 0, 0 } 
    1068 }; 
    1069 PTRNTAB2  aptb2SAL[] = /* SAL */ { 
    1070 //      { 0xd0, _4,                     _rm8, 0 }, 
    1071         { 0xd2, _4,                     _rm8, _cl }, 
    1072         { 0xc0, _4,                     _rm8, _imm8 }, 
    1073 //      { 0xd1, _4|_16_bit,                     _rm16, 0 }, 
    1074         { 0xd3, _4|_16_bit,                     _rm16, _cl }, 
    1075         { 0xc1, _4|_16_bit,                     _rm16, _imm8 }, 
    1076 //      { 0xd1, _4|_32_bit,                     _rm32, 0 }, 
    1077         { 0xd3, _4|_32_bit,                     _rm32, _cl }, 
    1078         { 0xc1, _4|_32_bit,                     _rm32,  _imm8 }, 
    1079         { ASM_END, 0, 0, 0 } 
    1080 }; 
    1081 PTRNTAB2  aptb2SBB[] = /* SBB */ { 
    1082         { 0x1c, _ib,            _al,    _imm8 }, 
    1083         { 0x83, _3|_16_bit,                     _rm16,  _imm8 }, 
    1084         { 0x1d, _iw|_16_bit,            _ax,    _imm16 }, 
    1085         { 0x83, _3|_32_bit,                     _rm32,  _imm8 }, 
    1086         { 0x1d, _id|_32_bit,            _eax,   _imm32 }, 
    1087         { 0x80, _3 | _ib,       _rm8,   _imm8 }, 
    1088         { 0x81, _3 | _iw|_16_bit,       _rm16,  _imm16 }, 
    1089         { 0x81, _3 | _id|_32_bit,       _rm32,  _imm32 }, 
    1090         { 0x18, _r,                     _rm8,   _r8 }, 
    1091         { 0x19, _r|_16_bit,                     _rm16,  _r16 }, 
    1092         { 0x19, _r|_32_bit,                     _rm32,  _r32 }, 
    1093         { 0x1A, _r,                     _r8,    _rm8 }, 
    1094         { 0x1B, _r|_16_bit,                     _r16,   _rm16 }, 
    1095         { 0x1B, _r|_32_bit,                     _r32,   _rm32 }, 
    1096         { ASM_END, 0, 0, 0 } 
    1097 }; 
    1098  
    1099  
    1100 PTRNTAB2  aptb2SAR[] = /* SAR */ { 
    1101 //      { 0xd0, _7,                     _rm8, 0 }, 
    1102         { 0xd2, _7,                     _rm8, _cl }, 
    1103         { 0xc0, _7,                     _rm8, _imm8 }, 
    1104 //      { 0xd1, _7|_16_bit,                     _rm16, 0 }, 
    1105         { 0xd3, _7|_16_bit,                     _rm16, _cl }, 
    1106         { 0xc1, _7|_16_bit,                     _rm16, _imm8 }, 
    1107 //      { 0xd1, _7|_32_bit,                     _rm32, 0 }, 
    1108         { 0xd3, _7|_32_bit,                     _rm32, _cl }, 
    1109         { 0xc1, _7|_32_bit,                     _rm32,  _imm8 }, 
    1110         { ASM_END, 0, 0, 0 } 
    1111 }; 
    1112 PTRNTAB2  aptb2SHL[] = /* SHL */ { 
    1113 //      { 0xd0, _4,                     _rm8, 0 }, 
    1114         { 0xd2, _4,                     _rm8, _cl }, 
    1115         { 0xc0, _4,                     _rm8, _imm8 }, 
    1116 //      { 0xd1, _4|_16_bit,                     _rm16, 0 }, 
    1117         { 0xd3, _4|_16_bit,                     _rm16, _cl }, 
    1118         { 0xc1, _4|_16_bit,                     _rm16, _imm8 }, 
    1119 //      { 0xd1, _4|_32_bit,                     _rm32, 0 }, 
    1120         { 0xd3, _4|_32_bit,                     _rm32, _cl }, 
    1121         { 0xc1, _4|_32_bit,                     _rm32,  _imm8 }, 
    1122         { ASM_END, 0, 0, 0 } 
    1123 }; 
    1124 PTRNTAB2  aptb2SHR[] = /* SHR */ { 
    1125 //      { 0xd0, _5,                     _rm8, 0 }, 
    1126         { 0xd2, _5,                     _rm8, _cl }, 
    1127         { 0xc0, _5,                     _rm8, _imm8 }, 
    1128 //      { 0xd1, _5|_16_bit,                     _rm16, 0 }, 
    1129         { 0xd3, _5|_16_bit,                     _rm16, _cl }, 
    1130         { 0xc1, _5|_16_bit,                     _rm16, _imm8 }, 
    1131 //      { 0xd1, _5|_32_bit,                     _rm32, 0 }, 
    1132         { 0xd3, _5|_32_bit,                     _rm32, _cl }, 
    1133         { 0xc1, _5|_32_bit,                     _rm32,  _imm8 }, 
    1134         { ASM_END, 0, 0, 0 } 
    1135 }; 
    1136 PTRNTAB2  aptb2SUB[] = /* SUB */ { 
    1137         { 0x2c, _ib,            _al,    _imm8 }, 
    1138         { 0x83, _5|_16_bit,                     _rm16,  _imm8 }, 
    1139         { 0x2d, _iw|_16_bit,            _ax,    _imm16 }, 
    1140         { 0x83, _5|_32_bit,                     _rm32,  _imm8 }, 
    1141         { 0x2d, _id|_32_bit,            _eax,   _imm32 }, 
    1142         { 0x80, _5 | _ib,       _rm8,   _imm8 }, 
    1143         { 0x81, _5 | _iw|_16_bit,       _rm16,  _imm16 }, 
    1144         { 0x81, _5 | _id|_32_bit,       _rm32,  _imm32 }, 
    1145         { 0x28, _r,                     _rm8,   _r8 }, 
    1146         { 0x29, _r|_16_bit,                     _rm16,  _r16 }, 
    1147         { 0x29, _r|_32_bit,                     _rm32,  _r32 }, 
    1148         { 0x2A, _r,                     _r8,    _rm8 }, 
    1149         { 0x2B, _r|_16_bit,                     _r16,   _rm16 }, 
    1150         { 0x2B, _r|_32_bit,                     _r32,   _rm32 }, 
    1151         { ASM_END, 0, 0, 0 } 
    1152 }; 
     683 
     684#define OPTABLE(str,op) \ 
     685PTRNTAB2  aptb2##str[] = {      \ 
     686        { 0xd2, op,             _rm8,   _cl },  \ 
     687        { 0xc0, op|_ib,         _rm8,   _imm8 },        \ 
     688        { 0xd3, op|_16_bit,     _rm16,  _cl },  \ 
     689        { 0xc1, op|_ib|_16_bit, _rm16,  _imm8 },        \ 
     690        { 0xd3, op|_32_bit,     _rm32,  _cl },  \ 
     691        { 0xc1, op|_ib|_32_bit, _rm32,  _imm8, },       \ 
     692        { 0xd3, op|_64_bit,     _rm64,  _cl },  \ 
     693        { 0xc1, op|_ib|_64_bit, _rm64,  _imm8, },       \ 
     694        { ASM_END, 0, 0, 0 }    \ 
     695
     696 
     697OPTABLE(ROL,_0); 
     698OPTABLE(ROR,_1); 
     699OPTABLE(RCL,_2); 
     700OPTABLE(RCR,_3); 
     701OPTABLE(SHL,_4); 
     702OPTABLE(SHR,_5); 
     703OPTABLE(SAR,_7); 
     704 
     705#undef OPTABLE 
     706 
    1153707PTRNTAB2  aptb2TEST[] = /* TEST */ { 
    1154708        { 0xa8, _ib|_modnot1,           _al,    _imm8 }, 
    1155709        { 0xa9, _iw|_16_bit|_modnot1,   _ax,    _imm16 }, 
    1156710        { 0xa9, _id|_32_bit|_modnot1,   _eax,   _imm32 }, 
    1157711        { 0xf6, _0|_modnot1,            _rm8,   _imm8 }, 
    1158712        { 0xf7, _0|_16_bit|_modnot1,    _rm16,  _imm16 }, 
    1159713        { 0xf7, _0|_32_bit|_modnot1,    _rm32,  _imm32 }, 
    1160714        { 0x84, _r|_modnot1,            _rm8,   _r8 }, 
    1161715        { 0x85, _r|_16_bit|_modnot1,    _rm16,  _r16 }, 
    1162716        { 0x85, _r|_32_bit|_modnot1,    _rm32,  _r32 }, 
    1163717        { ASM_END, 0, 0, 0 } 
    1164718}; 
    1165719PTRNTAB2  aptb2XADD[] = /* XADD */ {                    // 486 only instruction 
    1166720//      { 0x0fc0,       _ib | _I386|_mod2, _rm8, _r8 }, 
    1167721//      { 0x0fc1,       _iw | _I386|_16_bit|_mod2, _rm16, _r16 }, 
    1168722//      { 0x0fc1,       _id | _I386|_32_bit|_mod2, _rm32, _r32 }, 
    1169723        { 0x0fc0,       _r | _I386|_mod2, _rm8, _r8 }, 
    1170724        { 0x0fc1,       _r | _I386|_16_bit|_mod2, _rm16, _r16 }, 
    1171725        { 0x0fc1,       _r | _I386|_32_bit|_mod2, _rm32, _r32 }, 
    1172726        { ASM_END, 0, 0, 0 } 
    1173727}; 
    1174728PTRNTAB2  aptb2XCHG[] = /* XCHG */ { 
    1175729        { 0x90, _r|_16_bit|_mod2,       _ax ,   _r16 | _plus_r }, 
    1176730        { 0x90, _r|_16_bit|_mod2,       _r16 | _plus_r, _ax  }, 
    1177731        { 0x90, _r|_32_bit|_mod2,       _eax,   _r32 | _plus_r }, 
    1178732        { 0x90, _r|_32_bit|_mod2,       _r32 | _plus_r, _eax }, 
    1179733        { 0x86, _r|_mod2,               _rm8,   _r8 }, 
    1180734        { 0x86, _r|_mod2,               _r8,    _rm8 }, 
    1181735        { 0x87, _r|_16_bit|_mod2,               _rm16,  _r16 }, 
    1182736        { 0x87, _r|_16_bit|_mod2,               _r16, _rm16 }, 
    1183737        { 0x87, _r|_32_bit|_mod2,               _rm32,  _r32 }, 
    1184738        { 0x87, _r|_32_bit|_mod2,               _r32, _rm32 }, 
    1185739        { ASM_END, 0, 0, 0 } 
    1186740}; 
    1187 PTRNTAB2  aptb2XOR[] = { 
    1188         { 0x34, _ib,    _al,    _imm8 }, 
    1189         { 0x83, _6|_16_bit,             _rm16,  _imm8 }, 
    1190         { 0x35, _iw|_16_bit,    _ax,    _imm16 }, 
    1191         { 0x83, _6|_32_bit,             _rm32,  _imm8 }, 
    1192         { 0x35, _id|_32_bit,    _eax,   _imm32 }, 
    1193         { 0x80, _6,             _rm8,   _imm8 }, 
    1194         { 0x81, _6|_16_bit,             _rm16,  _imm16 }, 
    1195         { 0x81, _6|_32_bit,             _rm32,  _imm32 }, 
    1196         { 0x30, _r,             _rm8, _r8 }, 
    1197         { 0x31, _r|_16_bit,             _rm16, _r16 }, 
    1198         { 0x31, _r|_32_bit,             _rm32, _r32 }, 
    1199         { 0x32, _r,             _r8,    _rm8 }, 
    1200         { 0x33, _r|_16_bit,             _r16,   _rm16 }, 
    1201         { 0x33, _r|_32_bit,             _r32,   _rm32 }, 
    1202         { ASM_END, 0, 0, 0 } 
    1203 }; 
    1204  
    1205 PTRNTAB2  aptb2CMOVO[] = { 
    1206         { 0x0F40, _r|_16_bit,   _r16,   _rm16 }, 
    1207         { 0x0F40, _r|_32_bit,   _r32,   _rm32 }, 
    1208         { ASM_END, 0, 0, 0 } 
    1209 }; 
    1210 PTRNTAB2  aptb2CMOVNO[] = { 
    1211         { 0x0F41, _r|_16_bit,   _r16,   _rm16 }, 
    1212         { 0x0F41, _r|_32_bit,   _r32,   _rm32 }, 
    1213         { ASM_END, 0, 0, 0 } 
    1214 }; 
    1215 PTRNTAB2  aptb2CMOVB[] = { 
    1216         { 0x0F42, _r|_16_bit,   _r16,   _rm16 }, 
    1217         { 0x0F42, _r|_32_bit,   _r32,   _rm32 }, 
    1218         { ASM_END, 0, 0, 0 } 
    1219 }; 
    1220 PTRNTAB2  aptb2CMOVNB[] = { 
    1221         { 0x0F43, _r|_16_bit,   _r16,   _rm16 }, 
    1222         { 0x0F43, _r|_32_bit,   _r32,   _rm32 }, 
    1223         { ASM_END, 0, 0, 0 } 
    1224 }; 
    1225 PTRNTAB2  aptb2CMOVZ[] = { 
    1226         { 0x0F44, _r|_16_bit,   _r16,   _rm16 }, 
    1227         { 0x0F44, _r|_32_bit,   _r32,   _rm32 }, 
    1228         { ASM_END, 0, 0, 0 } 
    1229 }; 
    1230 PTRNTAB2  aptb2CMOVNZ[] = { 
    1231         { 0x0F45, _r|_16_bit,   _r16,   _rm16 }, 
    1232         { 0x0F45, _r|_32_bit,   _r32,   _rm32 }, 
    1233         { ASM_END, 0, 0, 0 } 
    1234 }; 
    1235 PTRNTAB2  aptb2CMOVBE[] = { 
    1236         { 0x0F46, _r|_16_bit,   _r16,   _rm16 }, 
    1237         { 0x0F46, _r|_32_bit,   _r32,   _rm32 }, 
    1238         { ASM_END, 0, 0, 0 } 
    1239 }; 
    1240 PTRNTAB2  aptb2CMOVNBE[] = { 
    1241         { 0x0F47, _r|_16_bit,   _r16,   _rm16 }, 
    1242         { 0x0F47, _r|_32_bit,   _r32,   _rm32 }, 
    1243         { ASM_END, 0, 0, 0 } 
    1244 }; 
    1245 PTRNTAB2  aptb2CMOVS[] = { 
    1246         { 0x0F48, _r|_16_bit,   _r16,   _rm16 }, 
    1247         { 0x0F48, _r|_32_bit,   _r32,   _rm32 }, 
    1248         { ASM_END, 0, 0, 0 } 
    1249 }; 
    1250 PTRNTAB2  aptb2CMOVNS[] = { 
    1251         { 0x0F49, _r|_16_bit,   _r16,   _rm16 }, 
    1252         { 0x0F49, _r|_32_bit,   _r32,   _rm32 }, 
    1253         { ASM_END, 0, 0, 0 } 
    1254 }; 
    1255 PTRNTAB2  aptb2CMOVP[] = { 
    1256         { 0x0F4A, _r|_16_bit,   _r16,   _rm16 }, 
    1257         { 0x0F4A, _r|_32_bit,   _r32,   _rm32 }, 
    1258         { ASM_END, 0, 0, 0 } 
    1259 }; 
    1260 PTRNTAB2  aptb2CMOVNP[] = { 
    1261         { 0x0F4B, _r|_16_bit,   _r16,   _rm16 }, 
    1262         { 0x0F4B, _r|_32_bit,   _r32,   _rm32 }, 
    1263         { ASM_END, 0, 0, 0 } 
    1264 }; 
    1265 PTRNTAB2  aptb2CMOVL[] = { 
    1266         { 0x0F4C, _r|_16_bit,   _r16,   _rm16 }, 
    1267         { 0x0F4C, _r|_32_bit,   _r32,   _rm32 }, 
    1268         { ASM_END, 0, 0, 0 } 
    1269 }; 
    1270 PTRNTAB2  aptb2CMOVNL[] = { 
    1271         { 0x0F4D, _r|_16_bit,   _r16,   _rm16 }, 
    1272         { 0x0F4D, _r|_32_bit,   _r32,   _rm32 }, 
    1273         { ASM_END, 0, 0, 0 } 
    1274 }; 
    1275 PTRNTAB2  aptb2CMOVLE[] = { 
    1276         { 0x0F4E, _r|_16_bit,   _r16,   _rm16 }, 
    1277         { 0x0F4E, _r|_32_bit,   _r32,   _rm32 }, 
    1278         { ASM_END, 0, 0, 0 } 
    1279 }; 
    1280 PTRNTAB2  aptb2CMOVNLE[] = { 
    1281         { 0x0F4F, _r|_16_bit,   _r16,   _rm16 }, 
    1282         { 0x0F4F, _r|_32_bit,   _r32,   _rm32 }, 
    1283         { ASM_END, 0, 0, 0 } 
    1284 }; 
     741 
     742#define OPTABLE(str,op) \ 
     743PTRNTAB2  aptb2##str[] = {      \ 
     744        { 0x0F40|op, _r|_16_bit,   _r16,   _rm16 },     \ 
     745        { 0x0F40|op, _r|_32_bit,   _r32,   _rm32 },     \ 
     746        { 0x0F40|op, _r|_64_bit,   _r64,   _rm64 },     \ 
     747        { ASM_END, 0, 0, 0 }    \ 
     748
     749 
     750OPTABLE(CMOVO,0); 
     751OPTABLE(CMOVNO,1); 
     752OPTABLE(CMOVB,2); 
     753OPTABLE(CMOVNB,3); 
     754OPTABLE(CMOVZ,4); 
     755OPTABLE(CMOVNZ,5); 
     756OPTABLE(CMOVBE,6); 
     757OPTABLE(CMOVNBE,7); 
     758OPTABLE(CMOVS,8); 
     759OPTABLE(CMOVNS,9); 
     760OPTABLE(CMOVP,0xA); 
     761OPTABLE(CMOVNP,0xB); 
     762OPTABLE(CMOVL,0xC); 
     763OPTABLE(CMOVNL,0xD); 
     764OPTABLE(CMOVLE,0xE); 
     765OPTABLE(CMOVNLE,0xF); 
     766 
     767#undef OPTABLE 
    1285768 
    1286769PTRNTAB3  aptb3IMUL[] = /* IMUL */ { 
    1287770        { 0x0faf,       _r|_16_bit,             _r16,   _rm16, 0 }, 
    1288771        { 0x0faf,       _r|_32_bit,             _r32,   _rm32, 0 }, 
    1289772        { 0x0faf,       _r|_64_bit,             _r64,   _rm64, 0 }, 
    1290773        { 0xf6, _5|_modax,                      _rm8,   0, 0 }, 
    1291774        { 0xf7, _5|_16_bit|_modaxdx,            _rm16,  0, 0 }, 
    1292775        { 0xf7, _5|_32_bit|_modaxdx,            _rm32,  0, 0 }, 
    1293776        { 0xf7, _5|_64_bit|_modaxdx,            _rm64,  0, 0 }, 
    1294777        { 0x6b, _r|_ib|_16_bit,         _r16,   _imm8, 0 }, 
    1295778        { 0x6b, _r|_ib|_32_bit,         _r32,   _imm8, 0 }, 
    1296779        { 0x69, _r|_iw|_16_bit,         _r16,   _imm16, 0 }, 
    1297780        { 0x69, _r|_id|_32_bit,         _r32,   _imm32, 0 }, 
    1298781        { 0x69, _r|_id|_64_bit,         _r64,   _imm32, 0 }, 
    1299782        { 0x6b, _r|_ib|_16_bit,         _r16,   _rm16,  _imm8 }, 
    1300783        { 0x6b, _r|_ib|_32_bit,         _r32,   _rm32,  _imm8 }, 
    1301784        { 0x6b, _r|_ib|_64_bit,         _r64,   _rm64,  _imm8 }, 
    1302785        { 0x69, _r|_iw|_16_bit,         _r16,   _rm16,  _imm16 }, 
    1303786        { 0x69, _r|_id|_32_bit,         _r32,   _rm32,  _imm32 }, 
    1304787        { 0x69, _r|_id|_64_bit,         _r64,   _rm64,  _imm32 }, 
    1305788        { ASM_END, 0, 0, 0 } 
    1306789}; 
    1307790PTRNTAB3  aptb3SHLD[] = /* SHLD */ { 
    1308791        { 0x0fa4,       _cw|_16_bit, _rm16, _r16, _imm8 }, 
    1309792        { 0x0fa4,       _cd|_32_bit, _rm32, _r32, _imm8 }, 
    1310793        { 0x0fa5,       _cw|_16_bit, _rm16, _r16, _cl }, 
    1311794        { 0x0fa5,       _cd|_32_bit, _rm32, _r32, _cl }, 
    1312795        { ASM_END, 0, 0, 0 } 
    1313796}; 
    1314797PTRNTAB3  aptb3SHRD[] = /* SHRD */ { 
    1315798        { 0x0fac,       _cw|_16_bit, _rm16, _r16, _imm8 }, 
    1316799        { 0x0fac,       _cd|_32_bit, _rm32, _r32, _imm8 }, 
    1317800        { 0x0fad,       _cw|_16_bit, _rm16, _r16, _cl }, 
    1318801        { 0x0fad,       _cd|_32_bit, _rm32, _r32, _cl }, 
    1319802        { ASM_END, 0, 0, 0 } 
    1320803}; 
    1321804// 
    1322805// Floating point instructions which have entirely different flag 
    1323806// interpretations 
    1324807// 
    1325 PTRNTAB0  aptb0F2XM1[] = /* F2XM1 */ { 
    1326         { 0xd9f0, 0 } 
    1327 }; 
    1328 PTRNTAB0  aptb0FABS[] = /* FABS */ { 
    1329         { 0xd9e1, 0 } 
    1330 }; 
    1331 PTRNTAB0  aptb0FCHS[] = /* FCHS */ { 
    1332         { 0xd9e0, 0 } 
    1333 }; 
    1334 PTRNTAB0  aptb0FCLEX[] = /* FCLEX */ { 
    1335         { 0xdbe2, _fwait } 
    1336 }; 
    1337 PTRNTAB0  aptb0FNCLEX[] = /* FNCLEX */ { 
    1338         { 0xdbe2, _nfwait } 
    1339 }; 
    1340 PTRNTAB0  aptb0FCOMPP[] = /* FCOMPP */ { 
    1341         { 0xded9, 0 } 
    1342 }; 
    1343 PTRNTAB0  aptb0FCOS[] = /* FCOS */ { 
    1344         { 0xd9ff, 0 } 
    1345 }; 
    1346 PTRNTAB0  aptb0FUCOMPP[] = /* FUCOMPP */ { 
    1347         { 0xdae9, 0 } 
    1348 }; 
    1349 PTRNTAB0  aptb0FDECSTP[] = /* FDECSTP */ { 
    1350         { 0xd9f6, 0 } 
    1351 }; 
    1352 PTRNTAB0  aptb0FINCSTP[] = /* FINCSTP */ { 
    1353         { 0xd9f7, 0 } 
    1354 }; 
    1355 PTRNTAB0  aptb0FINIT[] = /* FINIT */ { 
    1356         { 0xdbe3, _fwait } 
    1357 }; 
    1358 PTRNTAB0  aptb0FNINIT[] = /* FNINIT */ { 
    1359         { 0xdbe3, _nfwait } 
    1360 }; 
    1361 PTRNTAB0  aptb0FENI[] = /* FENI */ { 
    1362         { 0xdbe0, _fwait } 
    1363 }; 
    1364 PTRNTAB0  aptb0FNENI[] = /* FNENI */ { 
    1365         { 0xdbe0, _nfwait } 
    1366 }; 
    1367 PTRNTAB0  aptb0FDISI[] = /* FDISI */ { 
    1368         { 0xdbe1, _fwait } 
    1369 }; 
    1370 PTRNTAB0  aptb0FNDISI[] = /* FNDISI */ { 
    1371         { 0xdbe1, _nfwait } 
    1372 }; 
    1373 PTRNTAB0  aptb0FLD1[] = /* FLD1 */ { 
    1374         { 0xd9e8, 0 } 
    1375 }; 
    1376 PTRNTAB0  aptb0FLDL2T[] = /* FLDL2T */ { 
    1377         { 0xd9e9, 0 } 
    1378 }; 
    1379 PTRNTAB0  aptb0FLDL2E[] = /* FLDL2E */ { 
    1380         { 0xd9ea, 0 } 
    1381 }; 
    1382 PTRNTAB0  aptb0FLDPI[] = /* FLDPI */ { 
    1383         { 0xd9eb, 0 } 
    1384 }; 
    1385 PTRNTAB0  aptb0FLDLG2[] = /* FLDLG2 */ { 
    1386         { 0xd9ec, 0 } 
    1387 }; 
    1388 PTRNTAB0  aptb0FLDLN2[] = /* FLDLN2 */ { 
    1389         { 0xd9ed, 0 } 
    1390 }; 
    1391 PTRNTAB0  aptb0FLDZ[] = /* FLDZ */ { 
    1392         { 0xd9ee, 0 } 
    1393 }; 
    1394 PTRNTAB0  aptb0FNOP[] = /* FNOP */ { 
    1395         { 0xd9d0, 0 } 
    1396 }; 
    1397 PTRNTAB0  aptb0FPATAN[] = /* FPATAN */ { 
    1398         { 0xd9f3, 0 } 
    1399 }; 
    1400 PTRNTAB0  aptb0FPREM[] = /* FPREM */ { 
    1401         { 0xd9f8, 0 } 
    1402 }; 
    1403 PTRNTAB0  aptb0FPREM1[] = /* FPREM1 */ { 
    1404         { 0xd9f5, 0 } 
    1405 }; 
    1406 PTRNTAB0  aptb0FPTAN[] = /* FPTAN */ { 
    1407         { 0xd9f2, 0 } 
    1408 }; 
    1409 PTRNTAB0  aptb0FRNDINT[] = /* FRNDINT */ { 
    1410         { 0xd9fc, 0 } 
    1411 }; 
    1412 PTRNTAB0  aptb0FSCALE[] = /* FSCALE */ { 
    1413         { 0xd9fd, 0 } 
    1414 }; 
    1415 PTRNTAB0  aptb0FSETPM[] = /* FSETPM */ { 
    1416         { 0xdbe4, 0 } 
    1417 }; 
    1418 PTRNTAB0  aptb0FSIN[] = /* FSIN */ { 
    1419         { 0xd9fe, 0 } 
    1420 }; 
    1421 PTRNTAB0  aptb0FSINCOS[] = /* FSINCOS */ { 
    1422         { 0xd9fb, 0 } 
    1423 }; 
    1424 PTRNTAB0  aptb0FSQRT[] = /* FSQRT */ { 
    1425         { 0xd9fa, 0 } 
    1426 }; 
    1427 PTRNTAB0  aptb0FTST[] = /* FTST */ { 
    1428         { 0xd9e4, 0 } 
    1429 }; 
    1430 PTRNTAB0  aptb0FWAIT[] = /* FWAIT */ { 
    1431         { 0x9b, 0 } 
    1432 }; 
    1433 PTRNTAB0  aptb0FXAM[] = /* FXAM */ { 
    1434         { 0xd9e5, 0 } 
    1435 }; 
    1436 PTRNTAB0  aptb0FXTRACT[] = /* FXTRACT */ { 
    1437         { 0xd9f4, 0 } 
    1438 }; 
    1439 PTRNTAB0  aptb0FYL2X[] = /* FYL2X */ { 
    1440         { 0xd9f1, 0 } 
    1441 }; 
    1442 PTRNTAB0  aptb0FYL2XP1[] = /* FYL2XP1 */ { 
    1443         { 0xd9f9, 0 } 
    1444 }; 
     808 
     809OPTABLE0(F2XM1,    0xd9f0,0); 
     810OPTABLE0(FABS,     0xd9e1,0); 
     811OPTABLE0(FCHS,     0xd9e0,0); 
     812OPTABLE0(FCLEX,    0xdbe2,_fwait); 
     813OPTABLE0(FNCLEX,   0xdbe2, _nfwait); 
     814OPTABLE0(FCOMPP,   0xded9, 0); 
     815OPTABLE0(FCOS,     0xd9ff, 0); 
     816OPTABLE0(FUCOMPP,  0xdae9, 0); 
     817OPTABLE0(FDECSTP,  0xd9f6, 0); 
     818OPTABLE0(FINCSTP,  0xd9f7, 0); 
     819OPTABLE0(FINIT,    0xdbe3, _fwait); 
     820OPTABLE0(FNINIT,   0xdbe3, _nfwait); 
     821OPTABLE0(FENI,     0xdbe0, _fwait); 
     822OPTABLE0(FNENI,    0xdbe0, _nfwait); 
     823OPTABLE0(FDISI,    0xdbe1, _fwait); 
     824OPTABLE0(FNDISI,   0xdbe1, _nfwait); 
     825OPTABLE0(FLD1,     0xd9e8, 0); 
     826OPTABLE0(FLDL2T,   0xd9e9, 0); 
     827OPTABLE0(FLDL2E,   0xd9ea, 0); 
     828OPTABLE0(FLDPI,    0xd9eb, 0); 
     829OPTABLE0(FLDLG2,   0xd9ec, 0); 
     830OPTABLE0(FLDLN2,   0xd9ed, 0); 
     831OPTABLE0(FLDZ,     0xd9ee, 0); 
     832OPTABLE0(FNOP,     0xd9d0, 0); 
     833OPTABLE0(FPATAN,   0xd9f3, 0); 
     834OPTABLE0(FPREM,    0xd9f8, 0); 
     835OPTABLE0(FPREM1,   0xd9f5, 0); 
     836OPTABLE0(FPTAN,    0xd9f2, 0); 
     837OPTABLE0(FRNDINT,  0xd9fc, 0); 
     838OPTABLE0(FSCALE,   0xd9fd, 0); 
     839OPTABLE0(FSETPM,   0xdbe4, 0); 
     840OPTABLE0(FSIN,     0xd9fe, 0); 
     841OPTABLE0(FSINCOS,  0xd9fb, 0); 
     842OPTABLE0(FSQRT,    0xd9fa, 0); 
     843OPTABLE0(FTST,     0xd9e4, 0); 
     844OPTABLE0(FWAIT,    0x9b, 0); 
     845OPTABLE0(FXAM,     0xd9e5, 0); 
     846OPTABLE0(FXTRACT,  0xd9f4, 0); 
     847OPTABLE0(FYL2X,    0xd9f1, 0); 
     848OPTABLE0(FYL2XP1,  0xd9f9, 0); 
    1445849// 
    1446850// Floating point instructions which have entirely different flag 
    1447851// interpretations but they overlap, only asm_determine_operator 
    1448852// flags needs to know the difference 
    1449853//      1 operand floating point instructions follow 
    1450854// 
    1451855PTRNTAB1  aptb1FBLD[] = /* FBLD */ { 
    1452856        { 0xdf, _4, _fm80 }, 
    1453857        { ASM_END, 0, 0 } 
    1454858}; 
    1455859 
    1456860PTRNTAB1  aptb1FBSTP[] = /* FBSTP */ { 
    1457861        { 0xdf, _6, _fm80 }, 
    1458862        { ASM_END, 0, 0 } 
    1459863}; 
    1460864PTRNTAB2  aptb2FCMOVB[] = /* FCMOVB */ { 
    1461865        { 0xdac0, 0, _st, _sti | _plus_r }, 
    1462866        { 0xdac1, 0, 0 }, 
    1463867        { ASM_END, 0, 0 } 
    1464868}; 
     
    32032607        X("cmovnge",    2,              (P) aptb2CMOVL ) \ 
    32042608        X("cmovnl",     2,              (P) aptb2CMOVNL ) \ 
    32052609        X("cmovnle",    2,              (P) aptb2CMOVNLE ) \ 
    32062610        X("cmovno",     2,              (P) aptb2CMOVNO ) \ 
    32072611        X("cmovnp",     2,              (P) aptb2CMOVNP ) \ 
    32082612        X("cmovns",     2,              (P) aptb2CMOVNS ) \ 
    32092613        X("cmovnz",     2,              (P) aptb2CMOVNZ ) \ 
    32102614        X("cmovo",      2,              (P) aptb2CMOVO ) \ 
    32112615        X("cmovp",      2,              (P) aptb2CMOVP ) \ 
    32122616        X("cmovpe",     2,              (P) aptb2CMOVP ) \ 
    32132617        X("cmovpo",     2,              (P) aptb2CMOVNP ) \ 
    32142618        X("cmovs",      2,              (P) aptb2CMOVS ) \ 
    32152619        X("cmovz",      2,              (P) aptb2CMOVZ ) \ 
    32162620        X("cmp",        2,              (P) aptb2CMP ) \ 
    32172621        X("cmppd",      3,              (P) aptb3CMPPD ) \ 
    32182622        X("cmpps",      3,              (P) aptb3CMPPS ) \ 
    32192623        X("cmps",       2,              (P) aptb2CMPS ) \ 
    32202624        X("cmpsb",      0,              aptb0CMPSB ) \ 
    32212625        /*X("cmpsd",    0,              aptb0CMPSD )*/ \ 
    32222626        X("cmpsd",      ITopt|3,        (P) aptb3CMPSD ) \ 
     2627        X("cmpsq",      0,              aptb0CMPSQ ) \ 
    32232628        X("cmpss",      3,              (P) aptb3CMPSS ) \ 
    32242629        X("cmpsw",      0,              aptb0CMPSW ) \ 
    32252630        X("cmpxch8b",   1,              (P) aptb1CMPXCH8B ) \ 
    32262631        X("cmpxchg",    2,              (P) aptb2CMPXCHG ) \ 
    32272632        X("comisd",     2,              (P) aptb2COMISD ) \ 
    32282633        X("comiss",     2,              (P) aptb2COMISS ) \ 
    32292634        X("cpuid",      0,              aptb0CPUID ) \ 
    32302635        X("cqo",        0,              aptb0CQO ) \ 
    32312636        X("cvtdq2pd",   2,              (P) aptb2CVTDQ2PD ) \ 
    32322637        X("cvtdq2ps",   2,              (P) aptb2CVTDQ2PS ) \ 
    32332638        X("cvtpd2dq",   2,              (P) aptb2CVTPD2DQ ) \ 
    32342639        X("cvtpd2pi",   2,              (P) aptb2CVTPD2PI ) \ 
    32352640        X("cvtpd2ps",   2,              (P) aptb2CVTPD2PS ) \ 
    32362641        X("cvtpi2pd",   2,              (P) aptb2CVTPI2PD ) \ 
    32372642        X("cvtpi2ps",   2,              (P) aptb2CVTPI2PS ) \ 
    32382643        X("cvtps2dq",   2,              (P) aptb2CVTPS2DQ ) \ 
    32392644        X("cvtps2pd",   2,              (P) aptb2CVTPS2PD ) \ 
    32402645        X("cvtps2pi",   2,              (P) aptb2CVTPS2PI ) \ 
    32412646        X("cvtsd2si",   2,              (P) aptb2CVTSD2SI ) \ 
    32422647        X("cvtsd2ss",   2,              (P) aptb2CVTSD2SS ) \ 
     
    34322837#define OPCODETABLE2    \ 
    34332838        X("lahf",       0,              aptb0LAHF ) \ 
    34342839        X("lar",        2,              (P) aptb2LAR ) \ 
    34352840        X("lddqu",      2,              (P) aptb2LDDQU ) \ 
    34362841        X("ldmxcsr",    1,              (P) aptb1LDMXCSR ) \ 
    34372842        X("lds",        2,              (P) aptb2LDS ) \ 
    34382843        X("lea",        2,              (P) aptb2LEA ) \ 
    34392844        X("leave",      0,              aptb0LEAVE ) \ 
    34402845        X("les",        2,              (P) aptb2LES ) \ 
    34412846        X("lfence",     0,              aptb0LFENCE) \ 
    34422847        X("lfs",        2,              (P) aptb2LFS ) \ 
    34432848        X("lgdt",       1,              (P) aptb1LGDT ) \ 
    34442849        X("lgs",        2,              (P) aptb2LGS ) \ 
    34452850        X("lidt",       1,              (P) aptb1LIDT ) \ 
    34462851        X("lldt",       1,              (P) aptb1LLDT ) \ 
    34472852        X("lmsw",       1,              (P) aptb1LMSW ) \ 
    34482853        X("lock",       ITprefix | 0,   aptb0LOCK ) \ 
    34492854        X("lods",       1,              (P) aptb1LODS ) \ 
    34502855        X("lodsb",      0,              aptb0LODSB ) \ 
    34512856        X("lodsd",      0,              aptb0LODSD ) \ 
     2857        X("lodsq",      0,              aptb0LODSQ ) \ 
    34522858        X("lodsw",      0,              aptb0LODSW ) \ 
    34532859        X("loop",       ITjump | 1,     (P) aptb1LOOP ) \ 
    34542860        X("loope",      ITjump | 1,     (P) aptb1LOOPE ) \ 
    34552861        X("loopne",     ITjump | 1,     (P) aptb1LOOPNE ) \ 
    3456         X("loopnz",     ITjump | 1,     (P) aptb1LOOPNZ ) \ 
    3457         X("loopz",      ITjump | 1,     (P) aptb1LOOPZ ) \ 
     2862        X("loopnz",     ITjump | 1,     (P) aptb1LOOPNE ) \ 
     2863        X("loopz",      ITjump | 1,     (P) aptb1LOOPE ) \ 
    34582864        X("lsl",        2,              (P) aptb2LSL ) \ 
    34592865        X("lss",        2,              (P) aptb2LSS ) \ 
    34602866        X("ltr",        1,              (P) aptb1LTR ) \ 
    34612867        X("maskmovdqu", 2,              (P) aptb2MASKMOVDQU ) \ 
    34622868        X("maskmovq",   2,              (P) aptb2MASKMOVQ ) \ 
    34632869        X("maxpd",      2,              (P) aptb2MAXPD ) \ 
    34642870        X("maxps",      2,              (P) aptb2MAXPS ) \ 
    34652871        X("maxsd",      2,              (P) aptb2MAXSD ) \ 
    34662872        X("maxss",      2,              (P) aptb2MAXSS ) \ 
    34672873        X("mfence",     0,              aptb0MFENCE) \ 
    34682874        X("minpd",      2,              (P) aptb2MINPD ) \ 
    34692875        X("minps",      2,              (P) aptb2MINPS ) \ 
    34702876        X("minsd",      2,              (P) aptb2MINSD ) \ 
    34712877        X("minss",      2,              (P) aptb2MINSS ) \ 
    34722878        X("monitor",    0,              (P) aptb0MONITOR ) \ 
    34732879        X("mov",        2,              (P) aptb2MOV ) \ 
    34742880        X("movapd",     2,              (P) aptb2MOVAPD ) \ 
    34752881        X("movaps",     2,              (P) aptb2MOVAPS ) \ 
    34762882        X("movd",       2,              (P) aptb2MOVD ) \ 
    34772883        X("movddup",    2,              (P) aptb2MOVDDUP ) \ 
     
    34812887        X("movhlps",    2,              (P) aptb2MOVHLPS ) \ 
    34822888        X("movhpd",     2,              (P) aptb2MOVHPD ) \ 
    34832889        X("movhps",     2,              (P) aptb2MOVHPS ) \ 
    34842890        X("movlhps",    2,              (P) aptb2MOVLHPS ) \ 
    34852891        X("movlpd",     2,              (P) aptb2MOVLPD ) \ 
    34862892        X("movlps",     2,              (P) aptb2MOVLPS ) \ 
    34872893        X("movmskpd",   2,              (P) aptb2MOVMSKPD ) \ 
    34882894        X("movmskps",   2,              (P) aptb2MOVMSKPS ) \ 
    34892895        X("movntdq",    2,              (P) aptb2MOVNTDQ ) \ 
    34902896        X("movnti",     2,              (P) aptb2MOVNTI ) \ 
    34912897        X("movntpd",    2,              (P) aptb2MOVNTPD ) \ 
    34922898        X("movntps",    2,              (P) aptb2MOVNTPS ) \ 
    34932899        X("movntq",     2,              (P) aptb2MOVNTQ ) \ 
    34942900        X("movq",       2,              (P) aptb2MOVQ ) \ 
    34952901        X("movq2dq",    2,              (P) aptb2MOVQ2DQ ) \ 
    34962902        X("movs",       2,              (P) aptb2MOVS ) \ 
    34972903        X("movsb",      0,              aptb0MOVSB ) \ 
    34982904        X("movsd",      ITopt | 2,      (P) aptb2MOVSD ) \ 
    34992905        X("movshdup",   2,              (P) aptb2MOVSHDUP ) \ 
    35002906        X("movsldup",   2,              (P) aptb2MOVSLDUP ) \ 
     2907        X("movsq",      0,              aptb0MOVSQ ) \ 
    35012908        X("movss",      2,              (P) aptb2MOVSS ) \ 
    35022909        X("movsw",      0,              aptb0MOVSW ) \ 
    35032910        X("movsx",      2,              (P) aptb2MOVSX ) \ 
    35042911        X("movupd",     2,              (P) aptb2MOVUPD ) \ 
    35052912        X("movups",     2,              (P) aptb2MOVUPS ) \ 
    35062913        X("movzx",      2,              (P) aptb2MOVZX ) \ 
    35072914        X("mul",        ITopt | 2,      (P) aptb2MUL ) \ 
    35082915        X("mulpd",      2,              (P) aptb2MULPD ) \ 
    35092916        X("mulps",      2,              (P) aptb2MULPS ) \ 
    35102917        X("mulsd",      2,              (P) aptb2MULSD ) \ 
    35112918        X("mulss",      2,              (P) aptb2MULSS ) \ 
    35122919        X("mwait",      0,              (P) aptb0MWAIT ) \ 
    35132920        X("neg",        1,              (P) aptb1NEG ) \ 
    35142921        X("nop",        0,              aptb0NOP ) \ 
    35152922        X("not",        1,              (P) aptb1NOT ) \ 
    35162923        X("or",         2,              (P) aptb2OR ) \ 
    35172924        X("orpd",       2,              (P) aptb2ORPD ) \ 
    35182925        X("orps",       2,              (P) aptb2ORPS ) \ 
    35192926        X("out",        2,              (P) aptb2OUT ) \ 
    35202927        X("outs",       2,              (P) aptb2OUTS ) \ 
     
    36273034        X("rcl",        ITshift | 2,    (P) aptb2RCL ) \ 
    36283035        X("rcpps",      2,              (P) aptb2RCPPS ) \ 
    36293036        X("rcpss",      2,              (P) aptb2RCPSS ) \ 
    36303037        X("rcr",        ITshift | 2,    (P) aptb2RCR ) \ 
    36313038        X("rdmsr",      0,              aptb0RDMSR ) \ 
    36323039        X("rdpmc",      0,              aptb0RDPMC ) \ 
    36333040        X("rdtsc",      0,              aptb0RDTSC ) \ 
    36343041        X("rep",        ITprefix | 0,   aptb0REP ) \ 
    36353042        X("repe",       ITprefix | 0,   aptb0REP ) \ 
    36363043        X("repne",      ITprefix | 0,   aptb0REPNE ) \ 
    36373044        X("repnz",      ITprefix | 0,   aptb0REPNE ) \ 
    36383045        X("repz",       ITprefix | 0,   aptb0REP ) \ 
    36393046        X("ret",        ITopt | 1,      (P) aptb1RET ) \ 
    36403047        X("retf",       ITopt | 1,      (P) aptb1RETF ) \ 
    36413048        X("rol",        ITshift | 2,    (P) aptb2ROL ) \ 
    36423049        X("ror",        ITshift | 2,    (P) aptb2ROR ) \ 
    36433050        X("rsm",        0,              aptb0RSM ) \ 
    36443051        X("rsqrtps",    2,              (P) aptb2RSQRTPS ) \ 
    36453052        X("rsqrtss",    2,              (P) aptb2RSQRTSS ) \ 
    36463053        X("sahf",       0,              aptb0SAHF ) \ 
    3647         X("sal",        ITshift | 2,    (P) aptb2SAL ) \ 
     3054        X("sal",        ITshift | 2,    (P) aptb2SHL ) \ 
    36483055        X("sar",        ITshift | 2,    (P) aptb2SAR ) \ 
    36493056        X("sbb",        2,              (P) aptb2SBB ) \ 
    36503057        X("scas",       1,              (P) aptb1SCAS ) \ 
    36513058        X("scasb",      0,              aptb0SCASB ) \ 
    36523059        X("scasd",      0,              aptb0SCASD ) \ 
     3060        X("scasq",      0,              aptb0SCASQ ) \ 
    36533061        X("scasw",      0,              aptb0SCASW ) \ 
    36543062        X("seta",       1,              (P) aptb1SETNBE ) \ 
    36553063        X("setae",      1,              (P) aptb1SETNB ) \ 
    36563064        X("setb",       1,              (P) aptb1SETB ) \ 
    36573065        X("setbe",      1,              (P) aptb1SETBE ) \ 
    36583066        X("setc",       1,              (P) aptb1SETB ) \ 
    36593067        X("sete",       1,              (P) aptb1SETZ ) \ 
    36603068        X("setg",       1,              (P) aptb1SETNLE ) \ 
    36613069        X("setge",      1,              (P) aptb1SETNL ) \ 
    36623070        X("setl",       1,              (P) aptb1SETL ) \ 
    36633071        X("setle",      1,              (P) aptb1SETLE ) \ 
    36643072        X("setna",      1,              (P) aptb1SETBE ) \ 
    36653073        X("setnae",     1,              (P) aptb1SETB ) \ 
    36663074        X("setnb",      1,              (P) aptb1SETNB ) \ 
    36673075        X("setnbe",     1,              (P) aptb1SETNBE ) \ 
    36683076        X("setnc",      1,              (P) aptb1SETNB ) \ 
    36693077        X("setne",      1,              (P) aptb1SETNZ ) \ 
    36703078        X("setng",      1,              (P) aptb1SETLE ) \ 
    36713079        X("setnge",     1,              (P) aptb1SETL ) \ 
    36723080        X("setnl",      1,              (P) aptb1SETNL ) \ 
     
    36863094        X("shl",        ITshift | 2,    (P) aptb2SHL ) \ 
    36873095        X("shld",       3,              (P) aptb3SHLD ) \ 
    36883096        X("shr",        ITshift | 2,    (P) aptb2SHR ) \ 
    36893097        X("shrd",       3,              (P) aptb3SHRD ) \ 
    36903098        X("shufpd",     3,              (P) aptb3SHUFPD ) \ 
    36913099        X("shufps",     3,              (P) aptb3SHUFPS ) \ 
    36923100        X("sidt",       1,              (P) aptb1SIDT ) \ 
    36933101        X("sldt",       1,              (P) aptb1SLDT ) \ 
    36943102        X("smsw",       1,              (P) aptb1SMSW ) \ 
    36953103        X("sqrtpd",     2,              (P) aptb2SQRTPD ) \ 
    36963104        X("sqrtps",     2,              (P) aptb2SQRTPS ) \ 
    36973105        X("sqrtsd",     2,              (P) aptb2SQRTSD ) \ 
    36983106        X("sqrtss",     2,              (P) aptb2SQRTSS ) \ 
    36993107        X("stc",        0,              aptb0STC ) \ 
    37003108        X("std",        0,              aptb0STD ) \ 
    37013109        X("sti",        0,              aptb0STI ) \ 
    37023110        X("stmxcsr",    1,              (P) aptb1STMXCSR ) \ 
    37033111        X("stos",       1,              (P) aptb1STOS ) \ 
    37043112        X("stosb",      0,              aptb0STOSB ) \ 
    37053113        X("stosd",      0,              aptb0STOSD ) \ 
     3114        X("stosq",      0,              aptb0STOSQ ) \ 
    37063115        X("stosw",      0,              aptb0STOSW ) \ 
    37073116        X("str",        1,              (P) aptb1STR ) \ 
    37083117        X("sub",        2,              (P) aptb2SUB ) \ 
    37093118        X("subpd",      2,              (P) aptb2SUBPD ) \ 
    37103119        X("subps",      2,              (P) aptb2SUBPS ) \ 
    37113120        X("subsd",      2,              (P) aptb2SUBSD ) \ 
    37123121        X("subss",      2,              (P) aptb2SUBSS ) \ 
    37133122        X("sysenter",   0,              aptb0SYSENTER ) \ 
    37143123        X("sysexit",    0,              aptb0SYSEXIT ) \ 
    37153124        X("test",       2,              (P) aptb2TEST ) \ 
    37163125        X("ucomisd",    2,              (P) aptb2UCOMISD ) \ 
    37173126        X("ucomiss",    2,              (P) aptb2UCOMISS ) \ 
    37183127        X("ud2",        0,              aptb0UD2 ) \ 
    37193128        X("unpckhpd",   2,              (P) aptb2UNPCKHPD ) \ 
    37203129        X("unpckhps",   2,              (P) aptb2UNPCKHPS ) \ 
    37213130        X("unpcklpd",   2,              (P) aptb2UNPCKLPD ) \ 
    37223131        X("unpcklps",   2,              (P) aptb2UNPCKLPS ) \ 
    37233132        X("verr",       1,              (P) aptb1VERR ) \ 
    37243133        X("verw",       1,              (P) aptb1VERW ) \ 
    37253134        X("wait",       0,              aptb0WAIT ) \ 
  • trunk/src/e2ir.c

    r618 r621  
    44744474                elength = n1; 
    44754475                n1 = el_same(&elength); 
    44764476                elength = el_una(OP64_32, TYuint, elength); 
    44774477            L1: 
    44784478                n2x = n2; 
    44794479                n2 = el_same(&n2x); 
    44804480                n2x = el_bin(OPlt, TYint, n2x, elength); 
    44814481 
    44824482                // Construct: (n2x || ModuleAssert(line)) 
    44834483                Symbol *sassert; 
    44844484 
    44854485                sassert = irs->blx->module->toModuleArray(); 
    44864486                ea = el_bin(OPcall,TYvoid,el_var(sassert), 
    44874487                    el_long(TYint, loc.linnum)); 
    44884488                eb = el_bin(OPoror,TYvoid,n2x,ea); 
    44894489            } 
    44904490        } 
    44914491 
    44924492        n1 = array_toPtr(t1, n1); 
    44934493 
    4494         {   elem *escale; 
    4495  
    4496             escale = el_long(TYint, t1->nextOf()->size()); 
     4494        { 
     4495            elem *escale = el_long(TYsize_t, t1->nextOf()->size()); 
    44974496            n2 = el_bin(OPmul, TYint, n2, escale); 
    44984497            e = el_bin(OPadd, TYnptr, n1, n2); 
    44994498            e = el_una(OPind, type->totym(), e); 
    45004499            if (tybasic(e->Ety) == TYstruct || tybasic(e->Ety) == TYarray) 
    45014500            {   e->Ety = TYstruct; 
    45024501                e->Enumbytes = type->size(); 
    45034502            } 
    45044503        } 
    45054504 
    45064505        eb = el_combine(einit, eb); 
    45074506        e = el_combine(eb, e); 
    45084507    } 
    45094508    el_setLoc(e,loc); 
    45104509    return e; 
    45114510} 
    45124511 
    45134512 
    45144513elem *TupleExp::toElem(IRState *irs) 
    45154514{   elem *e = NULL; 
    45164515 
  • trunk/src/impcnvgen.c

    r428 r621  
    369369    Y(Tint64, Tuns16) 
    370370    Y(Tuns64, Tuns16) 
    371371 
    372372    Y(Tint16, Twchar) 
    373373    Y(Tint32, Twchar) 
    374374    Y(Tuns32, Twchar) 
    375375    Y(Tint64, Twchar) 
    376376    Y(Tuns64, Twchar) 
    377377 
    378378//    Y(Tuns32, Tint32) 
    379379    Y(Tint64, Tint32) 
    380380    Y(Tuns64, Tint32) 
    381381 
    382382//    Y(Tint32, Tuns32) 
    383383    Y(Tint64, Tuns32) 
    384384    Y(Tuns64, Tuns32) 
    385385 
    386386    Y(Tint64, Tdchar) 
    387387    Y(Tuns64, Tdchar) 
    388388 
    389     Y(Tint64, Tuns64) 
    390     Y(Tuns64, Tint64) 
     389//    Y(Tint64, Tuns64) 
     390//    Y(Tuns64, Tint64) 
    391391 
    392392    for (i = 0; i < TMAX; i++) 
    393393        for (j = 0; j < TMAX; j++) 
    394394        { 
    395395            if (impcnvResult[i][j] == Terror) 
    396396            { 
    397397                impcnvResult[i][j] = impcnvResult[j][i]; 
    398398                impcnvType1[i][j] = impcnvType2[j][i]; 
    399399                impcnvType2[i][j] = impcnvType1[j][i]; 
    400400            } 
    401401        } 
    402402} 
    403403 
    404404int main() 
    405405{   FILE *fp; 
    406406    int i; 
    407407    int j; 
    408408 
    409409    init(); 
    410410