Subversion Repositories Kolibri OS

Rev

Rev 4478 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. ; flat assembler core
  3. ; Copyright (c) 1999-2016, Tomasz Grysztar.
  4. ; All rights reserved.
  5.  
  6. avx_single_source_pd_instruction_er_evex:
  7.         or      [vex_required],8
  8. avx_single_source_pd_instruction_er:
  9.         or      [operand_flags],2+4+8
  10.         jmp     avx_pd_instruction
  11. avx_single_source_pd_instruction_sae_evex:
  12.         or      [vex_required],8
  13.         or      [operand_flags],2+4
  14.         jmp     avx_pd_instruction
  15. avx_pd_instruction_imm8:
  16.         mov     [immediate_size],1
  17.         jmp     avx_pd_instruction
  18. avx_pd_instruction_er:
  19.         or      [operand_flags],8
  20. avx_pd_instruction_sae:
  21.         or      [operand_flags],4
  22. avx_pd_instruction:
  23.         mov     [opcode_prefix],66h
  24.         or      [rex_prefix],80h
  25.         mov     cx,0800h
  26.         jmp     avx_instruction_with_broadcast
  27. avx_pd_instruction_38_evex:
  28.         or      [vex_required],8
  29.         mov     [supplemental_code],al
  30.         mov     al,38h
  31.         jmp     avx_pd_instruction
  32. avx_cvtps2dq_instruction:
  33.         mov     [opcode_prefix],66h
  34.         jmp     avx_single_source_ps_instruction_er
  35. avx_cvtudq2ps_instruction:
  36.         mov     [opcode_prefix],0F2h
  37. avx_single_source_ps_instruction_er_evex:
  38.         or      [vex_required],8
  39. avx_single_source_ps_instruction_er:
  40.         or      [operand_flags],2+4+8
  41.         jmp     avx_ps_instruction
  42. avx_single_source_ps_instruction_noevex:
  43.         or      [operand_flags],2
  44.         or      [vex_required],2
  45.         jmp     avx_ps_instruction
  46. avx_ps_instruction_imm8:
  47.         mov     [immediate_size],1
  48.         jmp     avx_ps_instruction
  49. avx_ps_instruction_er:
  50.         or      [operand_flags],8
  51. avx_ps_instruction_sae:
  52.         or      [operand_flags],4
  53. avx_ps_instruction:
  54.         mov     cx,0400h
  55.         jmp     avx_instruction_with_broadcast
  56. avx_ps_instruction_66_38_evex:
  57.         or      [vex_required],8
  58.         mov     [opcode_prefix],66h
  59.         mov     [supplemental_code],al
  60.         mov     al,38h
  61.         jmp     avx_ps_instruction
  62. avx_sd_instruction_er:
  63.         or      [operand_flags],8
  64. avx_sd_instruction_sae:
  65.         or      [operand_flags],4
  66. avx_sd_instruction:
  67.         mov     [opcode_prefix],0F2h
  68.         or      [rex_prefix],80h
  69.         mov     cl,8
  70.         jmp     avx_instruction
  71. avx_ss_instruction_er:
  72.         or      [operand_flags],8
  73. avx_ss_instruction_sae:
  74.         or      [operand_flags],4
  75. avx_ss_instruction:
  76.         mov     [opcode_prefix],0F3h
  77.         mov     cl,4
  78.         jmp     avx_instruction
  79. avx_ss_instruction_noevex:
  80.         or      [vex_required],2
  81.         jmp     avx_ss_instruction
  82. avx_single_source_q_instruction_38_evex:
  83.         or      [operand_flags],2
  84. avx_q_instruction_38_evex:
  85.         or      [vex_required],8
  86. avx_q_instruction_38:
  87.         mov     [supplemental_code],al
  88.         mov     al,38h
  89.         jmp     avx_q_instruction
  90. avx_q_instruction_38_w1_evex:
  91.         or      [vex_required],8
  92. avx_q_instruction_38_w1:
  93.         or      [rex_prefix],8
  94.         jmp     avx_q_instruction_38
  95. avx_q_instruction_3a_imm8_evex:
  96.         mov     [immediate_size],1
  97.         or      [vex_required],8
  98.         mov     [supplemental_code],al
  99.         mov     al,3Ah
  100.         jmp     avx_q_instruction
  101. avx_q_instruction_evex:
  102.         or      [vex_required],8
  103. avx_q_instruction:
  104.         or      [rex_prefix],80h
  105.         mov     ch,8
  106.         jmp     avx_pi_instruction
  107. avx_single_source_d_instruction_38_evex:
  108.         or      [vex_required],8
  109. avx_single_source_d_instruction_38:
  110.         or      [operand_flags],2
  111.         jmp     avx_d_instruction_38
  112. avx_d_instruction_38_evex:
  113.         or      [vex_required],8
  114. avx_d_instruction_38:
  115.         mov     [supplemental_code],al
  116.         mov     al,38h
  117.         jmp     avx_d_instruction
  118. avx_d_instruction_3a_imm8_evex:
  119.         mov     [immediate_size],1
  120.         or      [vex_required],8
  121.         mov     [supplemental_code],al
  122.         mov     al,3Ah
  123.         jmp     avx_d_instruction
  124. avx_single_source_d_instruction_imm8:
  125.         or      [operand_flags],2
  126.         mov     [immediate_size],1
  127.         jmp     avx_d_instruction
  128. avx_d_instruction_evex:
  129.         or      [vex_required],8
  130. avx_d_instruction:
  131.         mov     ch,4
  132.         jmp     avx_pi_instruction
  133. avx_single_source_bw_instruction_38:
  134.         or      [operand_flags],2
  135. avx_bw_instruction_38:
  136.         mov     [supplemental_code],al
  137.         mov     al,38h
  138. avx_bw_instruction:
  139.         xor     ch,ch
  140.       avx_pi_instruction:
  141.         mov     [opcode_prefix],66h
  142.         xor     cl,cl
  143.         jmp     avx_instruction_with_broadcast
  144. avx_bw_instruction_38_w1_evex:
  145.         or      [rex_prefix],8
  146. avx_bw_instruction_38_evex:
  147.         or      [vex_required],8
  148.         jmp     avx_bw_instruction_38
  149. avx_pd_instruction_noevex:
  150.         xor     cl,cl
  151.         or      [vex_required],2
  152.         mov     [opcode_prefix],66h
  153.         jmp     avx_instruction
  154. avx_ps_instruction_noevex:
  155.         or      [vex_required],2
  156.         mov     [opcode_prefix],0F2h
  157.         xor     cl,cl
  158.         jmp     avx_instruction
  159. avx_instruction:
  160.         xor     ch,ch
  161.       avx_instruction_with_broadcast:
  162.         mov     [mmx_size],cl
  163.         mov     [broadcast_size],ch
  164.         mov     [base_code],0Fh
  165.         mov     [extended_code],al
  166.       avx_xop_common:
  167.         or      [vex_required],1
  168.         lods    byte [esi]
  169.         call    get_size_operator
  170.         cmp     al,10h
  171.         jne     invalid_operand
  172.       avx_reg:
  173.         lods    byte [esi]
  174.         call    convert_avx_register
  175.         mov     [postbyte_register],al
  176.         call    take_avx512_mask
  177.       avx_vex_reg:
  178.         test    [operand_flags],2
  179.         jnz     avx_vex_reg_ok
  180.         lods    byte [esi]
  181.         cmp     al,','
  182.         jne     invalid_operand
  183.         call    take_avx_register
  184.         mov     [vex_register],al
  185.       avx_vex_reg_ok:
  186.         mov     al,[mmx_size]
  187.         or      al,al
  188.         jz      avx_regs_size_ok
  189.         mov     ah,[operand_size]
  190.         or      ah,ah
  191.         jz      avx_regs_size_ok
  192.         cmp     al,ah
  193.         je      avx_regs_size_ok
  194.         ja      invalid_operand_size
  195.         cmp     ah,16
  196.         jne     invalid_operand_size
  197.       avx_regs_size_ok:
  198.         lods    byte [esi]
  199.         cmp     al,','
  200.         jne     invalid_operand
  201.       avx_regs_rm:
  202.         call    take_avx_rm
  203.         jc      avx_regs_reg
  204.         mov     al,[immediate_size]
  205.         cmp     al,1
  206.         je      mmx_imm8
  207.         jb      instruction_ready
  208.         cmp     al,-4
  209.         je      sse_cmp_mem_ok
  210.         cmp     byte [esi],','
  211.         jne     invalid_operand
  212.         inc     esi
  213.         call    take_avx_register
  214.         shl     al,4
  215.         jc      invalid_operand
  216.         or      byte [value],al
  217.         test    al,80h
  218.         jz      avx_regs_mem_reg_store
  219.         cmp     [code_type],64
  220.         jne     invalid_operand
  221.       avx_regs_mem_reg_store:
  222.         call    take_imm4_if_needed
  223.         call    store_instruction_with_imm8
  224.         jmp     instruction_assembled
  225.       avx_regs_reg:
  226.         mov     bl,al
  227.         call    take_avx512_rounding
  228.         mov     al,[immediate_size]
  229.         cmp     al,1
  230.         je      mmx_nomem_imm8
  231.         jb      nomem_instruction_ready
  232.         cmp     al,-4
  233.         je      sse_cmp_nomem_ok
  234.         lods    byte [esi]
  235.         cmp     al,','
  236.         jne     invalid_operand
  237.         mov     al,bl
  238.         shl     al,4
  239.         jc      invalid_operand
  240.         or      byte [value],al
  241.         test    al,80h
  242.         jz      avx_regs_reg_
  243.         cmp     [code_type],64
  244.         jne     invalid_operand
  245.       avx_regs_reg_:
  246.         call    take_avx_rm
  247.         jc      avx_regs_reg_reg
  248.         cmp     [immediate_size],-2
  249.         jg      invalid_operand
  250.         or      [rex_prefix],8
  251.         call    take_imm4_if_needed
  252.         call    store_instruction_with_imm8
  253.         jmp     instruction_assembled
  254.       avx_regs_reg_reg:
  255.         shl     al,4
  256.         jc      invalid_operand
  257.         and     byte [value],1111b
  258.         or      byte [value],al
  259.         call    take_imm4_if_needed
  260.         call    store_nomem_instruction
  261.         mov     al,byte [value]
  262.         stos    byte [edi]
  263.         jmp     instruction_assembled
  264.       take_avx_rm:
  265.         xor     cl,cl
  266.         xchg    cl,[operand_size]
  267.         lods    byte [esi]
  268.         call    get_size_operator
  269.         cmp     al,'['
  270.         je      take_avx_mem
  271.         cmp     al,10h
  272.         jne     invalid_operand
  273.         mov     [operand_size],cl
  274.         lods    byte [esi]
  275.         call    convert_avx_register
  276.         or      cl,cl
  277.         jnz     avx_reg_ok
  278.         or      cl,[mmx_size]
  279.         jz      avx_reg_ok
  280.         cmp     ah,cl
  281.         je      avx_reg_ok
  282.         jb      invalid_operand_size
  283.         cmp     ah,16
  284.         jne     invalid_operand_size
  285.       avx_reg_ok:
  286.         stc
  287.         ret
  288.       take_avx_mem:
  289.         push    ecx
  290.         call    get_address
  291.         cmp     byte [esi],'{'
  292.         jne     avx_mem_ok
  293.         inc     esi
  294.         lods    byte [esi]
  295.         cmp     al,1Fh
  296.         jne     invalid_operand
  297.         mov     al,[esi]
  298.         shr     al,4
  299.         cmp     al,1
  300.         jne     invalid_operand
  301.         mov     al,[mmx_size]
  302.         or      al,al
  303.         jnz     avx_mem_broadcast_check
  304.         mov     eax,[esp]
  305.         or      al,al
  306.         jnz     avx_mem_broadcast_check
  307.         mov     al,[broadcast_size]
  308.         mov     [mmx_size],al
  309.         mov     ah,cl
  310.         lods    byte [esi]
  311.         and     al,1111b
  312.         mov     cl,al
  313.         mov     al,[broadcast_size]
  314.         shl     al,cl
  315.         mov     [esp],al
  316.         mov     cl,ah
  317.         jmp     avx_mem_broadcast_ok
  318.       avx_mem_broadcast_check:
  319.         bsf     eax,eax
  320.         xchg    al,[broadcast_size]
  321.         mov     [mmx_size],al
  322.         bsf     eax,eax
  323.         jz      invalid_operand
  324.         mov     ah,[broadcast_size]
  325.         sub     ah,al
  326.         lods    byte [esi]
  327.         and     al,1111b
  328.         cmp     al,ah
  329.         jne     invalid_operand_size
  330.       avx_mem_broadcast_ok:
  331.         or      [vex_required],40h
  332.         lods    byte [esi]
  333.         cmp     al,'}'
  334.         jne     invalid_operand
  335.       avx_mem_ok:
  336.         pop     eax
  337.         or      al,al
  338.         jz      avx_mem_size_deciding
  339.         xchg    al,[operand_size]
  340.         cmp     [mmx_size],0
  341.         jne     avx_mem_size_enforced
  342.         or      al,al
  343.         jz      avx_mem_size_ok
  344.         cmp     al,[operand_size]
  345.         jne     operand_sizes_do_not_match
  346.       avx_mem_size_ok:
  347.         clc
  348.         ret
  349.       avx_mem_size_deciding:
  350.         mov     al,[operand_size]
  351.         cmp     [mmx_size],0
  352.         jne     avx_mem_size_enforced
  353.         cmp     al,16
  354.         je      avx_mem_size_ok
  355.         cmp     al,32
  356.         je      avx_mem_size_ok
  357.         cmp     al,64
  358.         je      avx_mem_size_ok
  359.         or      al,al
  360.         jnz     invalid_operand_size
  361.         call    recoverable_unknown_size
  362.       avx_mem_size_enforced:
  363.         or      al,al
  364.         jz      avx_mem_size_ok
  365.         cmp     al,[mmx_size]
  366.         je      avx_mem_size_ok
  367.         jmp     invalid_operand_size
  368.       take_imm4_if_needed:
  369.         cmp     [immediate_size],-3
  370.         jne     imm4_ok
  371.         push    ebx ecx edx
  372.         lods    byte [esi]
  373.         cmp     al,','
  374.         jne     invalid_operand
  375.         lods    byte [esi]
  376.         cmp     al,'('
  377.         jne     invalid_operand
  378.         call    get_byte_value
  379.         test    al,11110000b
  380.         jnz     value_out_of_range
  381.         or      byte [value],al
  382.         pop     edx ecx ebx
  383.       imm4_ok:
  384.         ret
  385.       take_avx512_mask:
  386.         cmp     byte [esi],'{'
  387.         jne     avx512_masking_ok
  388.         test    [operand_flags],10h
  389.         jnz     invalid_operand
  390.         inc     esi
  391.         lods    byte [esi]
  392.         cmp     al,14h
  393.         jne     invalid_operand
  394.         lods    byte [esi]
  395.         mov     ah,al
  396.         shr     ah,4
  397.         cmp     ah,5
  398.         jne     invalid_operand
  399.         or      al,al
  400.         jz      invalid_operand
  401.         and     al,111b
  402.         mov     [mask_register],al
  403.         or      [vex_required],20h
  404.         lods    byte [esi]
  405.         cmp     al,'}'
  406.         jne     invalid_operand
  407.         cmp     byte [esi],'{'
  408.         jne     avx512_masking_ok
  409.         test    [operand_flags],20h
  410.         jnz     invalid_operand
  411.         inc     esi
  412.         lods    byte [esi]
  413.         cmp     al,1Fh
  414.         jne     invalid_operand
  415.         lods    byte [esi]
  416.         or      al,al
  417.         jnz     invalid_operand
  418.         or      [mask_register],80h
  419.         lods    byte [esi]
  420.         cmp     al,'}'
  421.         jne     invalid_operand
  422.       avx512_masking_ok:
  423.         retn
  424.       take_avx512_rounding:
  425.         test    [operand_flags],4+8
  426.         jz      avx512_rounding_done
  427.         cmp     [mmx_size],0
  428.         jne     avx512_rounding_allowed
  429.         cmp     [operand_size],64
  430.         jne     avx512_rounding_done
  431.       avx512_rounding_allowed:
  432.         cmp     byte [esi],','
  433.         jne     avx512_rounding_done
  434.         cmp     byte [esi+1],'{'
  435.         jne     avx512_rounding_done
  436.         add     esi,2
  437.         mov     [rounding_mode],0
  438.         or      [vex_required],40h+80h
  439.         test    [operand_flags],8
  440.         jz      take_sae
  441.         lods    byte [esi]
  442.         cmp     al,1Fh
  443.         jne     invalid_operand
  444.         lods    byte [esi]
  445.         mov     ah,al
  446.         shr     ah,4
  447.         cmp     ah,2
  448.         jne     invalid_operand
  449.         and     al,11b
  450.         mov     [rounding_mode],al
  451.         lods    byte [esi]
  452.         cmp     al,'-'
  453.         jne     invalid_operand
  454.       take_sae:
  455.         lods    byte [esi]
  456.         cmp     al,1Fh
  457.         jne     invalid_operand
  458.         lods    byte [esi]
  459.         cmp     al,30h
  460.         jne     invalid_operand
  461.         lods    byte [esi]
  462.         cmp     al,'}'
  463.         jne     invalid_operand
  464.       avx512_rounding_done:
  465.         retn
  466.  
  467. avx_movdqu_instruction:
  468.         mov     ah,0F3h
  469.         jmp     avx_movdq_instruction
  470. avx_movdqa_instruction:
  471.         mov     ah,66h
  472.       avx_movdq_instruction:
  473.         mov     [opcode_prefix],ah
  474.         or      [vex_required],2
  475.         jmp     avx_movps_instruction
  476. avx512_movdqu16_instruction:
  477.         or      [rex_prefix],8
  478. avx512_movdqu8_instruction:
  479.         mov     ah,0F2h
  480.         jmp     avx_movdq_instruction_evex
  481. avx512_movdqu64_instruction:
  482.         or      [rex_prefix],8
  483. avx512_movdqu32_instruction:
  484.         mov     ah,0F3h
  485.         jmp     avx_movdq_instruction_evex
  486. avx512_movdqa64_instruction:
  487.         or      [rex_prefix],8
  488. avx512_movdqa32_instruction:
  489.         mov     ah,66h
  490.       avx_movdq_instruction_evex:
  491.         mov     [opcode_prefix],ah
  492.         or      [vex_required],8
  493.         jmp     avx_movps_instruction
  494. avx_movpd_instruction:
  495.         mov     [opcode_prefix],66h
  496.         or      [rex_prefix],80h
  497. avx_movps_instruction:
  498.         or      [operand_flags],2
  499.         mov     [base_code],0Fh
  500.         mov     [extended_code],al
  501.         or      [vex_required],1
  502.         xor     al,al
  503.         mov     [mmx_size],al
  504.         mov     [broadcast_size],al
  505.         lods    byte [esi]
  506.         call    get_size_operator
  507.         cmp     al,10h
  508.         je      avx_reg
  509.         inc     [extended_code]
  510.         test    [extended_code],1
  511.         jnz     avx_mem
  512.         add     [extended_code],-1+10h
  513.       avx_mem:
  514.         cmp     al,'['
  515.         jne     invalid_operand
  516.         call    get_address
  517.         or      [operand_flags],20h
  518.         call    take_avx512_mask
  519.         lods    byte [esi]
  520.         cmp     al,','
  521.         jne     invalid_operand
  522.         call    take_avx_register
  523.         mov     [postbyte_register],al
  524.         jmp     instruction_ready
  525. avx_movntpd_instruction:
  526.         or      [rex_prefix],80h
  527. avx_movntdq_instruction:
  528.         mov     [opcode_prefix],66h
  529. avx_movntps_instruction:
  530.         mov     [base_code],0Fh
  531.         mov     [extended_code],al
  532.         or      [vex_required],1
  533.         or      [operand_flags],10h
  534.         mov     [mmx_size],0
  535.         lods    byte [esi]
  536.         call    get_size_operator
  537.         jmp     avx_mem
  538. avx_compress_q_instruction:
  539.         or      [rex_prefix],8
  540. avx_compress_d_instruction:
  541.         or      [vex_required],8
  542.         mov     [mmx_size],0
  543.         call    setup_66_0f_38
  544.         lods    byte [esi]
  545.         call    get_size_operator
  546.         cmp     al,10h
  547.         jne     avx_mem
  548.         lods    byte [esi]
  549.         call    convert_avx_register
  550.         mov     bl,al
  551.         call    take_avx512_mask
  552.         lods    byte [esi]
  553.         cmp     al,','
  554.         jne     invalid_operand
  555.         call    take_avx_register
  556.         mov     [postbyte_register],al
  557.         jmp     nomem_instruction_ready
  558. avx_lddqu_instruction:
  559.         mov     ah,0F2h
  560.         or      [vex_required],2
  561.       avx_load_instruction:
  562.         mov     [opcode_prefix],ah
  563.         mov     [base_code],0Fh
  564.         mov     [extended_code],al
  565.         mov     [mmx_size],0
  566.         or      [vex_required],1
  567.         call    take_avx_register
  568.         mov     [postbyte_register],al
  569.         lods    byte [esi]
  570.         cmp     al,','
  571.         jne     invalid_operand
  572.         lods    byte [esi]
  573.         call    get_size_operator
  574.         cmp     al,'['
  575.         jne     invalid_operand
  576.         call    get_address
  577.         jmp     instruction_ready
  578. avx_movntdqa_instruction:
  579.         mov     [supplemental_code],al
  580.         mov     al,38h
  581.         mov     ah,66h
  582.         jmp     avx_load_instruction
  583. avx_movq_instruction:
  584.         or      [rex_prefix],8
  585.         mov     [mmx_size],8
  586.         jmp     avx_mov_instruction
  587. avx_movd_instruction:
  588.         mov     [mmx_size],4
  589.       avx_mov_instruction:
  590.         or      [vex_required],1
  591.         mov     [opcode_prefix],66h
  592.         mov     [base_code],0Fh
  593.         mov     [extended_code],7Eh
  594.         lods    byte [esi]
  595.         call    get_size_operator
  596.         cmp     al,10h
  597.         je      avx_movd_reg
  598.         cmp     al,'['
  599.         jne     invalid_operand
  600.         call    get_address
  601.         mov     al,[mmx_size]
  602.         not     al
  603.         and     [operand_size],al
  604.         jnz     invalid_operand_size
  605.         lods    byte [esi]
  606.         cmp     al,','
  607.         jne     invalid_operand
  608.         lods    byte [esi]
  609.         call    get_size_operator
  610.         cmp     al,10h
  611.         jne     invalid_operand
  612.         lods    byte [esi]
  613.         call    convert_avx_register
  614.         cmp     ah,16
  615.         jne     invalid_operand_size
  616.         mov     [postbyte_register],al
  617.         cmp     [mmx_size],8
  618.         jne     instruction_ready
  619.         and     [rex_prefix],not 8
  620.         or      [rex_prefix],80h
  621.         mov     [extended_code],0D6h
  622.         jmp     instruction_ready
  623.       avx_movd_reg:
  624.         lods    byte [esi]
  625.         cmp     al,0C0h
  626.         jae     avx_movd_xmmreg
  627.         call    convert_register
  628.         cmp     ah,[mmx_size]
  629.         jne     invalid_operand_size
  630.         mov     [operand_size],0
  631.         mov     bl,al
  632.         lods    byte [esi]
  633.         cmp     al,','
  634.         jne     invalid_operand
  635.         lods    byte [esi]
  636.         call    get_size_operator
  637.         cmp     al,10h
  638.         jne     invalid_operand
  639.         lods    byte [esi]
  640.         call    convert_avx_register
  641.         cmp     ah,16
  642.         jne     invalid_operand_size
  643.         mov     [postbyte_register],al
  644.         jmp     nomem_instruction_ready
  645.       avx_movd_xmmreg:
  646.         sub     [extended_code],10h
  647.         call    convert_avx_register
  648.         cmp     ah,16
  649.         jne     invalid_operand_size
  650.         mov     [postbyte_register],al
  651.         mov     [operand_size],0
  652.         lods    byte [esi]
  653.         cmp     al,','
  654.         jne     invalid_operand
  655.         lods    byte [esi]
  656.         call    get_size_operator
  657.         cmp     al,10h
  658.         je      avx_movd_xmmreg_reg
  659.         cmp     al,'['
  660.         jne     invalid_operand
  661.         call    get_address
  662.         mov     al,[mmx_size]
  663.         cmp     al,8
  664.         jne     avx_movd_xmmreg_mem_ready
  665.         call    avx_movq_xmmreg_xmmreg_opcode
  666.       avx_movd_xmmreg_mem_ready:
  667.         not     al
  668.         test    [operand_size],al
  669.         jnz     invalid_operand_size
  670.         jmp     instruction_ready
  671.       avx_movd_xmmreg_reg:
  672.         lods    byte [esi]
  673.         cmp     al,0C0h
  674.         jae     avx_movq_xmmreg_xmmreg
  675.         call    convert_register
  676.         cmp     ah,[mmx_size]
  677.         jne     invalid_operand_size
  678.         mov     bl,al
  679.         jmp     nomem_instruction_ready
  680.       avx_movq_xmmreg_xmmreg:
  681.         cmp     [mmx_size],8
  682.         jne     invalid_operand
  683.         call    avx_movq_xmmreg_xmmreg_opcode
  684.         call    convert_avx_register
  685.         cmp     ah,16
  686.         jne     invalid_operand_size
  687.         mov     bl,al
  688.         jmp     nomem_instruction_ready
  689.       avx_movq_xmmreg_xmmreg_opcode:
  690.         and     [rex_prefix],not 8
  691.         or      [rex_prefix],80h
  692.         add     [extended_code],10h
  693.         mov     [opcode_prefix],0F3h
  694.         ret
  695. avx_movddup_instruction:
  696.         or      [vex_required],1
  697.         mov     [opcode_prefix],0F2h
  698.         mov     [base_code],0Fh
  699.         mov     [extended_code],al
  700.         or      [rex_prefix],80h
  701.         xor     al,al
  702.         mov     [mmx_size],al
  703.         mov     [broadcast_size],al
  704.         lods    byte [esi]
  705.         call    get_size_operator
  706.         cmp     al,10h
  707.         jne     invalid_operand
  708.         lods    byte [esi]
  709.         call    convert_avx_register
  710.         mov     [postbyte_register],al
  711.         cmp     ah,16
  712.         ja      avx_movddup_size_ok
  713.         mov     [mmx_size],8
  714.       avx_movddup_size_ok:
  715.         call    take_avx512_mask
  716.         jmp     avx_vex_reg_ok
  717. avx_movlpd_instruction:
  718.         mov     [opcode_prefix],66h
  719.         or      [rex_prefix],80h
  720. avx_movlps_instruction:
  721.         mov     [base_code],0Fh
  722.         mov     [extended_code],al
  723.         mov     [mmx_size],8
  724.         mov     [broadcast_size],0
  725.         or      [vex_required],1
  726.         lods    byte [esi]
  727.         call    get_size_operator
  728.         cmp     al,10h
  729.         jne     avx_movlps_mem
  730.         lods    byte [esi]
  731.         call    convert_avx_register
  732.         mov     [postbyte_register],al
  733.         lods    byte [esi]
  734.         cmp     al,','
  735.         jne     invalid_operand
  736.         call    take_avx_register
  737.         mov     [vex_register],al
  738.         cmp     [operand_size],16
  739.         jne     invalid_operand
  740.         mov     [operand_size],0
  741.         lods    byte [esi]
  742.         cmp     al,','
  743.         jne     invalid_operand
  744.         call    take_avx_rm
  745.         jc      invalid_operand
  746.         jmp     instruction_ready
  747.       avx_movlps_mem:
  748.         cmp     al,'['
  749.         jne     invalid_operand
  750.         call    get_address
  751.       avx_movlps_mem_:
  752.         mov     al,[operand_size]
  753.         or      al,al
  754.         jz      avx_movlps_mem_size_ok
  755.         cmp     al,[mmx_size]
  756.         jne     invalid_operand_size
  757.         mov     [operand_size],0
  758.       avx_movlps_mem_size_ok:
  759.         lods    byte [esi]
  760.         cmp     al,','
  761.         jne     invalid_operand
  762.         call    take_avx_register
  763.         cmp     ah,16
  764.         jne     invalid_operand
  765.         mov     [postbyte_register],al
  766.         inc     [extended_code]
  767.         jmp     instruction_ready
  768. avx_movhlps_instruction:
  769.         mov     [base_code],0Fh
  770.         mov     [extended_code],al
  771.         or      [vex_required],1
  772.         call    take_avx_register
  773.         cmp     ah,16
  774.         jne     invalid_operand
  775.         mov     [postbyte_register],al
  776.         lods    byte [esi]
  777.         cmp     al,','
  778.         jne     invalid_operand
  779.         call    take_avx_register
  780.         mov     [vex_register],al
  781.         lods    byte [esi]
  782.         cmp     al,','
  783.         jne     invalid_operand
  784.         call    take_avx_register
  785.         mov     bl,al
  786.         jmp     nomem_instruction_ready
  787. avx_movsd_instruction:
  788.         mov     al,0F2h
  789.         mov     cl,8
  790.         or      [rex_prefix],80h
  791.         jmp     avx_movs_instruction
  792. avx_movss_instruction:
  793.         mov     al,0F3h
  794.         mov     cl,4
  795.       avx_movs_instruction:
  796.         mov     [opcode_prefix],al
  797.         mov     [mmx_size],cl
  798.         or      [vex_required],1
  799.         mov     [base_code],0Fh
  800.         mov     [extended_code],10h
  801.         lods    byte [esi]
  802.         call    get_size_operator
  803.         cmp     al,10h
  804.         jne     avx_movs_mem
  805.         lods    byte [esi]
  806.         call    convert_avx_register
  807.         cmp     ah,16
  808.         jne     invalid_operand
  809.         mov     [postbyte_register],al
  810.         call    take_avx512_mask
  811.         xor     cl,cl
  812.         xchg    cl,[operand_size]
  813.         lods    byte [esi]
  814.         cmp     al,','
  815.         jne     invalid_operand
  816.         lods    byte [esi]
  817.         call    get_size_operator
  818.         cmp     al,10h
  819.         jne     avx_movs_reg_mem
  820.         mov     [operand_size],cl
  821.         lods    byte [esi]
  822.         call    convert_avx_register
  823.         mov     [vex_register],al
  824.         lods    byte [esi]
  825.         cmp     al,','
  826.         jne     invalid_operand
  827.         call    take_avx_register
  828.         mov     bl,al
  829.         cmp     bl,8
  830.         jb      nomem_instruction_ready
  831.         inc     [extended_code]
  832.         xchg    bl,[postbyte_register]
  833.         jmp     nomem_instruction_ready
  834.       avx_movs_reg_mem:
  835.         cmp     al,'['
  836.         jne     invalid_operand
  837.         call    get_address
  838.         mov     al,[operand_size]
  839.         or      al,al
  840.         jz      avx_movs_reg_mem_ok
  841.         cmp     al,[mmx_size]
  842.         jne     invalid_operand_size
  843.       avx_movs_reg_mem_ok:
  844.         jmp     instruction_ready
  845.       avx_movs_mem:
  846.         cmp     al,'['
  847.         jne     invalid_operand
  848.         call    get_address
  849.         or      [operand_flags],20h
  850.         call    take_avx512_mask
  851.         jmp     avx_movlps_mem_
  852.  
  853. avx_comiss_instruction:
  854.         or      [operand_flags],2+4+10h
  855.         mov     cl,4
  856.         jmp     avx_instruction
  857. avx_comisd_instruction:
  858.         or      [operand_flags],2+4+10h
  859.         mov     [opcode_prefix],66h
  860.         or      [rex_prefix],80h
  861.         mov     cl,8
  862.         jmp     avx_instruction
  863. avx_movshdup_instruction:
  864.         or      [operand_flags],2
  865.         mov     [opcode_prefix],0F3h
  866.         xor     cl,cl
  867.         jmp     avx_instruction
  868. avx_cvtqq2pd_instruction:
  869.         mov     [opcode_prefix],0F3h
  870.         or      [vex_required],8
  871.         or      [operand_flags],2+4+8
  872.         or      [rex_prefix],8
  873.         mov     cx,0800h
  874.         jmp     avx_instruction_with_broadcast
  875. avx_pshuf_w_instruction:
  876.         mov     [opcode_prefix],al
  877.         or      [operand_flags],2
  878.         mov     [immediate_size],1
  879.         mov     al,70h
  880.         xor     cl,cl
  881.         jmp     avx_instruction
  882. avx_single_source_128bit_instruction_38_noevex:
  883.         or      [operand_flags],2
  884. avx_128bit_instruction_38_noevex:
  885.         mov     cl,16
  886.         jmp     avx_instruction_38_noevex
  887. avx_single_source_instruction_38_noevex:
  888.         or      [operand_flags],2
  889.         jmp     avx_pi_instruction_38_noevex
  890. avx_pi_instruction_38_noevex:
  891.         xor     cl,cl
  892.       avx_instruction_38_noevex:
  893.         or      [vex_required],2
  894.       avx_instruction_38:
  895.         mov     [opcode_prefix],66h
  896.         mov     [supplemental_code],al
  897.         mov     al,38h
  898.         jmp     avx_instruction
  899. avx_ss_instruction_3a_imm8_noevex:
  900.         mov     cl,4
  901.         jmp     avx_instruction_3a_imm8_noevex
  902. avx_sd_instruction_3a_imm8_noevex:
  903.         mov     cl,8
  904.         jmp     avx_instruction_3a_imm8_noevex
  905. avx_single_source_128bit_instruction_3a_imm8_noevex:
  906.         or      [operand_flags],2
  907. avx_128bit_instruction_3a_imm8_noevex:
  908.         mov     cl,16
  909.         jmp     avx_instruction_3a_imm8_noevex
  910. avx_triple_source_instruction_3a_noevex:
  911.         xor     cl,cl
  912.         mov     [immediate_size],-1
  913.         mov     byte [value],0
  914.         jmp     avx_instruction_3a_noevex
  915. avx_single_source_instruction_3a_imm8_noevex:
  916.         or      [operand_flags],2
  917. avx_pi_instruction_3a_imm8_noevex:
  918.         xor     cl,cl
  919.       avx_instruction_3a_imm8_noevex:
  920.         mov     [immediate_size],1
  921.       avx_instruction_3a_noevex:
  922.         or      [vex_required],2
  923.       avx_instruction_3a:
  924.         mov     [opcode_prefix],66h
  925.         mov     [supplemental_code],al
  926.         mov     al,3Ah
  927.         jmp     avx_instruction
  928. avx_pi_instruction_3a_imm8:
  929.         xor     cl,cl
  930.         mov     [immediate_size],1
  931.         jmp     avx_instruction_3a
  932. avx_pclmulqdq_instruction:
  933.         mov     byte [value],al
  934.         mov     [immediate_size],-4
  935.         or      [vex_required],2
  936.         mov     cl,16
  937.         mov     al,44h
  938.         jmp     avx_instruction_3a
  939.  
  940. avx512_single_source_pd_instruction_sae_imm8:
  941.         or      [operand_flags],2
  942. avx512_pd_instruction_sae_imm8:
  943.         or      [rex_prefix],8
  944.         mov     cx,0800h
  945.         jmp     avx512_instruction_sae_imm8
  946. avx512_single_source_ps_instruction_sae_imm8:
  947.         or      [operand_flags],2
  948. avx512_ps_instruction_sae_imm8:
  949.         mov     cx,0400h
  950.         jmp     avx512_instruction_sae_imm8
  951. avx512_sd_instruction_sae_imm8:
  952.         or      [rex_prefix],8
  953.         mov     cx,0008h
  954.         jmp     avx512_instruction_sae_imm8
  955. avx512_ss_instruction_sae_imm8:
  956.         mov     cx,0004h
  957.       avx512_instruction_sae_imm8:
  958.         or      [operand_flags],4
  959.       avx512_instruction_imm8:
  960.         or      [vex_required],8
  961.         mov     [opcode_prefix],66h
  962.         mov     [immediate_size],1
  963.         mov     [supplemental_code],al
  964.         mov     al,3Ah
  965.         jmp     avx_instruction_with_broadcast
  966. avx512_pd_instruction_er:
  967.         or      [operand_flags],4+8
  968.         jmp     avx512_pd_instruction
  969. avx512_single_source_pd_instruction_sae:
  970.         or      [operand_flags],4
  971. avx512_single_source_pd_instruction:
  972.         or      [operand_flags],2
  973. avx512_pd_instruction:
  974.         or      [rex_prefix],8
  975.         mov     cx,0800h
  976.         jmp     avx512_instruction
  977. avx512_ps_instruction_er:
  978.         or      [operand_flags],4+8
  979.         jmp     avx512_ps_instruction
  980. avx512_single_source_ps_instruction_sae:
  981.         or      [operand_flags],4
  982. avx512_single_source_ps_instruction:
  983.         or      [operand_flags],2
  984. avx512_ps_instruction:
  985.         mov     cx,0400h
  986.         jmp     avx512_instruction
  987. avx512_sd_instruction_er:
  988.         or      [operand_flags],8
  989. avx512_sd_instruction_sae:
  990.         or      [operand_flags],4
  991. avx512_sd_instruction:
  992.         or      [rex_prefix],8
  993.         mov     cx,0008h
  994.         jmp     avx512_instruction
  995. avx512_ss_instruction_er:
  996.         or      [operand_flags],8
  997. avx512_ss_instruction_sae:
  998.         or      [operand_flags],4
  999. avx512_ss_instruction:
  1000.         mov     cx,0004h
  1001.       avx512_instruction:
  1002.         or      [vex_required],8
  1003.         mov     [opcode_prefix],66h
  1004.         mov     [supplemental_code],al
  1005.         mov     al,38h
  1006.         jmp     avx_instruction_with_broadcast
  1007. avx512_exp2pd_instruction:
  1008.         or      [rex_prefix],8
  1009.         or      [operand_flags],2+4
  1010.         mov     cx,0840h
  1011.         jmp     avx512_instruction
  1012. avx512_exp2ps_instruction:
  1013.         or      [operand_flags],2+4
  1014.         mov     cx,0440h
  1015.         jmp     avx512_instruction
  1016.  
  1017. fma_instruction_pd:
  1018.         or      [rex_prefix],8
  1019.         mov     cx,0800h
  1020.         jmp     fma_instruction
  1021. fma_instruction_ps:
  1022.         mov     cx,0400h
  1023.         jmp     fma_instruction
  1024. fma_instruction_sd:
  1025.         or      [rex_prefix],8
  1026.         mov     cx,0008h
  1027.         jmp     fma_instruction
  1028. fma_instruction_ss:
  1029.         mov     cx,0004h
  1030.       fma_instruction:
  1031.         or      [operand_flags],4+8
  1032.         mov     [opcode_prefix],66h
  1033.         mov     [supplemental_code],al
  1034.         mov     al,38h
  1035.         jmp     avx_instruction_with_broadcast
  1036.  
  1037. fma4_instruction_p:
  1038.         xor     cl,cl
  1039.         jmp     fma4_instruction
  1040. fma4_instruction_sd:
  1041.         mov     cl,8
  1042.         jmp     fma4_instruction
  1043. fma4_instruction_ss:
  1044.         mov     cl,4
  1045.       fma4_instruction:
  1046.         mov     [immediate_size],-2
  1047.         mov     byte [value],0
  1048.         jmp     avx_instruction_3a_noevex
  1049.  
  1050. avx_cmp_pd_instruction:
  1051.         mov     [opcode_prefix],66h
  1052.         or      [rex_prefix],80h
  1053.         mov     cx,0800h
  1054.         jmp     avx_cmp_instruction
  1055. avx_cmp_ps_instruction:
  1056.         mov     cx,0400h
  1057.         jmp     avx_cmp_instruction
  1058. avx_cmp_sd_instruction:
  1059.         mov     [opcode_prefix],0F2h
  1060.         or      [rex_prefix],80h
  1061.         mov     cx,0008h
  1062.         jmp     avx_cmp_instruction
  1063. avx_cmp_ss_instruction:
  1064.         mov     [opcode_prefix],0F3h
  1065.         mov     cx,0004h
  1066.       avx_cmp_instruction:
  1067.         mov     byte [value],al
  1068.         mov     [immediate_size],-4
  1069.         or      [operand_flags],4+20h
  1070.         mov     al,0C2h
  1071.         jmp     avx_cmp_common
  1072. avx_cmpeqq_instruction:
  1073.         or      [rex_prefix],80h
  1074.         mov     ch,8
  1075.         mov     [supplemental_code],al
  1076.         mov     al,38h
  1077.         jmp     avx_cmp_pi_instruction
  1078. avx_cmpeqd_instruction:
  1079.         mov     ch,4
  1080.         jmp     avx_cmp_pi_instruction
  1081. avx_cmpeqb_instruction:
  1082.         xor     ch,ch
  1083.         jmp     avx_cmp_pi_instruction
  1084. avx512_cmp_uq_instruction:
  1085.         or      [rex_prefix],8
  1086.         mov     ch,8
  1087.         mov     ah,1Eh
  1088.         jmp     avx_cmp_pi_instruction_evex
  1089. avx512_cmp_ud_instruction:
  1090.         mov     ch,4
  1091.         mov     ah,1Eh
  1092.         jmp     avx_cmp_pi_instruction_evex
  1093. avx512_cmp_q_instruction:
  1094.         or      [rex_prefix],8
  1095.         mov     ch,8
  1096.         mov     ah,1Fh
  1097.         jmp     avx_cmp_pi_instruction_evex
  1098. avx512_cmp_d_instruction:
  1099.         mov     ch,4
  1100.         mov     ah,1Fh
  1101.         jmp     avx_cmp_pi_instruction_evex
  1102. avx512_cmp_uw_instruction:
  1103.         or      [rex_prefix],8
  1104. avx512_cmp_ub_instruction:
  1105.         xor     ch,ch
  1106.         mov     ah,3Eh
  1107.         jmp     avx_cmp_pi_instruction_evex
  1108. avx512_cmp_w_instruction:
  1109.         or      [rex_prefix],8
  1110. avx512_cmp_b_instruction:
  1111.         xor     ch,ch
  1112.         mov     ah,3Fh
  1113.       avx_cmp_pi_instruction_evex:
  1114.         mov     byte [value],al
  1115.         mov     [immediate_size],-4
  1116.         mov     [supplemental_code],ah
  1117.         mov     al,3Ah
  1118.         or      [vex_required],8
  1119.       avx_cmp_pi_instruction:
  1120.         xor     cl,cl
  1121.         or      [operand_flags],20h
  1122.         mov     [opcode_prefix],66h
  1123.       avx_cmp_common:
  1124.         mov     [mmx_size],cl
  1125.         mov     [broadcast_size],ch
  1126.         mov     [extended_code],al
  1127.         mov     [base_code],0Fh
  1128.         lods    byte [esi]
  1129.         call    get_size_operator
  1130.         cmp     al,14h
  1131.         je      avx_maskreg
  1132.         cmp     al,10h
  1133.         jne     invalid_operand
  1134.         or      [vex_required],2
  1135.         jmp     avx_reg
  1136.       avx_maskreg:
  1137.         cmp     [operand_size],0
  1138.         jne     invalid_operand_size
  1139.         or      [vex_required],8
  1140.         lods    byte [esi]
  1141.         call    convert_mask_register
  1142.         mov     [postbyte_register],al
  1143.         call    take_avx512_mask
  1144.         jmp     avx_vex_reg
  1145. avx512_fpclasspd_instruction:
  1146.         or      [rex_prefix],8
  1147.         mov     cx,0800h
  1148.         jmp     avx_fpclass_instruction
  1149. avx512_fpclassps_instruction:
  1150.         mov     cx,0400h
  1151.         jmp     avx_fpclass_instruction
  1152. avx512_fpclasssd_instruction:
  1153.         or      [rex_prefix],8
  1154.         mov     cx,0008h
  1155.         jmp     avx_fpclass_instruction
  1156. avx512_fpclassss_instruction:
  1157.         mov     cx,0004h
  1158.       avx_fpclass_instruction:
  1159.         mov     [broadcast_size],ch
  1160.         mov     [mmx_size],cl
  1161.         or      [operand_flags],2
  1162.         call    setup_66_0f_3a
  1163.         mov     [immediate_size],1
  1164.         lods    byte [esi]
  1165.         cmp     al,14h
  1166.         je      avx_maskreg
  1167.         jmp     invalid_operand
  1168. avx512_ptestnmd_instruction:
  1169.         mov     ch,4
  1170.         jmp     avx512_ptestnm_instruction
  1171. avx512_ptestnmq_instruction:
  1172.         or      [rex_prefix],8
  1173.         mov     ch,8
  1174.         jmp     avx512_ptestnm_instruction
  1175. avx512_ptestnmw_instruction:
  1176.         or      [rex_prefix],8
  1177. avx512_ptestnmb_instruction:
  1178.         xor     ch,ch
  1179.       avx512_ptestnm_instruction:
  1180.         mov     ah,0F3h
  1181.         jmp     avx512_ptest_instruction
  1182. avx512_ptestmd_instruction:
  1183.         mov     ch,4
  1184.         jmp     avx512_ptestm_instruction
  1185. avx512_ptestmq_instruction:
  1186.         or      [rex_prefix],8
  1187.         mov     ch,8
  1188.         jmp     avx512_ptestm_instruction
  1189. avx512_ptestmw_instruction:
  1190.         or      [rex_prefix],8
  1191. avx512_ptestmb_instruction:
  1192.         xor     ch,ch
  1193.       avx512_ptestm_instruction:
  1194.         mov     ah,66h
  1195.       avx512_ptest_instruction:
  1196.         xor     cl,cl
  1197.         mov     [opcode_prefix],ah
  1198.         mov     [supplemental_code],al
  1199.         mov     al,38h
  1200.         or      [vex_required],8
  1201.         jmp     avx_cmp_common
  1202.  
  1203. mask_shift_instruction_q:
  1204.         or      [rex_prefix],8
  1205. mask_shift_instruction_d:
  1206.         or      [operand_flags],2
  1207.         or      [immediate_size],1
  1208.         mov     [opcode_prefix],66h
  1209.         mov     [supplemental_code],al
  1210.         mov     al,3Ah
  1211.         jmp     mask_instruction
  1212. mask_instruction_single_source_b:
  1213.         mov     [opcode_prefix],66h
  1214.         jmp     mask_instruction_single_source_w
  1215. mask_instruction_single_source_d:
  1216.         mov     [opcode_prefix],66h
  1217. mask_instruction_single_source_q:
  1218.         or      [rex_prefix],8
  1219. mask_instruction_single_source_w:
  1220.         or      [operand_flags],2
  1221.         jmp     mask_instruction
  1222. mask_instruction_b:
  1223.         mov     [opcode_prefix],66h
  1224.         jmp     mask_instruction_w
  1225. mask_instruction_d:
  1226.         mov     [opcode_prefix],66h
  1227. mask_instruction_q:
  1228.         or      [rex_prefix],8
  1229. mask_instruction_w:
  1230.         mov     [operand_size],32
  1231. mask_instruction:
  1232.         or      [vex_required],1
  1233.         mov     [base_code],0Fh
  1234.         mov     [extended_code],al
  1235.         call    take_mask_register
  1236.         mov     [postbyte_register],al
  1237.         test    [operand_flags],2
  1238.         jnz     mask_instruction_nds_ok
  1239.         lods    byte [esi]
  1240.         cmp     al,','
  1241.         jne     invalid_operand
  1242.         call    take_mask_register
  1243.         mov     [vex_register],al
  1244.       mask_instruction_nds_ok:
  1245.         lods    byte [esi]
  1246.         cmp     al,','
  1247.         jne     invalid_operand
  1248.         call    take_mask_register
  1249.         mov     bl,al
  1250.         cmp     [immediate_size],0
  1251.         jne     mmx_nomem_imm8
  1252.         jmp     nomem_instruction_ready
  1253. take_mask_register:
  1254.         lods    byte [esi]
  1255.         cmp     al,14h
  1256.         jne     invalid_operand
  1257.         lods    byte [esi]
  1258. convert_mask_register:
  1259.         mov     ah,al
  1260.         shr     ah,4
  1261.         cmp     ah,5
  1262.         jne     invalid_operand
  1263.         and     al,1111b
  1264.         ret
  1265. kmov_instruction:
  1266.         mov     [mmx_size],al
  1267.         or      [vex_required],1
  1268.         mov     [base_code],0Fh
  1269.         mov     [extended_code],90h
  1270.         lods    byte [esi]
  1271.         cmp     al,14h
  1272.         je      kmov_maskreg
  1273.         cmp     al,10h
  1274.         je      kmov_reg
  1275.         call    get_size_operator
  1276.         inc     [extended_code]
  1277.         cmp     al,'['
  1278.         jne     invalid_argument
  1279.         call    get_address
  1280.         lods    byte [esi]
  1281.         cmp     al,','
  1282.         jne     invalid_operand
  1283.         call    take_mask_register
  1284.         mov     [postbyte_register],al
  1285.       kmov_with_mem:
  1286.         mov     ah,[mmx_size]
  1287.         mov     al,[operand_size]
  1288.         or      al,al
  1289.         jz      kmov_mem_size_ok
  1290.         cmp     al,ah
  1291.         jne     invalid_operand_size
  1292.       kmov_mem_size_ok:
  1293.         call    setup_kmov_prefix
  1294.         jmp     instruction_ready
  1295.       setup_kmov_prefix:
  1296.         cmp     ah,4
  1297.         jb      kmov_w_ok
  1298.         or      [rex_prefix],8
  1299.       kmov_w_ok:
  1300.         test    ah,1 or 4
  1301.         jz      kmov_prefix_ok
  1302.         mov     [opcode_prefix],66h
  1303.       kmov_prefix_ok:
  1304.         ret
  1305.       kmov_maskreg:
  1306.         lods    byte [esi]
  1307.         call    convert_mask_register
  1308.         mov     [postbyte_register],al
  1309.         lods    byte [esi]
  1310.         cmp     al,','
  1311.         jne     invalid_operand
  1312.         lods    byte [esi]
  1313.         cmp     al,14h
  1314.         je      kmov_maskreg_maskreg
  1315.         cmp     al,10h
  1316.         je      kmov_maskreg_reg
  1317.         call    get_size_operator
  1318.         cmp     al,'['
  1319.         jne     invalid_argument
  1320.         call    get_address
  1321.         jmp     kmov_with_mem
  1322.       kmov_maskreg_maskreg:
  1323.         lods    byte [esi]
  1324.         call    convert_mask_register
  1325.         mov     bl,al
  1326.         mov     ah,[mmx_size]
  1327.         call    setup_kmov_prefix
  1328.         jmp     nomem_instruction_ready
  1329.       kmov_maskreg_reg:
  1330.         add     [extended_code],2
  1331.         lods    byte [esi]
  1332.         call    convert_register
  1333.       kmov_with_reg:
  1334.         mov     bl,al
  1335.         mov     al,[mmx_size]
  1336.         mov     ah,4
  1337.         cmp     al,ah
  1338.         jbe     kmov_reg_size_check
  1339.         mov     ah,al
  1340.       kmov_reg_size_check:
  1341.         cmp     ah,[operand_size]
  1342.         jne     invalid_operand_size
  1343.         cmp     al,8
  1344.         je      kmov_f2_w1
  1345.         cmp     al,2
  1346.         ja      kmov_f2
  1347.         je      nomem_instruction_ready
  1348.         mov     [opcode_prefix],66h
  1349.         jmp     nomem_instruction_ready
  1350.       kmov_f2_w1:
  1351.         or      [rex_prefix],8
  1352.       kmov_f2:
  1353.         mov     [opcode_prefix],0F2h
  1354.         jmp     nomem_instruction_ready
  1355.       kmov_reg:
  1356.         add     [extended_code],3
  1357.         lods    byte [esi]
  1358.         call    convert_register
  1359.         mov     [postbyte_register],al
  1360.         lods    byte [esi]
  1361.         cmp     al,','
  1362.         jne     invalid_operand
  1363.         call    take_mask_register
  1364.         jmp     kmov_with_reg
  1365. avx512_pmov_m2_instruction_w1:
  1366.         or      [rex_prefix],8
  1367. avx512_pmov_m2_instruction:
  1368.         or      [vex_required],8
  1369.         call    setup_f3_0f_38
  1370.         call    take_avx_register
  1371.         mov     [postbyte_register],al
  1372.         lods    byte [esi]
  1373.         cmp     al,','
  1374.         jne     invalid_operand
  1375.         call    take_mask_register
  1376.         mov     bl,al
  1377.         jmp     nomem_instruction_ready
  1378. avx512_pmov_2m_instruction_w1:
  1379.         or      [rex_prefix],8
  1380. avx512_pmov_2m_instruction:
  1381.         or      [vex_required],8
  1382.         call    setup_f3_0f_38
  1383.         call    take_mask_register
  1384.         mov     [postbyte_register],al
  1385.         lods    byte [esi]
  1386.         cmp     al,','
  1387.         jne     invalid_operand
  1388.         call    take_avx_register
  1389.         mov     bl,al
  1390.         jmp     nomem_instruction_ready
  1391.       setup_f3_0f_38:
  1392.         mov     [extended_code],38h
  1393.         mov     [supplemental_code],al
  1394.         mov     [base_code],0Fh
  1395.         mov     [opcode_prefix],0F3h
  1396.         ret
  1397.  
  1398. vzeroall_instruction:
  1399.         mov     [operand_size],32
  1400. vzeroupper_instruction:
  1401.         mov     [base_code],0Fh
  1402.         mov     [extended_code],al
  1403.         and     [displacement_compression],0
  1404.         call    store_vex_instruction_code
  1405.         jmp     instruction_assembled
  1406. vldmxcsr_instruction:
  1407.         or      [vex_required],2
  1408.         jmp     fxsave_instruction
  1409.  
  1410. avx_perm2f128_instruction:
  1411.         or      [vex_required],2
  1412.         xor     ch,ch
  1413.       avx_instruction_imm8_without_128bit:
  1414.         mov     [immediate_size],1
  1415.         mov     ah,3Ah
  1416.         jmp     avx_instruction_without_128bit
  1417. avx512_shuf_q_instruction:
  1418.         or      [rex_prefix],8
  1419.         or      [vex_required],8
  1420.         mov     ch,8
  1421.         jmp     avx_instruction_imm8_without_128bit
  1422. avx512_shuf_d_instruction:
  1423.         or      [vex_required],8
  1424.         mov     ch,4
  1425.         jmp     avx_instruction_imm8_without_128bit
  1426. avx_permd_instruction:
  1427.         mov     ah,38h
  1428.         mov     ch,4
  1429.       avx_instruction_without_128bit:
  1430.         xor     cl,cl
  1431.         call    setup_avx_66_supplemental
  1432.         call    take_avx_register
  1433.         cmp     ah,32
  1434.         jb      invalid_operand_size
  1435.         mov     [postbyte_register],al
  1436.         call    take_avx512_mask
  1437.         jmp     avx_vex_reg
  1438.       setup_avx_66_supplemental:
  1439.         mov     [opcode_prefix],66h
  1440.         mov     [broadcast_size],ch
  1441.         mov     [mmx_size],cl
  1442.         mov     [base_code],0Fh
  1443.         mov     [extended_code],ah
  1444.         mov     [supplemental_code],al
  1445.         or      [vex_required],1
  1446.         ret
  1447. avx_permq_instruction:
  1448.         or      [rex_prefix],8
  1449.         mov     ch,8
  1450.         jmp     avx_permil_instruction
  1451. avx_permilpd_instruction:
  1452.         or      [rex_prefix],80h
  1453.         mov     ch,8
  1454.         jmp     avx_permil_instruction
  1455. avx_permilps_instruction:
  1456.         mov     ch,4
  1457.       avx_permil_instruction:
  1458.         or      [operand_flags],2
  1459.         xor     cl,cl
  1460.         mov     ah,3Ah
  1461.         call    setup_avx_66_supplemental
  1462.         call    take_avx_register
  1463.         cmp     [supplemental_code],4
  1464.         jae     avx_permil_size_ok
  1465.         cmp     ah,32
  1466.         jb      invalid_operand_size
  1467.       avx_permil_size_ok:
  1468.         mov     [postbyte_register],al
  1469.         call    take_avx512_mask
  1470.         lods    byte [esi]
  1471.         cmp     al,','
  1472.         jne     invalid_operand
  1473.         call    take_avx_rm
  1474.         jnc     mmx_imm8
  1475.         mov     bl,al
  1476.         cmp     byte [esi],','
  1477.         jne     invalid_operand
  1478.         mov     al,[esi+1]
  1479.         cmp     al,11h
  1480.         jne     avx_permil_rm_or_imm8
  1481.         mov     al,[esi+3]
  1482.       avx_permil_rm_or_imm8:
  1483.         cmp     al,'('
  1484.         je      mmx_nomem_imm8
  1485.         mov     [vex_register],bl
  1486.         inc     esi
  1487.         mov     [extended_code],38h
  1488.         mov     al,[supplemental_code]
  1489.         cmp     al,4
  1490.         jb      avx_permq_rm
  1491.         add     [supplemental_code],8
  1492.         jmp     avx_regs_rm
  1493.       avx_permq_rm:
  1494.         or      [vex_required],8
  1495.         shl     al,5
  1496.         neg     al
  1497.         add     al,36h
  1498.         mov     [supplemental_code],al
  1499.         jmp     avx_regs_rm
  1500. vpermil_2pd_instruction:
  1501.         mov     [immediate_size],-2
  1502.         mov     byte [value],al
  1503.         mov     al,49h
  1504.         jmp     vpermil2_instruction_setup
  1505. vpermil_2ps_instruction:
  1506.         mov     [immediate_size],-2
  1507.         mov     byte [value],al
  1508.         mov     al,48h
  1509.         jmp     vpermil2_instruction_setup
  1510. vpermil2_instruction:
  1511.         mov     [immediate_size],-3
  1512.         mov     byte [value],0
  1513.       vpermil2_instruction_setup:
  1514.         or      [vex_required],2
  1515.         mov     [base_code],0Fh
  1516.         mov     [supplemental_code],al
  1517.         mov     al,3Ah
  1518.         xor     cl,cl
  1519.         jmp     avx_instruction
  1520.  
  1521. avx_shift_q_instruction_evex:
  1522.         or      [vex_required],8
  1523. avx_shift_q_instruction:
  1524.         or      [rex_prefix],80h
  1525.         mov     cl,8
  1526.         jmp     avx_shift_instruction
  1527. avx_shift_d_instruction:
  1528.         mov     cl,4
  1529.         jmp     avx_shift_instruction
  1530. avx_shift_bw_instruction:
  1531.         xor     cl,cl
  1532.        avx_shift_instruction:
  1533.         mov     [broadcast_size],cl
  1534.         mov     [mmx_size],0
  1535.         mov     [opcode_prefix],66h
  1536.         mov     [base_code],0Fh
  1537.         mov     [extended_code],al
  1538.         or      [vex_required],1
  1539.         call    take_avx_register
  1540.         mov     [postbyte_register],al
  1541.         call    take_avx512_mask
  1542.         lods    byte [esi]
  1543.         cmp     al,','
  1544.         jne     invalid_operand
  1545.         xor     cl,cl
  1546.         xchg    cl,[operand_size]
  1547.         lods    byte [esi]
  1548.         call    get_size_operator
  1549.         cmp     al,'['
  1550.         je      avx_shift_reg_mem
  1551.         mov     [operand_size],cl
  1552.         cmp     al,10h
  1553.         jne     invalid_operand
  1554.         lods    byte [esi]
  1555.         call    convert_avx_register
  1556.         mov     [vex_register],al
  1557.         lods    byte [esi]
  1558.         cmp     al,','
  1559.         jne     invalid_operand
  1560.         push    esi
  1561.         xor     cl,cl
  1562.         xchg    cl,[operand_size]
  1563.         lods    byte [esi]
  1564.         call    get_size_operator
  1565.         cmp     al,10h
  1566.         je      avx_shift_reg_reg_reg
  1567.         pop     esi
  1568.         cmp     al,'['
  1569.         je      avx_shift_reg_reg_mem
  1570.         xchg    cl,[operand_size]
  1571.         test    cl,not 1
  1572.         jnz     invalid_operand_size
  1573.         dec     esi
  1574.         call    convert_avx_shift_opcode
  1575.         mov     bl,al
  1576.         jmp     mmx_nomem_imm8
  1577.       convert_avx_shift_opcode:
  1578.         mov     al,[extended_code]
  1579.         mov     ah,al
  1580.         and     ah,1111b
  1581.         add     ah,70h
  1582.         mov     [extended_code],ah
  1583.         shr     al,4
  1584.         sub     al,0Ch
  1585.         shl     al,1
  1586.         xchg    al,[postbyte_register]
  1587.         xchg    al,[vex_register]
  1588.         ret
  1589.       avx_shift_reg_reg_reg:
  1590.         pop     eax
  1591.         lods    byte [esi]
  1592.         call    convert_xmm_register
  1593.         xchg    cl,[operand_size]
  1594.         mov     bl,al
  1595.         jmp     nomem_instruction_ready
  1596.       avx_shift_reg_reg_mem:
  1597.         mov     [mmx_size],16
  1598.         push    ecx
  1599.         lods    byte [esi]
  1600.         call    get_size_operator
  1601.         call    get_address
  1602.         pop     eax
  1603.         xchg    al,[operand_size]
  1604.         test    al,al
  1605.         jz      instruction_ready
  1606.         cmp     al,16
  1607.         jne     invalid_operand_size
  1608.         jmp     instruction_ready
  1609.       avx_shift_reg_mem:
  1610.         or      [vex_required],8
  1611.         call    take_avx_mem
  1612.         call    convert_avx_shift_opcode
  1613.         jmp     mmx_imm8
  1614. avx_shift_dq_instruction:
  1615.         mov     [postbyte_register],al
  1616.         mov     [opcode_prefix],66h
  1617.         mov     [base_code],0Fh
  1618.         mov     [extended_code],73h
  1619.         or      [vex_required],1
  1620.         mov     [mmx_size],0
  1621.         call    take_avx_register
  1622.         mov     [vex_register],al
  1623.         lods    byte [esi]
  1624.         cmp     al,','
  1625.         jne     invalid_operand
  1626.         lods    byte [esi]
  1627.         call    get_size_operator
  1628.         cmp     al,'['
  1629.         je      avx_shift_dq_reg_mem
  1630.         cmp     al,10h
  1631.         jne     invalid_operand
  1632.         lods    byte [esi]
  1633.         call    convert_avx_register
  1634.         mov     bl,al
  1635.         jmp     mmx_nomem_imm8
  1636.       avx_shift_dq_reg_mem:
  1637.         or      [vex_required],8
  1638.         call    get_address
  1639.         jmp     mmx_imm8
  1640. avx512_rotate_q_instruction:
  1641.         mov     cl,8
  1642.         or      [rex_prefix],cl
  1643.         jmp     avx512_rotate_instruction
  1644. avx512_rotate_d_instruction:
  1645.         mov     cl,4
  1646.       avx512_rotate_instruction:
  1647.         mov     [broadcast_size],cl
  1648.         mov     [postbyte_register],al
  1649.         mov     [opcode_prefix],66h
  1650.         mov     [base_code],0Fh
  1651.         mov     [extended_code],72h
  1652.         or      [vex_required],8
  1653.         mov     [mmx_size],0
  1654.         mov     [immediate_size],1
  1655.         call    take_avx_register
  1656.         mov     [vex_register],al
  1657.         call    take_avx512_mask
  1658.         jmp     avx_vex_reg_ok
  1659.  
  1660. avx_pmovsxbq_instruction:
  1661.         mov     cl,2
  1662.         jmp     avx_pmovsx_instruction
  1663. avx_pmovsxbd_instruction:
  1664.         mov     cl,4
  1665.         jmp     avx_pmovsx_instruction
  1666. avx_pmovsxbw_instruction:
  1667.         mov     cl,8
  1668.       avx_pmovsx_instruction:
  1669.         mov     [mmx_size],cl
  1670.         or      [vex_required],1
  1671.         call    setup_66_0f_38
  1672.         call    take_avx_register
  1673.         mov     [postbyte_register],al
  1674.         call    take_avx512_mask
  1675.         lods    byte [esi]
  1676.         cmp     al,','
  1677.         jne     invalid_operand
  1678.         xor     al,al
  1679.         xchg    al,[operand_size]
  1680.         bsf     ecx,eax
  1681.         sub     cl,4
  1682.         shl     [mmx_size],cl
  1683.         push    eax
  1684.         lods    byte [esi]
  1685.         call    get_size_operator
  1686.         cmp     al,10h
  1687.         je      avx_pmovsx_reg_reg
  1688.         cmp     al,'['
  1689.         jne     invalid_operand
  1690.         call    get_address
  1691.         pop     eax
  1692.         xchg    al,[operand_size]
  1693.         or      al,al
  1694.         jz      instruction_ready
  1695.         cmp     al,[mmx_size]
  1696.         jne     invalid_operand_size
  1697.         jmp     instruction_ready
  1698.       avx_pmovsx_reg_reg:
  1699.         lods    byte [esi]
  1700.         call    convert_avx_register
  1701.         mov     bl,al
  1702.         cmp     ah,[mmx_size]
  1703.         je      avx_pmovsx_xmmreg_reg_size_ok
  1704.         jb      invalid_operand_size
  1705.         cmp     ah,16
  1706.         jne     invalid_operand_size
  1707.       avx_pmovsx_xmmreg_reg_size_ok:
  1708.         pop     eax
  1709.         mov     [operand_size],al
  1710.         jmp     nomem_instruction_ready
  1711. avx512_pmovqb_instruction:
  1712.         mov     cl,2
  1713.         jmp     avx512_pmov_instruction
  1714. avx512_pmovdb_instruction:
  1715.         mov     cl,4
  1716.         jmp     avx512_pmov_instruction
  1717. avx512_pmovwb_instruction:
  1718.         mov     cl,8
  1719.       avx512_pmov_instruction:
  1720.         mov     [mmx_size],cl
  1721.         or      [vex_required],8
  1722.         mov     [extended_code],38h
  1723.         mov     [supplemental_code],al
  1724.         mov     [base_code],0Fh
  1725.         mov     [opcode_prefix],0F3h
  1726.         lods    byte [esi]
  1727.         call    get_size_operator
  1728.         cmp     al,10h
  1729.         je      avx512_pmov_reg
  1730.         cmp     al,'['
  1731.         jne     invalid_operand
  1732.         call    get_address
  1733.         or      [operand_flags],20h
  1734.         call    avx512_pmov_common
  1735.         or      al,al
  1736.         jz      instruction_ready
  1737.         cmp     al,[mmx_size]
  1738.         jne     invalid_operand_size
  1739.         jmp     instruction_ready
  1740.       avx512_pmov_common:
  1741.         call    take_avx512_mask
  1742.         xor     al,al
  1743.         xchg    al,[operand_size]
  1744.         push    eax
  1745.         lods    byte [esi]
  1746.         cmp     al,','
  1747.         jne     invalid_operand
  1748.         call    take_avx_register
  1749.         mov     [postbyte_register],al
  1750.         mov     al,ah
  1751.         mov     ah,cl
  1752.         bsf     ecx,eax
  1753.         sub     cl,4
  1754.         shl     [mmx_size],cl
  1755.         mov     cl,ah
  1756.         pop     eax
  1757.         ret
  1758.       avx512_pmov_reg:
  1759.         lods    byte [esi]
  1760.         call    convert_avx_register
  1761.         mov     bl,al
  1762.         call    avx512_pmov_common
  1763.         cmp     al,[mmx_size]
  1764.         je      nomem_instruction_ready
  1765.         jb      invalid_operand_size
  1766.         cmp     al,16
  1767.         jne     invalid_operand_size
  1768.         jmp     nomem_instruction_ready
  1769.  
  1770. avx_broadcast_128_instruction_noevex:
  1771.         or      [vex_required],2
  1772.         mov     cl,10h
  1773.         jmp     avx_broadcast_instruction
  1774. avx512_broadcast_32x2_instruction:
  1775.         mov     cl,08h
  1776.         jmp     avx_broadcast_instruction_evex
  1777. avx512_broadcast_32x4_instruction:
  1778.         mov     cl,10h
  1779.         jmp     avx_broadcast_instruction_evex
  1780. avx512_broadcast_32x8_instruction:
  1781.         mov     cl,20h
  1782.         jmp     avx_broadcast_instruction_evex
  1783. avx512_broadcast_64x2_instruction:
  1784.         mov     cl,10h
  1785.         jmp     avx_broadcast_instruction_w1_evex
  1786. avx512_broadcast_64x4_instruction:
  1787.         mov     cl,20h
  1788.       avx_broadcast_instruction_w1_evex:
  1789.         or      [rex_prefix],8
  1790.       avx_broadcast_instruction_evex:
  1791.         or      [vex_required],8
  1792.         jmp     avx_broadcast_instruction
  1793. avx_broadcastss_instruction:
  1794.         mov     cl,4
  1795.         jmp     avx_broadcast_instruction
  1796. avx_broadcastsd_instruction:
  1797.         or      [rex_prefix],80h
  1798.         mov     cl,8
  1799.         jmp     avx_broadcast_instruction
  1800. avx_pbroadcastb_instruction:
  1801.         mov     cl,1
  1802.         jmp     avx_broadcast_pi_instruction
  1803. avx_pbroadcastw_instruction:
  1804.         mov     cl,2
  1805.         jmp     avx_broadcast_pi_instruction
  1806. avx_pbroadcastd_instruction:
  1807.         mov     cl,4
  1808.         jmp     avx_broadcast_pi_instruction
  1809. avx_pbroadcastq_instruction:
  1810.         mov     cl,8
  1811.         or      [rex_prefix],80h
  1812.       avx_broadcast_pi_instruction:
  1813.         or      [operand_flags],40h
  1814.       avx_broadcast_instruction:
  1815.         mov     [opcode_prefix],66h
  1816.         mov     [supplemental_code],al
  1817.         mov     al,38h
  1818.         mov     [mmx_size],cl
  1819.         mov     [base_code],0Fh
  1820.         mov     [extended_code],al
  1821.         or      [vex_required],1
  1822.         call    take_avx_register
  1823.         cmp     ah,[mmx_size]
  1824.         je      invalid_operand_size
  1825.         test    [operand_flags],40h
  1826.         jnz     avx_broadcast_destination_size_ok
  1827.         cmp     [mmx_size],4
  1828.         je      avx_broadcast_destination_size_ok
  1829.         cmp     [supplemental_code],59h
  1830.         je      avx_broadcast_destination_size_ok
  1831.         cmp     ah,16
  1832.         je      invalid_operand_size
  1833.       avx_broadcast_destination_size_ok:
  1834.         xor     ah,ah
  1835.         xchg    ah,[operand_size]
  1836.         push    eax
  1837.         call    take_avx512_mask
  1838.         lods    byte [esi]
  1839.         cmp     al,','
  1840.         jne     invalid_operand
  1841.         lods    byte [esi]
  1842.         call    get_size_operator
  1843.         cmp     al,10h
  1844.         je      avx_broadcast_reg_reg
  1845.         cmp     al,'['
  1846.         jne     invalid_operand
  1847.         call    get_address
  1848.         pop     eax
  1849.         xchg    ah,[operand_size]
  1850.         mov     [postbyte_register],al
  1851.         mov     al,[broadcast_size]
  1852.         mov     al,[mmx_size]
  1853.         cmp     al,ah
  1854.         je      instruction_ready
  1855.         or      al,al
  1856.         jz      instruction_ready
  1857.         or      ah,ah
  1858.         jz      instruction_ready
  1859.         jmp     invalid_operand_size
  1860.       avx_broadcast_reg_reg:
  1861.         lods    byte [esi]
  1862.         test    [operand_flags],40h
  1863.         jz      avx_broadcast_reg_avx_reg
  1864.         cmp     al,60h
  1865.         jb      avx_broadcast_reg_general_reg
  1866.         cmp     al,80h
  1867.         jb      avx_broadcast_reg_avx_reg
  1868.         cmp     al,0C0h
  1869.         jb      avx_broadcast_reg_general_reg
  1870.       avx_broadcast_reg_avx_reg:
  1871.         call    convert_avx_register
  1872.         mov     bl,al
  1873.         mov     al,[mmx_size]
  1874.         or      al,al
  1875.         jz      avx_broadcast_reg_avx_reg_size_ok
  1876.         cmp     ah,16
  1877.         jne     invalid_operand_size
  1878.         cmp     al,ah
  1879.         jae     invalid_operand
  1880.       avx_broadcast_reg_avx_reg_size_ok:
  1881.         pop     eax
  1882.         xchg    ah,[operand_size]
  1883.         mov     [postbyte_register],al
  1884.         test    [vex_required],2
  1885.         jnz     invalid_operand
  1886.         jmp     nomem_instruction_ready
  1887.       avx_broadcast_reg_general_reg:
  1888.         call    convert_register
  1889.         mov     bl,al
  1890.         mov     al,[mmx_size]
  1891.         or      al,al
  1892.         jz      avx_broadcast_reg_general_reg_size_ok
  1893.         cmp     al,ah
  1894.         jne     invalid_operand_size
  1895.       avx_broadcast_reg_general_reg_size_ok:
  1896.         cmp     al,4
  1897.         jb      avx_broadcast_reg_general_reg_ready
  1898.         cmp     al,8
  1899.         mov     al,3
  1900.         jne     avx_broadcast_reg_general_reg_ready
  1901.         or      [rex_prefix],8
  1902.       avx_broadcast_reg_general_reg_ready:
  1903.         add     al,7Ah-1
  1904.         mov     [supplemental_code],al
  1905.         or      [vex_required],8
  1906.         pop     eax
  1907.         xchg    ah,[operand_size]
  1908.         mov     [postbyte_register],al
  1909.         jmp     nomem_instruction_ready
  1910.  
  1911. avx512_extract_64x4_instruction:
  1912.         or      [rex_prefix],8
  1913. avx512_extract_32x8_instruction:
  1914.         or      [vex_required],8
  1915.         mov     cl,32
  1916.         jmp     avx_extractf_instruction
  1917. avx512_extract_64x2_instruction:
  1918.         or      [rex_prefix],8
  1919. avx512_extract_32x4_instruction:
  1920.         or      [vex_required],8
  1921.         mov     cl,16
  1922.         jmp     avx_extractf_instruction
  1923. avx_extractf128_instruction:
  1924.         or      [vex_required],2
  1925.         mov     cl,16
  1926.       avx_extractf_instruction:
  1927.         mov     [mmx_size],cl
  1928.         call    setup_66_0f_3a
  1929.         lods    byte [esi]
  1930.         call    get_size_operator
  1931.         cmp     al,10h
  1932.         je      avx_extractf_reg
  1933.         cmp     al,'['
  1934.         jne     invalid_operand
  1935.         call    get_address
  1936.         xor     al,al
  1937.         xchg    al,[operand_size]
  1938.         or      al,al
  1939.         jz      avx_extractf_mem_size_ok
  1940.         cmp     al,[mmx_size]
  1941.         jne     invalid_operand_size
  1942.       avx_extractf_mem_size_ok:
  1943.         call    take_avx512_mask
  1944.         lods    byte [esi]
  1945.         cmp     al,','
  1946.         jne     invalid_operand
  1947.         call    take_avx_register
  1948.         cmp     ah,[mmx_size]
  1949.         jbe     invalid_operand_size
  1950.         mov     [postbyte_register],al
  1951.         jmp     mmx_imm8
  1952.       avx_extractf_reg:
  1953.         lods    byte [esi]
  1954.         call    convert_avx_register
  1955.         cmp     ah,[mmx_size]
  1956.         jne     invalid_operand_size
  1957.         push    eax
  1958.         call    take_avx512_mask
  1959.         mov     [operand_size],0
  1960.         lods    byte [esi]
  1961.         cmp     al,','
  1962.         jne     invalid_operand
  1963.         call    take_avx_register
  1964.         cmp     ah,[mmx_size]
  1965.         jbe     invalid_operand_size
  1966.         mov     [postbyte_register],al
  1967.         pop     ebx
  1968.         jmp     mmx_nomem_imm8
  1969. avx512_insert_64x4_instruction:
  1970.         or      [rex_prefix],8
  1971. avx512_insert_32x8_instruction:
  1972.         or      [vex_required],8
  1973.         mov     cl,32
  1974.         jmp     avx_insertf_instruction
  1975. avx512_insert_64x2_instruction:
  1976.         or      [rex_prefix],8
  1977. avx512_insert_32x4_instruction:
  1978.         or      [vex_required],8
  1979.         mov     cl,16
  1980.         jmp     avx_insertf_instruction
  1981. avx_insertf128_instruction:
  1982.         or      [vex_required],2
  1983.         mov     cl,16
  1984.       avx_insertf_instruction:
  1985.         mov     [mmx_size],cl
  1986.         mov     [broadcast_size],0
  1987.         call    setup_66_0f_3a
  1988.         call    take_avx_register
  1989.         cmp     ah,[mmx_size]
  1990.         jbe     invalid_operand
  1991.         mov     [postbyte_register],al
  1992.         call    take_avx512_mask
  1993.         lods    byte [esi]
  1994.         cmp     al,','
  1995.         jne     invalid_operand
  1996.         call    take_avx_register
  1997.         mov     [vex_register],al
  1998.         mov     al,[mmx_size]
  1999.         xchg    al,[operand_size]
  2000.         push    eax
  2001.         lods    byte [esi]
  2002.         cmp     al,','
  2003.         jne     invalid_operand
  2004.         lods    byte [esi]
  2005.         call    get_size_operator
  2006.         cmp     al,10h
  2007.         je      avx_insertf_reg_reg_reg
  2008.         cmp     al,'['
  2009.         jne     invalid_operand
  2010.         call    get_address
  2011.         pop     eax
  2012.         mov     [operand_size],al
  2013.         jmp     mmx_imm8
  2014.       avx_insertf_reg_reg_reg:
  2015.         lods    byte [esi]
  2016.         call    convert_avx_register
  2017.         mov     bl,al
  2018.         pop     eax
  2019.         mov     [operand_size],al
  2020.         jmp     mmx_nomem_imm8
  2021. avx_extract_b_instruction:
  2022.         mov     cl,1
  2023.         jmp     avx_extract_instruction
  2024. avx_extract_w_instruction:
  2025.         mov     cl,2
  2026.         jmp     avx_extract_instruction
  2027. avx_extract_q_instruction:
  2028.         or      [rex_prefix],8
  2029.         mov     cl,8
  2030.         jmp     avx_extract_instruction
  2031. avx_extract_d_instruction:
  2032.         mov     cl,4
  2033.       avx_extract_instruction:
  2034.         mov     [mmx_size],cl
  2035.         call    setup_66_0f_3a
  2036.         or      [vex_required],1
  2037.         lods    byte [esi]
  2038.         call    get_size_operator
  2039.         cmp     al,10h
  2040.         je      avx_extractps_reg
  2041.         cmp     al,'['
  2042.         jne     invalid_operand
  2043.         call    get_address
  2044.         mov     al,[mmx_size]
  2045.         not     al
  2046.         and     [operand_size],al
  2047.         jnz     invalid_operand_size
  2048.         lods    byte [esi]
  2049.         cmp     al,','
  2050.         jne     invalid_operand
  2051.         lods    byte [esi]
  2052.         call    get_size_operator
  2053.         cmp     al,10h
  2054.         jne     invalid_operand
  2055.         lods    byte [esi]
  2056.         call    convert_avx_register
  2057.         cmp     ah,16
  2058.         jne     invalid_operand_size
  2059.         mov     [postbyte_register],al
  2060.         jmp     mmx_imm8
  2061.       avx_extractps_reg:
  2062.         lods    byte [esi]
  2063.         call    convert_register
  2064.         mov     bl,al
  2065.         mov     al,[mmx_size]
  2066.         cmp     ah,al
  2067.         jb      invalid_operand_size
  2068.         cmp     ah,4
  2069.         je      avx_extractps_reg_size_ok
  2070.         cmp     ah,8
  2071.         jne     invalid_operand_size
  2072.         cmp     [code_type],64
  2073.         jne     invalid_operand
  2074.         cmp     al,4
  2075.         jae     avx_extractps_reg_size_ok
  2076.         or      [rex_prefix],8
  2077.       avx_extractps_reg_size_ok:
  2078.         mov     [operand_size],0
  2079.         lods    byte [esi]
  2080.         cmp     al,','
  2081.         jne     invalid_operand
  2082.         lods    byte [esi]
  2083.         call    get_size_operator
  2084.         cmp     al,10h
  2085.         jne     invalid_operand
  2086.         lods    byte [esi]
  2087.         call    convert_avx_register
  2088.         cmp     ah,16
  2089.         jne     invalid_operand_size
  2090.         mov     [postbyte_register],al
  2091.         cmp     [supplemental_code],15h
  2092.         jne     mmx_nomem_imm8
  2093.         mov     [extended_code],0C5h
  2094.         xchg    bl,[postbyte_register]
  2095.         jmp     mmx_nomem_imm8
  2096. avx_insertps_instruction:
  2097.         mov     [immediate_size],1
  2098.         or      [operand_flags],10h
  2099.         mov     [opcode_prefix],66h
  2100.         mov     [supplemental_code],al
  2101.         mov     al,3Ah
  2102.         mov     cl,4
  2103.         jmp     avx_instruction
  2104. avx_pinsrb_instruction:
  2105.         mov     cl,1
  2106.         jmp     avx_pinsr_instruction_3a
  2107. avx_pinsrw_instruction:
  2108.         mov     cl,2
  2109.         jmp     avx_pinsr_instruction
  2110. avx_pinsrd_instruction:
  2111.         mov     cl,4
  2112.         jmp     avx_pinsr_instruction_3a
  2113. avx_pinsrq_instruction:
  2114.         mov     cl,8
  2115.         or      [rex_prefix],8
  2116.       avx_pinsr_instruction_3a:
  2117.         mov     [supplemental_code],al
  2118.         mov     al,3Ah
  2119.       avx_pinsr_instruction:
  2120.         mov     [opcode_prefix],66h
  2121.         mov     [base_code],0Fh
  2122.         mov     [extended_code],al
  2123.         mov     [mmx_size],cl
  2124.         or      [vex_required],1
  2125.         call    take_avx_register
  2126.         cmp     ah,16
  2127.         jne     invalid_operand_size
  2128.         mov     [postbyte_register],al
  2129.         lods    byte [esi]
  2130.         cmp     al,','
  2131.         jne     invalid_operand
  2132.         call    take_avx_register
  2133.         mov     [vex_register],al
  2134.         jmp     pinsr_xmmreg
  2135.  
  2136. avx_cvtudq2pd_instruction:
  2137.         or      [vex_required],8
  2138. avx_cvtdq2pd_instruction:
  2139.         mov     [opcode_prefix],0F3h
  2140.         mov     cl,4
  2141.         jmp     avx_cvt_d_instruction
  2142. avx_cvtps2qq_instruction:
  2143.         or      [operand_flags],8
  2144. avx_cvttps2qq_instruction:
  2145.         or      [operand_flags],4
  2146.         or      [vex_required],8
  2147.         mov     [opcode_prefix],66h
  2148.         mov     cl,4
  2149.         jmp     avx_cvt_d_instruction
  2150. avx_cvtps2pd_instruction:
  2151.         or      [operand_flags],4
  2152.         mov     cl,4
  2153.       avx_cvt_d_instruction:
  2154.         mov     [base_code],0Fh
  2155.         mov     [extended_code],al
  2156.         or      [vex_required],1
  2157.         mov     [broadcast_size],cl
  2158.         call    take_avx_register
  2159.         mov     [postbyte_register],al
  2160.         call    take_avx512_mask
  2161.         lods    byte [esi]
  2162.         cmp     al,','
  2163.         jne     invalid_operand
  2164.         xor     ecx,ecx
  2165.         xchg    cl,[operand_size]
  2166.         mov     al,cl
  2167.         shr     al,1
  2168.         mov     [mmx_size],al
  2169.         lods    byte [esi]
  2170.         call    get_size_operator
  2171.         cmp     al,'['
  2172.         je      avx_cvt_d_reg_mem
  2173.         cmp     al,10h
  2174.         jne     invalid_operand
  2175.         mov     [operand_size],0
  2176.         lods    byte [esi]
  2177.         call    convert_avx_register
  2178.         cmp     ah,[mmx_size]
  2179.         je      avx_cvt_d_reg_reg_size_ok
  2180.         jb      invalid_operand_size
  2181.         cmp     ah,16
  2182.         jne     invalid_operand_size
  2183.       avx_cvt_d_reg_reg_size_ok:
  2184.         mov     bl,al
  2185.         mov     [operand_size],cl
  2186.         call    take_avx512_rounding
  2187.         jmp     nomem_instruction_ready
  2188.       avx_cvt_d_reg_mem:
  2189.         call    take_avx_mem
  2190.         jmp     instruction_ready
  2191. avx_cvtpd2dq_instruction:
  2192.         or      [operand_flags],4+8
  2193.         mov     [opcode_prefix],0F2h
  2194.         jmp     avx_cvt_q_instruction
  2195. avx_cvtuqq2ps_instruction:
  2196.         mov     [opcode_prefix],0F2h
  2197. avx_cvtpd2udq_instruction:
  2198.         or      [operand_flags],8
  2199. avx_cvttpd2udq_instruction:
  2200.         or      [operand_flags],4
  2201.         or      [vex_required],8
  2202.         jmp     avx_cvt_q_instruction
  2203. avx_cvtpd2ps_instruction:
  2204.         or      [operand_flags],8
  2205. avx_cvttpd2dq_instruction:
  2206.         or      [operand_flags],4
  2207.         mov     [opcode_prefix],66h
  2208.       avx_cvt_q_instruction:
  2209.         mov     [broadcast_size],8
  2210.         mov     [base_code],0Fh
  2211.         mov     [extended_code],al
  2212.         or      [vex_required],1
  2213.         or      [rex_prefix],80h
  2214.         call    take_avx_register
  2215.         mov     [postbyte_register],al
  2216.         push    eax
  2217.         call    take_avx512_mask
  2218.         lods    byte [esi]
  2219.         cmp     al,','
  2220.         jne     invalid_operand
  2221.         xor     al,al
  2222.         mov     [operand_size],al
  2223.         mov     [mmx_size],al
  2224.         call    take_avx_rm
  2225.         jnc     avx_cvt_q_reg_mem
  2226.         mov     bl,al
  2227.         pop     eax
  2228.         call    avx_cvt_q_check_size
  2229.         call    take_avx512_rounding
  2230.         jmp     nomem_instruction_ready
  2231.       avx_cvt_q_reg_mem:
  2232.         pop     eax
  2233.         call    avx_cvt_q_check_size
  2234.         jmp     instruction_ready
  2235.       avx_cvt_q_check_size:
  2236.         mov     al,[operand_size]
  2237.         or      al,al
  2238.         jz      avx_cvt_q_size_not_specified
  2239.         shr     al,1
  2240.         cmp     al,ah
  2241.         je      avx_cvt_q_size_ok
  2242.         ja      invalid_operand_size
  2243.         cmp     ah,16
  2244.         jne     invalid_operand_size
  2245.       avx_cvt_q_size_ok:
  2246.         ret
  2247.       avx_cvt_q_size_not_specified:
  2248.         cmp     ah,64 shr 1
  2249.         jne     recoverable_unknown_size
  2250.         mov     [operand_size],64
  2251.         ret
  2252. avx_cvttps2udq_instruction:
  2253.         or      [vex_required],8
  2254.         or      [operand_flags],2+4
  2255.         mov     cx,0400h
  2256.         jmp     avx_instruction_with_broadcast
  2257. avx_cvttps2dq_instruction:
  2258.         mov     [opcode_prefix],0F3h
  2259.         or      [operand_flags],2+4
  2260.         mov     cx,0400h
  2261.         jmp     avx_instruction_with_broadcast
  2262. avx_cvtph2ps_instruction:
  2263.         mov     [opcode_prefix],66h
  2264.         mov     [supplemental_code],al
  2265.         or      [operand_flags],4
  2266.         mov     al,38h
  2267.         xor     cl,cl
  2268.         jmp     avx_cvt_d_instruction
  2269. avx_cvtps2ph_instruction:
  2270.         call    setup_66_0f_3a
  2271.         or      [vex_required],1
  2272.         or      [operand_flags],4
  2273.         lods    byte [esi]
  2274.         call    get_size_operator
  2275.         cmp     al,10h
  2276.         je      vcvtps2ph_reg
  2277.         cmp     al,'['
  2278.         jne     invalid_operand
  2279.         call    get_address
  2280.         call    take_avx512_mask
  2281.         lods    byte [esi]
  2282.         cmp     al,','
  2283.         jne     invalid_operand
  2284.         shl     [operand_size],1
  2285.         call    take_avx_register
  2286.         mov     [postbyte_register],al
  2287.         shr     ah,1
  2288.         mov     [mmx_size],ah
  2289.         jmp     mmx_imm8
  2290.       vcvtps2ph_reg:
  2291.         lods    byte [esi]
  2292.         call    convert_avx_register
  2293.         mov     bl,al
  2294.         call    take_avx512_mask
  2295.         xor     cl,cl
  2296.         xchg    cl,[operand_size]
  2297.         shl     cl,1
  2298.         lods    byte [esi]
  2299.         cmp     al,','
  2300.         jne     invalid_operand
  2301.         call    take_avx_register
  2302.         mov     [postbyte_register],al
  2303.         or      cl,cl
  2304.         jz      vcvtps2ph_reg_size_ok
  2305.         cmp     cl,ah
  2306.         je      vcvtps2ph_reg_size_ok
  2307.         jb      invalid_operand_size
  2308.         cmp     ah,16
  2309.         jne     invalid_operand_size
  2310.       vcvtps2ph_reg_size_ok:
  2311.         call    take_avx512_rounding
  2312.         jmp     mmx_nomem_imm8
  2313.  
  2314. avx_cvtsd2usi_instruction:
  2315.         or      [operand_flags],8
  2316. avx_cvttsd2usi_instruction:
  2317.         or      [vex_required],8
  2318.         jmp     avx_cvttsd2si_instruction
  2319. avx_cvtsd2si_instruction:
  2320.         or      [operand_flags],8
  2321. avx_cvttsd2si_instruction:
  2322.         mov     ah,0F2h
  2323.         mov     cl,8
  2324.         jmp     avx_cvt_2si_instruction
  2325. avx_cvtss2usi_instruction:
  2326.         or      [operand_flags],8
  2327. avx_cvttss2usi_instruction:
  2328.         or      [vex_required],8
  2329.         jmp     avx_cvttss2si_instruction
  2330. avx_cvtss2si_instruction:
  2331.         or      [operand_flags],8
  2332. avx_cvttss2si_instruction:
  2333.         mov     ah,0F3h
  2334.         mov     cl,4
  2335.       avx_cvt_2si_instruction:
  2336.         or      [operand_flags],2+4
  2337.         mov     [mmx_size],cl
  2338.         mov     [broadcast_size],0
  2339.         mov     [opcode_prefix],ah
  2340.         mov     [base_code],0Fh
  2341.         mov     [extended_code],al
  2342.         or      [vex_required],1
  2343.         lods    byte [esi]
  2344.         call    get_size_operator
  2345.         cmp     al,10h
  2346.         jne     invalid_operand
  2347.         lods    byte [esi]
  2348.         call    convert_register
  2349.         mov     [postbyte_register],al
  2350.         mov     [operand_size],0
  2351.         cmp     ah,4
  2352.         je      avx_cvt_2si_reg
  2353.         cmp     ah,8
  2354.         jne     invalid_operand_size
  2355.         call    operand_64bit
  2356.       avx_cvt_2si_reg:
  2357.         lods    byte [esi]
  2358.         cmp     al,','
  2359.         jne     invalid_operand
  2360.         call    take_avx_rm
  2361.         jnc     instruction_ready
  2362.         mov     bl,al
  2363.         call    take_avx512_rounding
  2364.         jmp     nomem_instruction_ready
  2365. avx_cvtusi2sd_instruction:
  2366.         or      [vex_required],8
  2367. avx_cvtsi2sd_instruction:
  2368.         mov     ah,0F2h
  2369.         mov     cl,8
  2370.         jmp     avx_cvtsi_instruction
  2371. avx_cvtusi2ss_instruction:
  2372.         or      [vex_required],8
  2373. avx_cvtsi2ss_instruction:
  2374.         mov     ah,0F3h
  2375.         mov     cl,4
  2376.       avx_cvtsi_instruction:
  2377.         or      [operand_flags],2+4+8
  2378.         mov     [mmx_size],cl
  2379.         mov     [opcode_prefix],ah
  2380.         mov     [base_code],0Fh
  2381.         mov     [extended_code],al
  2382.         or      [vex_required],1
  2383.         call    take_avx_register
  2384.         cmp     ah,16
  2385.         jne     invalid_operand_size
  2386.         mov     [postbyte_register],al
  2387.         lods    byte [esi]
  2388.         cmp     al,','
  2389.         jne     invalid_operand
  2390.         call    take_avx_register
  2391.         mov     [vex_register],al
  2392.         lods    byte [esi]
  2393.         cmp     al,','
  2394.         jne     invalid_operand
  2395.         mov     [operand_size],0
  2396.         lods    byte [esi]
  2397.         call    get_size_operator
  2398.         cmp     al,'['
  2399.         je      avx_cvtsi_reg_reg_mem
  2400.         cmp     al,10h
  2401.         jne     invalid_operand
  2402.         lods    byte [esi]
  2403.         call    convert_register
  2404.         mov     bl,al
  2405.         cmp     ah,4
  2406.         je      avx_cvtsi_reg_reg_reg32
  2407.         cmp     ah,8
  2408.         jne     invalid_operand_size
  2409.         call    operand_64bit
  2410.       avx_cvtsi_rounding:
  2411.         call    take_avx512_rounding
  2412.         jmp     nomem_instruction_ready
  2413.       avx_cvtsi_reg_reg_reg32:
  2414.         cmp     [mmx_size],8
  2415.         jne     avx_cvtsi_rounding
  2416.         jmp     nomem_instruction_ready
  2417.       avx_cvtsi_reg_reg_mem:
  2418.         call    get_address
  2419.         mov     al,[operand_size]
  2420.         mov     [mmx_size],al
  2421.         or      al,al
  2422.         jz      single_mem_nosize
  2423.         cmp     al,4
  2424.         je      instruction_ready
  2425.         cmp     al,8
  2426.         jne     invalid_operand_size
  2427.         call    operand_64bit
  2428.         jmp     instruction_ready
  2429.  
  2430. avx_maskmov_w1_instruction:
  2431.         or      [rex_prefix],8
  2432. avx_maskmov_instruction:
  2433.         call    setup_66_0f_38
  2434.         mov     [mmx_size],0
  2435.         or      [vex_required],2
  2436.         lods    byte [esi]
  2437.         call    get_size_operator
  2438.         cmp     al,10h
  2439.         jne     avx_maskmov_mem
  2440.         lods    byte [esi]
  2441.         call    convert_avx_register
  2442.         mov     [postbyte_register],al
  2443.         lods    byte [esi]
  2444.         cmp     al,','
  2445.         jne     invalid_operand
  2446.         call    take_avx_register
  2447.         mov     [vex_register],al
  2448.         lods    byte [esi]
  2449.         cmp     al,','
  2450.         jne     invalid_operand
  2451.         lods    byte [esi]
  2452.         cmp     al,'['
  2453.         jne     invalid_operand
  2454.         call    get_address
  2455.         jmp     instruction_ready
  2456.       avx_maskmov_mem:
  2457.         cmp     al,'['
  2458.         jne     invalid_operand
  2459.         call    get_address
  2460.         lods    byte [esi]
  2461.         cmp     al,','
  2462.         jne     invalid_operand
  2463.         call    take_avx_register
  2464.         mov     [vex_register],al
  2465.         lods    byte [esi]
  2466.         cmp     al,','
  2467.         jne     invalid_operand
  2468.         call    take_avx_register
  2469.         mov     [postbyte_register],al
  2470.         add     [supplemental_code],2
  2471.         jmp     instruction_ready
  2472. avx_movmskpd_instruction:
  2473.         mov     [opcode_prefix],66h
  2474. avx_movmskps_instruction:
  2475.         mov     [base_code],0Fh
  2476.         mov     [extended_code],50h
  2477.         or      [vex_required],2
  2478.         lods    byte [esi]
  2479.         call    get_size_operator
  2480.         cmp     al,10h
  2481.         jne     invalid_operand
  2482.         lods    byte [esi]
  2483.         call    convert_register
  2484.         mov     [postbyte_register],al
  2485.         cmp     ah,4
  2486.         je      avx_movmskps_reg_ok
  2487.         cmp     ah,8
  2488.         jne     invalid_operand_size
  2489.         cmp     [code_type],64
  2490.         jne     invalid_operand
  2491.       avx_movmskps_reg_ok:
  2492.         mov     [operand_size],0
  2493.         lods    byte [esi]
  2494.         cmp     al,','
  2495.         jne     invalid_operand
  2496.         call    take_avx_register
  2497.         mov     bl,al
  2498.         jmp     nomem_instruction_ready
  2499. avx_maskmovdqu_instruction:
  2500.         or      [vex_required],2
  2501.         jmp     maskmovdqu_instruction
  2502. avx_pmovmskb_instruction:
  2503.         or      [vex_required],2
  2504.         mov     [opcode_prefix],66h
  2505.         mov     [base_code],0Fh
  2506.         mov     [extended_code],al
  2507.         lods    byte [esi]
  2508.         call    get_size_operator
  2509.         cmp     al,10h
  2510.         jne     invalid_operand
  2511.         lods    byte [esi]
  2512.         call    convert_register
  2513.         cmp     ah,4
  2514.         je      avx_pmovmskb_reg_size_ok
  2515.         cmp     [code_type],64
  2516.         jne     invalid_operand_size
  2517.         cmp     ah,8
  2518.         jnz     invalid_operand_size
  2519.       avx_pmovmskb_reg_size_ok:
  2520.         mov     [postbyte_register],al
  2521.         mov     [operand_size],0
  2522.         lods    byte [esi]
  2523.         cmp     al,','
  2524.         jne     invalid_operand
  2525.         call    take_avx_register
  2526.         mov     bl,al
  2527.         jmp     nomem_instruction_ready
  2528.  
  2529. gather_pd_instruction:
  2530.         or      [rex_prefix],8
  2531. gather_ps_instruction:
  2532.         call    setup_66_0f_38
  2533.         or      [vex_required],4
  2534.         or      [operand_flags],20h
  2535.         call    take_avx_register
  2536.         mov     [postbyte_register],al
  2537.         call    take_avx512_mask
  2538.         lods    byte [esi]
  2539.         cmp     al,','
  2540.         jne     invalid_operand
  2541.         xor     cl,cl
  2542.         xchg    cl,[operand_size]
  2543.         push    ecx
  2544.         lods    byte [esi]
  2545.         call    get_size_operator
  2546.         cmp     al,'['
  2547.         jne     invalid_argument
  2548.         call    get_address
  2549.         pop     eax
  2550.         xchg    al,[operand_size]
  2551.       gather_mem_size_check:
  2552.         mov     ah,4
  2553.         test    [rex_prefix],8
  2554.         jz      gather_elements_size_ok
  2555.         add     ah,ah
  2556.       gather_elements_size_ok:
  2557.         mov     [mmx_size],ah
  2558.         test    al,al
  2559.         jz      gather_mem_size_ok
  2560.         cmp     al,ah
  2561.         jne     invalid_operand_size
  2562.       gather_mem_size_ok:
  2563.         cmp     byte [esi],','
  2564.         je      gather_reg_mem_reg
  2565.         test    [vex_required],20h
  2566.         jz      invalid_operand
  2567.         mov     ah,[operand_size]
  2568.         mov     al,80h
  2569.         jmp     gather_arguments_ok
  2570.       gather_reg_mem_reg:
  2571.         or      [vex_required],2
  2572.         inc     esi
  2573.         call    take_avx_register
  2574.       gather_arguments_ok:
  2575.         mov     [vex_register],al
  2576.         cmp     al,[postbyte_register]
  2577.         je      disallowed_combination_of_registers
  2578.         mov     al,bl
  2579.         and     al,11111b
  2580.         cmp     al,[postbyte_register]
  2581.         je      disallowed_combination_of_registers
  2582.         cmp     al,[vex_register]
  2583.         je      disallowed_combination_of_registers
  2584.         mov     al,bl
  2585.         shr     al,5
  2586.         cmp     al,0Ch shr 1
  2587.         je      gather_vr128
  2588.         mov     ah,32
  2589.         cmp     al,6 shr 1
  2590.         jne     gather_regular
  2591.         add     ah,ah
  2592.       gather_regular:
  2593.         mov     al,[rex_prefix]
  2594.         shr     al,3
  2595.         xor     al,[supplemental_code]
  2596.         test    al,1
  2597.         jz      gather_uniform
  2598.         test    [supplemental_code],1
  2599.         jz      gather_double
  2600.         mov     al,ah
  2601.         xchg    al,[operand_size]
  2602.         add     al,al
  2603.         cmp     al,ah
  2604.         jne     invalid_operand_size
  2605.         jmp     instruction_ready
  2606.       gather_double:
  2607.         add     ah,ah
  2608.       gather_uniform:
  2609.         cmp     ah,[operand_size]
  2610.         jne     invalid_operand_size
  2611.         jmp     instruction_ready
  2612.       gather_vr128:
  2613.         cmp     ah,16
  2614.         je      instruction_ready
  2615.         cmp     ah,32
  2616.         jne     invalid_operand_size
  2617.         test    [supplemental_code],1
  2618.         jnz     invalid_operand_size
  2619.         test    [rex_prefix],8
  2620.         jz      invalid_operand_size
  2621.         jmp     instruction_ready
  2622. scatter_pd_instruction:
  2623.         or      [rex_prefix],8
  2624. scatter_ps_instruction:
  2625.         call    setup_66_0f_38
  2626.         or      [vex_required],4+8
  2627.         or      [operand_flags],20h
  2628.         lods    byte [esi]
  2629.         call    get_size_operator
  2630.         cmp     al,'['
  2631.         jne     invalid_argument
  2632.         call    get_address
  2633.         call    take_avx512_mask
  2634.         lods    byte [esi]
  2635.         cmp     al,','
  2636.         jne     invalid_operand
  2637.         xor     al,al
  2638.         xchg    al,[operand_size]
  2639.         push    eax
  2640.         call    take_avx_register
  2641.         mov     [postbyte_register],al
  2642.         pop     eax
  2643.         jmp     gather_mem_size_check
  2644. gatherpf_qpd_instruction:
  2645.         mov     ah,0C7h
  2646.         jmp     gatherpf_pd_instruction
  2647. gatherpf_dpd_instruction:
  2648.         mov     ah,0C6h
  2649.       gatherpf_pd_instruction:
  2650.         or      [rex_prefix],8
  2651.         mov     cl,8
  2652.         jmp     gatherpf_instruction
  2653. gatherpf_qps_instruction:
  2654.         mov     ah,0C7h
  2655.         jmp     gatherpf_ps_instruction
  2656. gatherpf_dps_instruction:
  2657.         mov     ah,0C6h
  2658.       gatherpf_ps_instruction:
  2659.         mov     cl,4
  2660.       gatherpf_instruction:
  2661.         mov     [mmx_size],cl
  2662.         mov     [postbyte_register],al
  2663.         mov     al,ah
  2664.         call    setup_66_0f_38
  2665.         or      [vex_required],4+8
  2666.         or      [operand_flags],20h
  2667.         lods    byte [esi]
  2668.         call    get_size_operator
  2669.         cmp     al,'['
  2670.         jne     invalid_argument
  2671.         call    get_address
  2672.         call    take_avx512_mask
  2673.         mov     ah,[mmx_size]
  2674.         mov     al,[operand_size]
  2675.         or      al,al
  2676.         jz      gatherpf_mem_size_ok
  2677.         cmp     al,ah
  2678.         jne     invalid_operand_size
  2679.       gatherpf_mem_size_ok:
  2680.         mov     [operand_size],64
  2681.         mov     al,6 shr 1
  2682.         cmp     ah,4
  2683.         je      gatherpf_check_vsib
  2684.         cmp     [supplemental_code],0C6h
  2685.         jne     gatherpf_check_vsib
  2686.         mov     al,0Eh shr 1
  2687.       gatherpf_check_vsib:
  2688.         mov     ah,bl
  2689.         shr     ah,5
  2690.         cmp     al,ah
  2691.         jne     invalid_operand
  2692.         jmp     instruction_ready
  2693.  
  2694. bmi_instruction:
  2695.         mov     [base_code],0Fh
  2696.         mov     [extended_code],38h
  2697.         mov     [supplemental_code],0F3h
  2698.         mov     [postbyte_register],al
  2699.       bmi_reg:
  2700.         or      [vex_required],2
  2701.         lods    byte [esi]
  2702.         call    get_size_operator
  2703.         cmp     al,10h
  2704.         jne     invalid_operand
  2705.         lods    byte [esi]
  2706.         call    convert_register
  2707.         mov     [vex_register],al
  2708.         lods    byte [esi]
  2709.         cmp     al,','
  2710.         jne     invalid_operand
  2711.         lods    byte [esi]
  2712.         call    get_size_operator
  2713.         cmp     al,10h
  2714.         je      bmi_reg_reg
  2715.         cmp     al,'['
  2716.         jne     invalid_argument
  2717.         call    get_address
  2718.         call    operand_32or64
  2719.         jmp     instruction_ready
  2720.       bmi_reg_reg:
  2721.         lods    byte [esi]
  2722.         call    convert_register
  2723.         mov     bl,al
  2724.         call    operand_32or64
  2725.         jmp     nomem_instruction_ready
  2726.       operand_32or64:
  2727.         mov     al,[operand_size]
  2728.         cmp     al,4
  2729.         je      operand_32or64_ok
  2730.         cmp     al,8
  2731.         jne     invalid_operand_size
  2732.         cmp     [code_type],64
  2733.         jne     invalid_operand
  2734.         or      [rex_prefix],8
  2735.       operand_32or64_ok:
  2736.         ret
  2737. pdep_instruction:
  2738.         mov     [opcode_prefix],0F2h
  2739.         jmp     andn_instruction
  2740. pext_instruction:
  2741.         mov     [opcode_prefix],0F3h
  2742. andn_instruction:
  2743.         mov     [base_code],0Fh
  2744.         mov     [extended_code],38h
  2745.         mov     [supplemental_code],al
  2746.         or      [vex_required],2
  2747.         lods    byte [esi]
  2748.         call    get_size_operator
  2749.         cmp     al,10h
  2750.         jne     invalid_operand
  2751.         lods    byte [esi]
  2752.         call    convert_register
  2753.         mov     [postbyte_register],al
  2754.         lods    byte [esi]
  2755.         cmp     al,','
  2756.         jne     invalid_operand
  2757.         jmp     bmi_reg
  2758. sarx_instruction:
  2759.         mov     [opcode_prefix],0F3h
  2760.         jmp     bzhi_instruction
  2761. shrx_instruction:
  2762.         mov     [opcode_prefix],0F2h
  2763.         jmp     bzhi_instruction
  2764. shlx_instruction:
  2765.         mov     [opcode_prefix],66h
  2766. bzhi_instruction:
  2767.         mov     [base_code],0Fh
  2768.         mov     [extended_code],38h
  2769.         mov     [supplemental_code],al
  2770.         or      [vex_required],2
  2771.         call    get_reg_mem
  2772.         jc      bzhi_reg_reg
  2773.         call    get_vex_source_register
  2774.         jc      invalid_operand
  2775.         call    operand_32or64
  2776.         jmp     instruction_ready
  2777.       bzhi_reg_reg:
  2778.         call    get_vex_source_register
  2779.         jc      invalid_operand
  2780.         call    operand_32or64
  2781.         jmp     nomem_instruction_ready
  2782.       get_vex_source_register:
  2783.         lods    byte [esi]
  2784.         cmp     al,','
  2785.         jne     invalid_operand
  2786.         lods    byte [esi]
  2787.         call    get_size_operator
  2788.         cmp     al,10h
  2789.         jne     no_vex_source_register
  2790.         lods    byte [esi]
  2791.         call    convert_register
  2792.         mov     [vex_register],al
  2793.         clc
  2794.         ret
  2795.       no_vex_source_register:
  2796.         stc
  2797.         ret
  2798. bextr_instruction:
  2799.         mov     [base_code],0Fh
  2800.         mov     [extended_code],38h
  2801.         mov     [supplemental_code],al
  2802.         or      [vex_required],2
  2803.         call    get_reg_mem
  2804.         jc      bextr_reg_reg
  2805.         call    get_vex_source_register
  2806.         jc      bextr_reg_mem_imm32
  2807.         call    operand_32or64
  2808.         jmp     instruction_ready
  2809.       bextr_reg_reg:
  2810.         call    get_vex_source_register
  2811.         jc      bextr_reg_reg_imm32
  2812.         call    operand_32or64
  2813.         jmp     nomem_instruction_ready
  2814.       setup_bextr_imm_opcode:
  2815.         mov     [xop_opcode_map],0Ah
  2816.         mov     [base_code],10h
  2817.         call    operand_32or64
  2818.         ret
  2819.       bextr_reg_mem_imm32:
  2820.         call    get_imm32
  2821.         call    setup_bextr_imm_opcode
  2822.         jmp     store_instruction_with_imm32
  2823.       bextr_reg_reg_imm32:
  2824.         call    get_imm32
  2825.         call    setup_bextr_imm_opcode
  2826.       store_nomem_instruction_with_imm32:
  2827.         call    store_nomem_instruction
  2828.         mov     eax,dword [value]
  2829.         call    mark_relocation
  2830.         stos    dword [edi]
  2831.         jmp     instruction_assembled
  2832.       get_imm32:
  2833.         cmp     al,'('
  2834.         jne     invalid_operand
  2835.         push    edx ebx ecx
  2836.         call    get_dword_value
  2837.         mov     dword [value],eax
  2838.         pop     ecx ebx edx
  2839.         ret
  2840. rorx_instruction:
  2841.         mov     [opcode_prefix],0F2h
  2842.         mov     [base_code],0Fh
  2843.         mov     [extended_code],3Ah
  2844.         mov     [supplemental_code],al
  2845.         or      [vex_required],2
  2846.         call    get_reg_mem
  2847.         jc      rorx_reg_reg
  2848.         call    operand_32or64
  2849.         jmp     mmx_imm8
  2850.       rorx_reg_reg:
  2851.         call    operand_32or64
  2852.         jmp     mmx_nomem_imm8
  2853.  
  2854. tbm_instruction:
  2855.         mov     [xop_opcode_map],9
  2856.         mov     ah,al
  2857.         shr     ah,4
  2858.         and     al,111b
  2859.         mov     [base_code],ah
  2860.         mov     [postbyte_register],al
  2861.         jmp     bmi_reg
  2862.  
  2863. llwpcb_instruction:
  2864.         or      [vex_required],2
  2865.         mov     [xop_opcode_map],9
  2866.         mov     [base_code],12h
  2867.         mov     [postbyte_register],al
  2868.         lods    byte [esi]
  2869.         call    get_size_operator
  2870.         cmp     al,10h
  2871.         jne     invalid_operand
  2872.         lods    byte [esi]
  2873.         call    convert_register
  2874.         mov     bl,al
  2875.         call    operand_32or64
  2876.         jmp     nomem_instruction_ready
  2877. lwpins_instruction:
  2878.         or      [vex_required],2
  2879.         mov     [xop_opcode_map],0Ah
  2880.         mov     [base_code],12h
  2881.         mov     [vex_register],al
  2882.         lods    byte [esi]
  2883.         call    get_size_operator
  2884.         cmp     al,10h
  2885.         jne     invalid_operand
  2886.         lods    byte [esi]
  2887.         call    convert_register
  2888.         mov     [postbyte_register],al
  2889.         lods    byte [esi]
  2890.         cmp     al,','
  2891.         jne     invalid_operand
  2892.         xor     cl,cl
  2893.         xchg    cl,[operand_size]
  2894.         lods    byte [esi]
  2895.         call    get_size_operator
  2896.         cmp     al,10h
  2897.         je      lwpins_reg_reg
  2898.         cmp     al,'['
  2899.         jne     invalid_argument
  2900.         push    ecx
  2901.         call    get_address
  2902.         pop     eax
  2903.         xchg    al,[operand_size]
  2904.         test    al,al
  2905.         jz      lwpins_reg_mem_size_ok
  2906.         cmp     al,4
  2907.         jne     invalid_operand_size
  2908.       lwpins_reg_mem_size_ok:
  2909.         call    prepare_lwpins
  2910.         jmp     store_instruction_with_imm32
  2911.       lwpins_reg_reg:
  2912.         lods    byte [esi]
  2913.         call    convert_register
  2914.         cmp     ah,4
  2915.         jne     invalid_operand_size
  2916.         mov     [operand_size],cl
  2917.         mov     bl,al
  2918.         call    prepare_lwpins
  2919.         jmp     store_nomem_instruction_with_imm32
  2920.       prepare_lwpins:
  2921.         lods    byte [esi]
  2922.         cmp     al,','
  2923.         jne     invalid_operand
  2924.         lods    byte [esi]
  2925.         call    get_imm32
  2926.         call    operand_32or64
  2927.         mov     al,[vex_register]
  2928.         xchg    al,[postbyte_register]
  2929.         mov     [vex_register],al
  2930.         ret
  2931.  
  2932. xop_single_source_sd_instruction:
  2933.         or      [operand_flags],2
  2934.         mov     [mmx_size],8
  2935.         jmp     xop_instruction_9
  2936. xop_single_source_ss_instruction:
  2937.         or      [operand_flags],2
  2938.         mov     [mmx_size],4
  2939.         jmp     xop_instruction_9
  2940. xop_single_source_instruction:
  2941.         or      [operand_flags],2
  2942.         mov     [mmx_size],0
  2943.       xop_instruction_9:
  2944.         mov     [base_code],al
  2945.         mov     [xop_opcode_map],9
  2946.         jmp     avx_xop_common
  2947. xop_single_source_128bit_instruction:
  2948.         or      [operand_flags],2
  2949.         mov     [mmx_size],16
  2950.         jmp     xop_instruction_9
  2951. xop_triple_source_128bit_instruction:
  2952.         mov     [immediate_size],-1
  2953.         mov     byte [value],0
  2954.         mov     [mmx_size],16
  2955.         jmp     xop_instruction_8
  2956. xop_128bit_instruction:
  2957.         mov     [immediate_size],-2
  2958.         mov     byte [value],0
  2959.         mov     [mmx_size],16
  2960.       xop_instruction_8:
  2961.         mov     [base_code],al
  2962.         mov     [xop_opcode_map],8
  2963.         jmp     avx_xop_common
  2964. xop_pcom_b_instruction:
  2965.         mov     ah,0CCh
  2966.         jmp     xop_pcom_instruction
  2967. xop_pcom_d_instruction:
  2968.         mov     ah,0CEh
  2969.         jmp     xop_pcom_instruction
  2970. xop_pcom_q_instruction:
  2971.         mov     ah,0CFh
  2972.         jmp     xop_pcom_instruction
  2973. xop_pcom_w_instruction:
  2974.         mov     ah,0CDh
  2975.         jmp     xop_pcom_instruction
  2976. xop_pcom_ub_instruction:
  2977.         mov     ah,0ECh
  2978.         jmp     xop_pcom_instruction
  2979. xop_pcom_ud_instruction:
  2980.         mov     ah,0EEh
  2981.         jmp     xop_pcom_instruction
  2982. xop_pcom_uq_instruction:
  2983.         mov     ah,0EFh
  2984.         jmp     xop_pcom_instruction
  2985. xop_pcom_uw_instruction:
  2986.         mov     ah,0EDh
  2987.       xop_pcom_instruction:
  2988.         mov     byte [value],al
  2989.         mov     [immediate_size],-4
  2990.         mov     [mmx_size],16
  2991.         mov     [base_code],ah
  2992.         mov     [xop_opcode_map],8
  2993.         jmp     avx_xop_common
  2994. vpcmov_instruction:
  2995.         or      [vex_required],2
  2996.         mov     [immediate_size],-2
  2997.         mov     byte [value],0
  2998.         mov     [mmx_size],0
  2999.         mov     [base_code],al
  3000.         mov     [xop_opcode_map],8
  3001.         jmp     avx_xop_common
  3002. xop_shift_instruction:
  3003.         mov     [base_code],al
  3004.         or      [vex_required],2
  3005.         mov     [xop_opcode_map],9
  3006.         call    take_avx_register
  3007.         cmp     ah,16
  3008.         jne     invalid_operand
  3009.         mov     [postbyte_register],al
  3010.         lods    byte [esi]
  3011.         cmp     al,','
  3012.         jne     invalid_operand
  3013.         lods    byte [esi]
  3014.         call    get_size_operator
  3015.         cmp     al,'['
  3016.         je      xop_shift_reg_mem
  3017.         cmp     al,10h
  3018.         jne     invalid_operand
  3019.         lods    byte [esi]
  3020.         call    convert_xmm_register
  3021.         mov     [vex_register],al
  3022.         lods    byte [esi]
  3023.         cmp     al,','
  3024.         jne     invalid_operand
  3025.         push    esi
  3026.         xor     cl,cl
  3027.         xchg    cl,[operand_size]
  3028.         lods    byte [esi]
  3029.         call    get_size_operator
  3030.         pop     esi
  3031.         xchg    cl,[operand_size]
  3032.         cmp     al,'['
  3033.         je      xop_shift_reg_reg_mem
  3034.         cmp     al,10h
  3035.         jne     xop_shift_reg_reg_imm
  3036.         call    take_avx_register
  3037.         mov     bl,al
  3038.         xchg    bl,[vex_register]
  3039.         jmp     nomem_instruction_ready
  3040.       xop_shift_reg_reg_mem:
  3041.         or      [rex_prefix],8
  3042.         lods    byte [esi]
  3043.         call    get_size_operator
  3044.         call    get_address
  3045.         jmp     instruction_ready
  3046.       xop_shift_reg_reg_imm:
  3047.         xor     bl,bl
  3048.         xchg    bl,[vex_register]
  3049.         cmp     [base_code],94h
  3050.         jae     invalid_operand
  3051.         add     [base_code],30h
  3052.         mov     [xop_opcode_map],8
  3053.         dec     esi
  3054.         jmp     mmx_nomem_imm8
  3055.       xop_shift_reg_mem:
  3056.         call    get_address
  3057.         lods    byte [esi]
  3058.         cmp     al,','
  3059.         jne     invalid_operand
  3060.         push    esi
  3061.         xor     cl,cl
  3062.         xchg    cl,[operand_size]
  3063.         lods    byte [esi]
  3064.         call    get_size_operator
  3065.         pop     esi
  3066.         xchg    cl,[operand_size]
  3067.         cmp     al,10h
  3068.         jne     xop_shift_reg_mem_imm
  3069.         call    take_avx_register
  3070.         mov     [vex_register],al
  3071.         jmp     instruction_ready
  3072.       xop_shift_reg_mem_imm:
  3073.         cmp     [base_code],94h
  3074.         jae     invalid_operand
  3075.         add     [base_code],30h
  3076.         mov     [xop_opcode_map],8
  3077.         dec     esi
  3078.         jmp     mmx_imm8
  3079.  
  3080. set_evex_mode:
  3081.         mov     [evex_mode],al
  3082.         jmp     instruction_assembled
  3083.  
  3084. take_avx_register:
  3085.         lods    byte [esi]
  3086.         call    get_size_operator
  3087.         cmp     al,10h
  3088.         jne     invalid_operand
  3089.         lods    byte [esi]
  3090. convert_avx_register:
  3091.         mov     ah,al
  3092.         and     al,1Fh
  3093.         and     ah,0E0h
  3094.         sub     ah,60h
  3095.         jb      invalid_operand
  3096.         jz      avx512_register_size
  3097.         sub     ah,60h
  3098.         jb      invalid_operand
  3099.         jnz     avx_register_size_ok
  3100.         mov     ah,16
  3101.         jmp     avx_register_size_ok
  3102.       avx512_register_size:
  3103.         mov     ah,64
  3104.       avx_register_size_ok:
  3105.         cmp     al,8
  3106.         jb      match_register_size
  3107.         cmp     [code_type],64
  3108.         jne     invalid_operand
  3109.         jmp     match_register_size
  3110. store_vex_instruction_code:
  3111.         test    [rex_prefix],10h
  3112.         jnz     invalid_operand
  3113.         test    [vex_required],0F8h
  3114.         jnz     store_evex_instruction_code
  3115.         test    [vex_register],10000b
  3116.         jnz     store_evex_instruction_code
  3117.         cmp     [operand_size],64
  3118.         je      store_evex_instruction_code
  3119.         mov     al,[base_code]
  3120.         cmp     al,0Fh
  3121.         jne     store_xop_instruction_code
  3122.         test    [vex_required],2
  3123.         jnz     prepare_vex
  3124.         cmp     [evex_mode],0
  3125.         je      prepare_vex
  3126.         cmp     [displacement_compression],1
  3127.         jne     prepare_vex
  3128.         cmp     edx,80h
  3129.         jb      prepare_vex
  3130.         cmp     edx,-80h
  3131.         jae     prepare_vex
  3132.         mov     al,bl
  3133.         or      al,bh
  3134.         shr     al,4
  3135.         cmp     al,2
  3136.         je      prepare_vex
  3137.         call    compress_displacement
  3138.         cmp     [displacement_compression],2
  3139.         ja      prepare_evex
  3140.         jb      prepare_vex
  3141.         dec     [displacement_compression]
  3142.         mov     edx,[uncompressed_displacement]
  3143.       prepare_vex:
  3144.         mov     ah,[extended_code]
  3145.         cmp     ah,38h
  3146.         je      store_vex_0f38_instruction_code
  3147.         cmp     ah,3Ah
  3148.         je      store_vex_0f3a_instruction_code
  3149.         test    [rex_prefix],1011b
  3150.         jnz     store_vex_0f_instruction_code
  3151.         mov     [edi+2],ah
  3152.         mov     byte [edi],0C5h
  3153.         mov     al,[vex_register]
  3154.         not     al
  3155.         shl     al,3
  3156.         mov     ah,[rex_prefix]
  3157.         shl     ah,5
  3158.         and     ah,80h
  3159.         xor     al,ah
  3160.         call    get_vex_lpp_bits
  3161.         mov     [edi+1],al
  3162.         call    check_vex
  3163.         add     edi,3
  3164.         ret
  3165.       get_vex_lpp_bits:
  3166.         cmp     [operand_size],32
  3167.         jne     get_vex_pp_bits
  3168.         or      al,100b
  3169.       get_vex_pp_bits:
  3170.         mov     ah,[opcode_prefix]
  3171.         cmp     ah,66h
  3172.         je      vex_66
  3173.         cmp     ah,0F3h
  3174.         je      vex_f3
  3175.         cmp     ah,0F2h
  3176.         je      vex_f2
  3177.         test    ah,ah
  3178.         jnz     disallowed_combination_of_registers
  3179.         ret
  3180.       vex_f2:
  3181.         or      al,11b
  3182.         ret
  3183.       vex_f3:
  3184.         or      al,10b
  3185.         ret
  3186.       vex_66:
  3187.         or      al,1
  3188.         ret
  3189.       store_vex_0f38_instruction_code:
  3190.         mov     al,11100010b
  3191.         mov     ah,[supplemental_code]
  3192.         jmp     make_c4_vex
  3193.       store_vex_0f3a_instruction_code:
  3194.         mov     al,11100011b
  3195.         mov     ah,[supplemental_code]
  3196.         jmp     make_c4_vex
  3197.       store_vex_0f_instruction_code:
  3198.         mov     al,11100001b
  3199.       make_c4_vex:
  3200.         mov     [edi+3],ah
  3201.         mov     byte [edi],0C4h
  3202.         mov     ah,[rex_prefix]
  3203.         shl     ah,5
  3204.         xor     al,ah
  3205.         mov     [edi+1],al
  3206.         call    check_vex
  3207.         mov     al,[vex_register]
  3208.         xor     al,1111b
  3209.         shl     al,3
  3210.         mov     ah,[rex_prefix]
  3211.         shl     ah,4
  3212.         and     ah,80h
  3213.         or      al,ah
  3214.         call    get_vex_lpp_bits
  3215.         mov     [edi+2],al
  3216.         add     edi,4
  3217.         ret
  3218.       check_vex:
  3219.         cmp     [code_type],64
  3220.         je      vex_ok
  3221.         not     al
  3222.         test    al,11000000b
  3223.         jnz     invalid_operand
  3224.         test    [rex_prefix],40h
  3225.         jnz     invalid_operand
  3226.       vex_ok:
  3227.         ret
  3228. store_xop_instruction_code:
  3229.         mov     [edi+3],al
  3230.         mov     byte [edi],8Fh
  3231.         mov     al,[xop_opcode_map]
  3232.         mov     ah,[rex_prefix]
  3233.         test    ah,40h
  3234.         jz      xop_ok
  3235.         cmp     [code_type],64
  3236.         jne     invalid_operand
  3237.       xop_ok:
  3238.         not     ah
  3239.         shl     ah,5
  3240.         xor     al,ah
  3241.         mov     [edi+1],al
  3242.         mov     al,[vex_register]
  3243.         xor     al,1111b
  3244.         shl     al,3
  3245.         mov     ah,[rex_prefix]
  3246.         shl     ah,4
  3247.         and     ah,80h
  3248.         or      al,ah
  3249.         call    get_vex_lpp_bits
  3250.         mov     [edi+2],al
  3251.         add     edi,4
  3252.         ret
  3253. store_evex_instruction_code:
  3254.         test    [vex_required],2
  3255.         jnz     invalid_operand
  3256.         cmp     [base_code],0Fh
  3257.         jne     invalid_operand
  3258.         cmp     [displacement_compression],1
  3259.         jne     prepare_evex
  3260.         call    compress_displacement
  3261.       prepare_evex:
  3262.         mov     ah,[extended_code]
  3263.         cmp     ah,38h
  3264.         je      store_evex_0f38_instruction_code
  3265.         cmp     ah,3Ah
  3266.         je      store_evex_0f3a_instruction_code
  3267.         mov     al,11110001b
  3268.       make_evex:
  3269.         mov     [edi+4],ah
  3270.         mov     byte [edi],62h
  3271.         mov     ah,[rex_prefix]
  3272.         shl     ah,5
  3273.         xor     al,ah
  3274.         mov     ah,[vex_required]
  3275.         and     ah,10h
  3276.         xor     al,ah
  3277.         mov     [edi+1],al
  3278.         call    check_vex
  3279.         mov     al,[vex_register]
  3280.         not     al
  3281.         and     al,1111b
  3282.         shl     al,3
  3283.         mov     ah,[rex_prefix]
  3284.         shl     ah,4
  3285.         or      ah,[rex_prefix]
  3286.         and     ah,80h
  3287.         or      al,ah
  3288.         or      al,100b
  3289.         call    get_vex_pp_bits
  3290.         mov     [edi+2],al
  3291.         mov     al,[vex_register]
  3292.         not     al
  3293.         shr     al,1
  3294.         and     al,1000b
  3295.         test    [vex_required],80h
  3296.         jne     evex_rounding
  3297.         mov     ah,[operand_size]
  3298.         cmp     ah,16
  3299.         jbe     evex_l_ok
  3300.         or      al,ah
  3301.         jmp     evex_l_ok
  3302.       evex_rounding:
  3303.         mov     ah,[rounding_mode]
  3304.         shl     ah,5
  3305.         or      al,ah
  3306.       evex_l_ok:
  3307.         test    [vex_required],20h
  3308.         jz      evex_zaaa_ok
  3309.         or      al,[mask_register]
  3310.       evex_zaaa_ok:
  3311.         test    [vex_required],40h
  3312.         jz      evex_b_ok
  3313.         or      al,10h
  3314.       evex_b_ok:
  3315.         mov     [edi+3],al
  3316.         add     edi,5
  3317.         ret
  3318.       store_evex_0f38_instruction_code:
  3319.         mov     al,11110010b
  3320.         mov     ah,[supplemental_code]
  3321.         jmp     make_evex
  3322.       store_evex_0f3a_instruction_code:
  3323.         mov     al,11110011b
  3324.         mov     ah,[supplemental_code]
  3325.         jmp     make_evex
  3326. compress_displacement:
  3327.         mov     ebp,ecx
  3328.         mov     [uncompressed_displacement],edx
  3329.         or      edx,edx
  3330.         jz      displacement_compressed
  3331.         xor     ecx,ecx
  3332.         mov     cl,[mmx_size]
  3333.         test    cl,cl
  3334.         jnz     calculate_displacement_scale
  3335.         mov     cl,[operand_size]
  3336.       calculate_displacement_scale:
  3337.         bsf     ecx,ecx
  3338.         jz      displacement_compression_ok
  3339.         xor     eax,eax
  3340.         shrd    eax,edx,cl
  3341.         jnz     displacement_not_compressed
  3342.         sar     edx,cl
  3343.         cmp     edx,80h
  3344.         jb      displacement_compressed
  3345.         cmp     edx,-80h
  3346.         jnb     displacement_compressed
  3347.         shl     edx,cl
  3348.       displacement_not_compressed:
  3349.         inc     [displacement_compression]
  3350.         jmp     displacement_compression_ok
  3351.       displacement_compressed:
  3352.         add     [displacement_compression],2
  3353.       displacement_compression_ok:
  3354.         mov     ecx,ebp
  3355.         ret
  3356.