...

Text file src/github.com/chenzhuoyu/iasm/repl/asm_amd64.s

Documentation: github.com/chenzhuoyu/iasm/repl

     1#include "go_asm.h"
     2#include "funcdata.h"
     3#include "textflag.h"
     4
     5TEXT ·dumpregs(SB), (NOSPLIT | NOFRAME), $0
     6    NO_LOCAL_POINTERS
     7    PUSHFQ
     8    PUSHFQ
     9    PUSHQ AX
    10    MOVQ  0x20(SP), AX
    11    POPQ  (AX)
    12    MOVQ  BX, 0x08(AX)
    13    MOVQ  CX, 0x10(AX)
    14    MOVQ  DX, 0x18(AX)
    15    MOVQ  DI, 0x20(AX)
    16    MOVQ  SI, 0x28(AX)
    17    MOVQ  BP, 0x30(AX)
    18    MOVQ  SP, 0x38(AX)
    19    ADDQ  $16, 0x38(AX)
    20    MOVQ  R8, 0x40(AX)
    21    MOVQ  R9, 0x48(AX)
    22    MOVQ  R10, 0x50(AX)
    23    MOVQ  R11, 0x58(AX)
    24    MOVQ  R12, 0x60(AX)
    25    MOVQ  R13, 0x68(AX)
    26    MOVQ  R14, 0x70(AX)
    27    MOVQ  R15, 0x78(AX)
    28    MOVQ  16(SP), CX
    29    MOVQ  CX, 0x80(AX)
    30    POPQ  0x88(AX)
    31    MOVW  CS, 0x90(AX)
    32    MOVW  FS, 0x98(AX)
    33    MOVW  GS, 0xa0(AX)
    34
    35    // SSE xmm0 ~ xmm15 registers
    36    MOVOU X0, 0xc0(AX)
    37    MOVOU X1, 0xd0(AX)
    38    MOVOU X2, 0xe0(AX)
    39    MOVOU X3, 0xf0(AX)
    40    MOVOU X4, 0x100(AX)
    41    MOVOU X5, 0x110(AX)
    42    MOVOU X6, 0x120(AX)
    43    MOVOU X7, 0x130(AX)
    44    MOVOU X8, 0x140(AX)
    45    MOVOU X9, 0x150(AX)
    46    MOVOU X10, 0x160(AX)
    47    MOVOU X11, 0x170(AX)
    48    MOVOU X12, 0x180(AX)
    49    MOVOU X13, 0x190(AX)
    50    MOVOU X14, 0x1a0(AX)
    51    MOVOU X15, 0x1b0(AX)
    52
    53    // check for AVX
    54    CMPB ·hasAVX(SB), $0
    55    JE   _no_avx
    56
    57    // AVX ymm0 ~ ymm15 registers
    58    VMOVDQU Y0, 0x2c0(AX)
    59    VMOVDQU Y1, 0x2e0(AX)
    60    VMOVDQU Y2, 0x300(AX)
    61    VMOVDQU Y3, 0x320(AX)
    62    VMOVDQU Y4, 0x340(AX)
    63    VMOVDQU Y5, 0x360(AX)
    64    VMOVDQU Y6, 0x380(AX)
    65    VMOVDQU Y7, 0x3a0(AX)
    66    VMOVDQU Y8, 0x3c0(AX)
    67    VMOVDQU Y9, 0x3e0(AX)
    68    VMOVDQU Y10, 0x400(AX)
    69    VMOVDQU Y11, 0x420(AX)
    70    VMOVDQU Y12, 0x440(AX)
    71    VMOVDQU Y13, 0x460(AX)
    72    VMOVDQU Y14, 0x480(AX)
    73    VMOVDQU Y15, 0x4a0(AX)
    74
    75    // check for AVX512VL
    76    CMPB ·hasAVX512VL(SB), $0
    77    JE   _no_avx512vl
    78
    79    // AVX512VL xmm16 ~ xmm31 registers
    80    LONG $0x087fe162; WORD $0x407f; BYTE $0x1c  // vmovdqu8 %xmm16, 0x1c0(%rax)
    81    LONG $0x087fe162; WORD $0x487f; BYTE $0x1d  // vmovdqu8 %xmm17, 0x1d0(%rax)
    82    LONG $0x087fe162; WORD $0x507f; BYTE $0x1e  // vmovdqu8 %xmm18, 0x1e0(%rax)
    83    LONG $0x087fe162; WORD $0x587f; BYTE $0x1f  // vmovdqu8 %xmm19, 0x1f0(%rax)
    84    LONG $0x087fe162; WORD $0x607f; BYTE $0x20  // vmovdqu8 %xmm20, 0x200(%rax)
    85    LONG $0x087fe162; WORD $0x687f; BYTE $0x21  // vmovdqu8 %xmm21, 0x210(%rax)
    86    LONG $0x087fe162; WORD $0x707f; BYTE $0x22  // vmovdqu8 %xmm22, 0x220(%rax)
    87    LONG $0x087fe162; WORD $0x787f; BYTE $0x23  // vmovdqu8 %xmm23, 0x230(%rax)
    88    LONG $0x087f6162; WORD $0x407f; BYTE $0x24  // vmovdqu8 %xmm24, 0x240(%rax)
    89    LONG $0x087f6162; WORD $0x487f; BYTE $0x25  // vmovdqu8 %xmm25, 0x250(%rax)
    90    LONG $0x087f6162; WORD $0x507f; BYTE $0x26  // vmovdqu8 %xmm26, 0x260(%rax)
    91    LONG $0x087f6162; WORD $0x587f; BYTE $0x27  // vmovdqu8 %xmm27, 0x270(%rax)
    92    LONG $0x087f6162; WORD $0x607f; BYTE $0x28  // vmovdqu8 %xmm28, 0x280(%rax)
    93    LONG $0x087f6162; WORD $0x687f; BYTE $0x29  // vmovdqu8 %xmm29, 0x290(%rax)
    94    LONG $0x087f6162; WORD $0x707f; BYTE $0x2a  // vmovdqu8 %xmm30, 0x2a0(%rax)
    95    LONG $0x087f6162; WORD $0x787f; BYTE $0x2b  // vmovdqu8 %xmm31, 0x2b0(%rax)
    96
    97    // AVX512VL ymm16 ~ ymm31 registers
    98    LONG $0x28ffe162; WORD $0x407f; BYTE $0x26  // vmovdqu16 %ymm16, 0x4c0(%rax)
    99    LONG $0x28ffe162; WORD $0x487f; BYTE $0x27  // vmovdqu16 %ymm17, 0x4e0(%rax)
   100    LONG $0x28ffe162; WORD $0x507f; BYTE $0x28  // vmovdqu16 %ymm18, 0x500(%rax)
   101    LONG $0x28ffe162; WORD $0x587f; BYTE $0x29  // vmovdqu16 %ymm19, 0x520(%rax)
   102    LONG $0x28ffe162; WORD $0x607f; BYTE $0x2a  // vmovdqu16 %ymm20, 0x540(%rax)
   103    LONG $0x28ffe162; WORD $0x687f; BYTE $0x2b  // vmovdqu16 %ymm21, 0x560(%rax)
   104    LONG $0x28ffe162; WORD $0x707f; BYTE $0x2c  // vmovdqu16 %ymm22, 0x580(%rax)
   105    LONG $0x28ffe162; WORD $0x787f; BYTE $0x2d  // vmovdqu16 %ymm23, 0x5a0(%rax)
   106    LONG $0x28ff6162; WORD $0x407f; BYTE $0x2e  // vmovdqu16 %ymm24, 0x5c0(%rax)
   107    LONG $0x28ff6162; WORD $0x487f; BYTE $0x2f  // vmovdqu16 %ymm25, 0x5e0(%rax)
   108    LONG $0x28ff6162; WORD $0x507f; BYTE $0x30  // vmovdqu16 %ymm26, 0x600(%rax)
   109    LONG $0x28ff6162; WORD $0x587f; BYTE $0x31  // vmovdqu16 %ymm27, 0x620(%rax)
   110    LONG $0x28ff6162; WORD $0x607f; BYTE $0x32  // vmovdqu16 %ymm28, 0x640(%rax)
   111    LONG $0x28ff6162; WORD $0x687f; BYTE $0x33  // vmovdqu16 %ymm29, 0x660(%rax)
   112    LONG $0x28ff6162; WORD $0x707f; BYTE $0x34  // vmovdqu16 %ymm30, 0x680(%rax)
   113    LONG $0x28ff6162; WORD $0x787f; BYTE $0x35  // vmovdqu16 %ymm31, 0x6a0(%rax)
   114
   115_no_avx512vl:
   116    CMPB ·hasAVX512F(SB), $0
   117    JE   _no_avx512f
   118
   119    // AVX512F zmm0 ~ zmm31 registers
   120    LONG $0x487ef162; WORD $0x407f; BYTE $0x1b  // vmovdqu32 %zmm0, 0x6c0(%rax)
   121    LONG $0x487ef162; WORD $0x487f; BYTE $0x1c  // vmovdqu32 %zmm1, 0x700(%rax)
   122    LONG $0x487ef162; WORD $0x507f; BYTE $0x1d  // vmovdqu32 %zmm2, 0x740(%rax)
   123    LONG $0x487ef162; WORD $0x587f; BYTE $0x1e  // vmovdqu32 %zmm3, 0x780(%rax)
   124    LONG $0x487ef162; WORD $0x607f; BYTE $0x1f  // vmovdqu32 %zmm4, 0x7c0(%rax)
   125    LONG $0x487ef162; WORD $0x687f; BYTE $0x20  // vmovdqu32 %zmm5, 0x800(%rax)
   126    LONG $0x487ef162; WORD $0x707f; BYTE $0x21  // vmovdqu32 %zmm6, 0x840(%rax)
   127    LONG $0x487ef162; WORD $0x787f; BYTE $0x22  // vmovdqu32 %zmm7, 0x880(%rax)
   128    LONG $0x487e7162; WORD $0x407f; BYTE $0x23  // vmovdqu32 %zmm8, 0x8c0(%rax)
   129    LONG $0x487e7162; WORD $0x487f; BYTE $0x24  // vmovdqu32 %zmm9, 0x900(%rax)
   130    LONG $0x487e7162; WORD $0x507f; BYTE $0x25  // vmovdqu32 %zmm10, 0x940(%rax)
   131    LONG $0x487e7162; WORD $0x587f; BYTE $0x26  // vmovdqu32 %zmm11, 0x980(%rax)
   132    LONG $0x487e7162; WORD $0x607f; BYTE $0x27  // vmovdqu32 %zmm12, 0x9c0(%rax)
   133    LONG $0x487e7162; WORD $0x687f; BYTE $0x28  // vmovdqu32 %zmm13, 0xa00(%rax)
   134    LONG $0x487e7162; WORD $0x707f; BYTE $0x29  // vmovdqu32 %zmm14, 0xa40(%rax)
   135    LONG $0x487e7162; WORD $0x787f; BYTE $0x2a  // vmovdqu32 %zmm15, 0xa80(%rax)
   136    LONG $0x487ee162; WORD $0x407f; BYTE $0x2b  // vmovdqu32 %zmm16, 0xac0(%rax)
   137    LONG $0x487ee162; WORD $0x487f; BYTE $0x2c  // vmovdqu32 %zmm17, 0xb00(%rax)
   138    LONG $0x487ee162; WORD $0x507f; BYTE $0x2d  // vmovdqu32 %zmm18, 0xb40(%rax)
   139    LONG $0x487ee162; WORD $0x587f; BYTE $0x2e  // vmovdqu32 %zmm19, 0xb80(%rax)
   140    LONG $0x487ee162; WORD $0x607f; BYTE $0x2f  // vmovdqu32 %zmm20, 0xbc0(%rax)
   141    LONG $0x487ee162; WORD $0x687f; BYTE $0x30  // vmovdqu32 %zmm21, 0xc00(%rax)
   142    LONG $0x487ee162; WORD $0x707f; BYTE $0x31  // vmovdqu32 %zmm22, 0xc40(%rax)
   143    LONG $0x487ee162; WORD $0x787f; BYTE $0x32  // vmovdqu32 %zmm23, 0xc80(%rax)
   144    LONG $0x487e6162; WORD $0x407f; BYTE $0x33  // vmovdqu32 %zmm24, 0xcc0(%rax)
   145    LONG $0x487e6162; WORD $0x487f; BYTE $0x34  // vmovdqu32 %zmm25, 0xd00(%rax)
   146    LONG $0x487e6162; WORD $0x507f; BYTE $0x35  // vmovdqu32 %zmm26, 0xd40(%rax)
   147    LONG $0x487e6162; WORD $0x587f; BYTE $0x36  // vmovdqu32 %zmm27, 0xd80(%rax)
   148    LONG $0x487e6162; WORD $0x607f; BYTE $0x37  // vmovdqu32 %zmm28, 0xdc0(%rax)
   149    LONG $0x487e6162; WORD $0x687f; BYTE $0x38  // vmovdqu32 %zmm29, 0xe00(%rax)
   150    LONG $0x487e6162; WORD $0x707f; BYTE $0x39  // vmovdqu32 %zmm30, 0xe40(%rax)
   151    LONG $0x487e6162; WORD $0x787f; BYTE $0x3a  // vmovdqu32 %zmm31, 0xe80(%rax)
   152
   153    // check for AVX512BW
   154    CMPB ·hasAVX512BW(SB), $0
   155    JE   _no_avx512bw
   156
   157    // AVX512BW 64-bit K registers
   158    QUAD $0x000ec08091f8e1c4; BYTE $0x00    // kmovq %k0, 0xec0(%rax)
   159    QUAD $0x000ec88891f8e1c4; BYTE $0x00    // kmovq %k1, 0xec8(%rax)
   160    QUAD $0x000ed09091f8e1c4; BYTE $0x00    // kmovq %k2, 0xed0(%rax)
   161    QUAD $0x000ed89891f8e1c4; BYTE $0x00    // kmovq %k3, 0xed8(%rax)
   162    QUAD $0x000ee0a091f8e1c4; BYTE $0x00    // kmovq %k4, 0xee0(%rax)
   163    QUAD $0x000ee8a891f8e1c4; BYTE $0x00    // kmovq %k5, 0xee8(%rax)
   164    QUAD $0x000ef0b091f8e1c4; BYTE $0x00    // kmovq %k6, 0xef0(%rax)
   165    QUAD $0x000ef8b891f8e1c4; BYTE $0x00    // kmovq %k7, 0xef8(%rax)
   166    JMP  _avx512bw_done
   167
   168_no_avx512bw:
   169    QUAD $0x00000ec08091f8c5    // kmovw %k0, 0xec0(%rax)
   170    QUAD $0x00000ec88891f8c5    // kmovw %k1, 0xec8(%rax)
   171    QUAD $0x00000ed09091f8c5    // kmovw %k2, 0xed0(%rax)
   172    QUAD $0x00000ed89891f8c5    // kmovw %k3, 0xed8(%rax)
   173    QUAD $0x00000ee0a091f8c5    // kmovw %k4, 0xee0(%rax)
   174    QUAD $0x00000ee8a891f8c5    // kmovw %k5, 0xee8(%rax)
   175    QUAD $0x00000ef0b091f8c5    // kmovw %k6, 0xef0(%rax)
   176    QUAD $0x00000ef8b891f8c5    // kmovw %k7, 0xef8(%rax)
   177
   178_avx512bw_done:
   179_no_avx512f:
   180_no_avx:
   181    MOVQ 0x10(AX), CX
   182    MOVQ (AX), AX
   183    POPFQ
   184    RET
   185
   186TEXT ·execaddr(SB), (NOSPLIT | NOFRAME), $0
   187    NO_LOCAL_POINTERS
   188    LONG  $0x102474ff       // pushq 0x10(%rsp)
   189    CALL  ·dumpregs(SB)
   190    LEAQ  8(SP), SP
   191    CALL  exectrampoline(SB)
   192    LONG  $0x182474ff       // pushq 0x18(%rsp)
   193    CALL  ·dumpregs(SB)
   194    LEAQ  8(SP), SP
   195    RET
   196
   197TEXT exectrampoline(SB), (NOSPLIT | NOFRAME), $0
   198    NO_LOCAL_POINTERS
   199    JMP 0x10(SP)

View as plain text