instruction.byte4.inc

Переключить прокрутку окна
Загрузить этот исходный код

;
 ;  Исходный код среды исполнения ПВТ-ОО.
 ;
 ;  Этот исходный код является частью проекта ПВТ-ОО.
 ;
 ;  Copyright © 2021 Малик Разработчик
 ;
 ;  Это свободная программа: вы можете перераспространять её и/или
 ;  изменять её на условиях Меньшей Стандартной общественной лицензии GNU в том виде,
 ;  в каком она была опубликована Фондом свободного программного обеспечения;
 ;  либо версии 3 лицензии, либо (по вашему выбору) любой более поздней версии.
 ;
 ;  Эта программа распространяется в надежде, что она может быть полезна,
 ;  но БЕЗО ВСЯКИХ ГАРАНТИЙ; даже без неявной гарантии ТОВАРНОГО ВИДА
 ;  или ПРИГОДНОСТИ ДЛЯ ОПРЕДЕЛЁННЫХ ЦЕЛЕЙ. Подробнее см. в Меньшей Стандартной
 ;  общественной лицензии GNU.
 ;
 ;  Вы должны были получить копию Меньшей Стандартной общественной лицензии GNU
 ;  вместе с этой программой. Если это не так, см.
 ;  <http://www.gnu.org/licenses/>.
;

; <fold push/pop/peek>
    if(used inst$b4push) ; <fold >
        inst b4push ; (value in xmm0)
                    push1
                    vmovdqa xword[rsp], xmm0
                    set     TAG_BYTE4
        end_inst
    end if ; </fold>

    if(used inst$b4pop) ; <fold >
        inst b4pop ; (): value in xmm0
                    overify TAG_BYTE4
                    vmovd   xmm0, [rsp]
                    pop1set
        end_inst
    end if ; </fold>
; </fold>

; <fold conversion>
    if(used inst$b4tob) ; <fold >
        inst b4tob
                    overify TAG_BYTE4
                    movsx   eax, byte[rsp]
                    vmovd   xmm0, eax
                    vmovdqa xword[rsp], xmm0
                    set     TAG_INT
        end_inst
    end if ; </fold>

    if(used inst$b4tob2) ; <fold >
        inst b4tob2
                    overify TAG_BYTE4
                    vmovdqa xmm0, [rsp]
                    vpand   xmm0, xmm0, [b8.03]
                    vmovdqa xword[rsp], xmm0
                    set     TAG_BYTE2
        end_inst
    end if ; </fold>

    if(used inst$b4tob8) ; <fold >
        inst b4tob8
                    overify TAG_BYTE4
                    vmovd   xmm0, [rsp]
                    vmovdqa xword[rsp], xmm0
                    set     TAG_BYTE8
        end_inst
    end if ; </fold>

    if(used inst$b4tos4) ; <fold >
        inst b4tos4
                    overify TAG_BYTE4
                    vpmovsxbw xmm0, [rsp]
                    vmovdqa xword[rsp], xmm0
                    set     TAG_SHORT4
        end_inst
    end if ; </fold>

    if(used inst$b4toi4) ; <fold >
        inst b4toi4
                    overify TAG_BYTE4
                    vpmovsxbd xmm0, [rsp]
                    vmovdqa xword[rsp], xmm0
                    set     TAG_INT4
        end_inst
    end if ; </fold>

    if(used inst$b4tol4) ; <fold >
        inst b4tol4
                    overify TAG_BYTE4
                    push1
                    vpmovsxbq ymm0, [rsp+$10]
                    vmovdqu yword[rsp], ymm0
                    set     TAG_LONG4
        end_inst
    end if ; </fold>
; </fold>

; <fold relation>
    if(used inst$b4se) ; <fold >
        inst b4se
                    overify TAG_BYTE4, TAG_BYTE4
                    vpmovsxbd xmm0, [rsp+$10]
                    vpmovsxbd xmm1, [rsp+$00]
                    vpcmpeqd xmm0, xmm0, xmm1
                    vmovmskps eax, xmm0
                    cmp     eax, $0f
                    sete    al
                    movsx   eax, al
                    vmovd   xmm0, eax
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set TAG_INT
        end_inst
    end if ; </fold>

    if(used inst$b4sne) ; <fold >
        inst b4sne
                    overify TAG_BYTE4, TAG_BYTE4
                    vpmovsxbd xmm0, [rsp+$10]
                    vpmovsxbd xmm1, [rsp+$00]
                    vpcmpeqd xmm0, xmm0, xmm1
                    vmovmskps eax, xmm0
                    cmp     eax, $0f
                    setne   al
                    movsx   eax, al
                    vmovd   xmm0, eax
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set TAG_INT
        end_inst
    end if ; </fold>
; </fold>

; <fold bitwise>
    if(used inst$b4not) ; <fold >
        inst b4not
                    overify TAG_BYTE4
                    vmovdqa xmm0, [rsp]
                    vpxor   xmm0, xmm0, [b8.02]
                    vmovdqa xword[rsp], xmm0
        end_inst
    end if ; </fold>

    if(used inst$b4and) ; <fold >
        inst b4and
                    overify TAG_BYTE4, TAG_BYTE4
                    vmovdqa xmm0, [rsp+$10]
                    vpand   xmm0, xmm0, [rsp]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$b4or) ; <fold >
        inst b4or
                    overify TAG_BYTE4, TAG_BYTE4
                    vmovdqa xmm0, [rsp+$10]
                    vpor    xmm0, xmm0, [rsp]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$b4xor) ; <fold >
        inst b4xor
                    overify TAG_BYTE4, TAG_BYTE4
                    vmovdqa xmm0, [rsp+$10]
                    vpxor   xmm0, xmm0, [rsp]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>
; </fold>

; <fold scalar>
    if(used inst$b4sneg) ; <fold >
        inst b4sneg
                    overify TAG_BYTE4
                    vpmovsxbd xmm0, [rsp]
                    vpxor   xmm1, xmm0, xmm0
                    vpsubd  xmm0, xmm1, xmm0
                    vmovdqa xword[rsp+$10], xmm0
                    set     TAG_INT4
        end_inst
    end if ; </fold>

    if(used inst$b4smul) ; <fold >
        inst b4smul
                    overify TAG_BYTE4, TAG_BYTE4
                    vpmovsxbd xmm0, [rsp+$10]
                    vpmovsxbd xmm1, [rsp+$00]
                    vshufps xmm4, xmm1, xmm1, $e4
                    vshufps xmm5, xmm4, xmm4, $b1
                    vshufps xmm6, xmm4, xmm4, $4e
                    vshufps xmm7, xmm4, xmm4, $1b
                    vpmulld xmm4, xmm4, [i4.q0]
                    vpmulld xmm5, xmm5, [i4.q1]
                    vpmulld xmm6, xmm6, [i4.q2]
                    vpmulld xmm7, xmm7, [i4.q3]
                    vpmulld xmm3, xmm0, xmm7
                    vpmulld xmm2, xmm0, xmm6
                    vpmulld xmm1, xmm0, xmm5
                    vpmulld xmm0, xmm0, xmm4
                    vphaddd xmm0, xmm0, xmm1
                    vphaddd xmm1, xmm2, xmm3
                    vphaddd xmm0, xmm0, xmm1
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set TAG_INT4
        end_inst
    end if ; </fold>

    if(used inst$b4sadd) ; <fold >
        inst b4sadd
                    overify TAG_BYTE4, TAG_BYTE4
                    vpmovsxbd xmm0, [rsp+$10]
                    vpmovsxbd xmm1, [rsp+$00]
                    vpaddd  xmm0, xmm0, xmm1
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set TAG_INT4
        end_inst
    end if ; </fold>

    if(used inst$b4ssub) ; <fold >
        inst b4ssub
                    overify TAG_BYTE4, TAG_BYTE4
                    vpmovsxbd xmm0, [rsp+$10]
                    vpmovsxbd xmm1, [rsp+$00]
                    vpsubd  xmm0, xmm0, xmm1
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set TAG_INT4
        end_inst
    end if ; </fold>

    if(used inst$b4ssar) ; <fold >
        inst b4ssar
                    overify TAG_BYTE4, TAG_INT
                    mov     ecx, [rsp]
                    and     ecx, $1f
                    vpmovsxbd xmm0, [rsp+$10]
                    vmovd   xmm1, ecx
                    vpsrad  xmm0, xmm0, xmm1
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set TAG_INT4
        end_inst
    end if ; </fold>

    if(used inst$b4ssal) ; <fold >
        inst b4ssal
                    overify TAG_BYTE4, TAG_INT
                    mov     ecx, [rsp]
                    and     ecx, $1f
                    vpmovsxbd xmm0, [rsp+$10]
                    vmovd   xmm1, ecx
                    vpslld  xmm0, xmm0, xmm1
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set TAG_INT4
        end_inst
    end if ; </fold>

    if(used inst$b4sshr) ; <fold >
        inst b4sshr
                    overify TAG_BYTE4, TAG_INT
                    mov     ecx, [rsp]
                    and     ecx, $1f
                    vpmovsxbd xmm0, [rsp+$10]
                    vmovd   xmm1, ecx
                    vpsrld  xmm0, xmm0, xmm1
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set TAG_INT4
        end_inst
    end if ; </fold>
; </fold>

; <fold vector>
    if(used inst$b4vunpckl) ; <fold >
        inst b4vunpckl
                    overify TAG_BYTE4
                    vmovdqa xmm0, [rsp]
                    vpxor   xmm1, xmm0, xmm0
                    vpunpcklbw xmm0, xmm0, xmm1
                    vmovdqa xword[rsp], xmm0
                    set     TAG_SHORT4
        end_inst
    end if ; </fold>

    if(used inst$b4vunpcku) ; <fold >
        inst b4vunpcku
                    overify TAG_BYTE4
                    vmovdqa xmm0, [rsp]
                    vpxor   xmm1, xmm0, xmm0
                    vpunpcklbw xmm0, xmm1, xmm0
                    vmovdqa xword[rsp], xmm0
                    set     TAG_SHORT4
        end_inst
    end if ; </fold>

    if(used inst$b4vneg) ; <fold >
        inst b4vneg
                    overify TAG_BYTE4
                    vpxor   xmm0, xmm0, xmm0
                    vpsubb  xmm0, xmm0, [rsp]
                    vmovdqa xword[rsp], xmm0
        end_inst
    end if ; </fold>

    if(used inst$b4vmul) ; <fold >
        inst b4vmul
                    overify TAG_BYTE4, TAG_BYTE4
                    vpmovzxbw xmm0, [rsp+$10]
                    vpmovzxbw xmm1, [rsp+$00]
                    vpmullw xmm0, xmm0, xmm1
                    vpand   xmm0, xmm0, [s8.00]
                    vpxor   xmm1, xmm0, xmm0
                    vpackuswb xmm0, xmm0, xmm1
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$b4vadd) ; <fold >
        inst b4vadd
                    overify TAG_BYTE4, TAG_BYTE4
                    vmovdqa xmm0, [rsp+$10]
                    vpaddb  xmm0, xmm0, [rsp]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$b4vsub) ; <fold >
        inst b4vsub
                    overify TAG_BYTE4, TAG_BYTE4
                    vmovdqa xmm0, [rsp+$10]
                    vpsubb  xmm0, xmm0, [rsp]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$b4vsar) ; <fold >
        inst b4vsar
                    overify TAG_BYTE4, TAG_INT
                    mov     ecx, [rsp]
                    and     ecx, $1f
                    vpmovsxbw xmm0, [rsp+$10]
                    vmovd   xmm1, ecx
                    vpsraw  xmm0, xmm0, xmm1
                    vpand   xmm0, xmm0, [s8.00]
                    vpxor   xmm1, xmm0, xmm0
                    vpackuswb xmm0, xmm0, xmm1
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$b4vsal) ; <fold >
        inst b4vsal
                    overify TAG_BYTE4, TAG_INT
                    mov     ecx, [rsp]
                    and     ecx, $1f
                    vpmovsxbw xmm0, [rsp+$10]
                    vmovd   xmm1, ecx
                    vpsllw  xmm0, xmm0, xmm1
                    vpand   xmm0, xmm0, [s8.00]
                    vpxor   xmm1, xmm0, xmm0
                    vpackuswb xmm0, xmm0, xmm1
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$b4vshr) ; <fold >
        inst b4vshr
                    overify TAG_BYTE4, TAG_INT
                    mov     ecx, [rsp]
                    and     ecx, $1f
                    vpmovzxbw xmm0, [rsp+$10]
                    vmovd   xmm1, ecx
                    vpsrlw  xmm0, xmm0, xmm1
                    vpand   xmm0, xmm0, [s8.00]
                    vpxor   xmm1, xmm0, xmm0
                    vpackuswb xmm0, xmm0, xmm1
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$b4vg) ; <fold >
        inst b4vg
                    overify TAG_BYTE4, TAG_BYTE4
                    vmovdqa xmm0, [rsp+$10]
                    vpcmpgtb xmm0, xmm0, [rsp]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$b4vge) ; <fold >
        inst b4vge
                    overify TAG_BYTE4, TAG_BYTE4
                    vmovdqa xmm0, [rsp]
                    vpcmpgtb xmm0, xmm0, [rsp+$10]
                    vpxor   xmm0, xmm0, [b8.02]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$b4vl) ; <fold >
        inst b4vl
                    overify TAG_BYTE4, TAG_BYTE4
                    vmovdqa xmm0, [rsp]
                    vpcmpgtb xmm0, xmm0, [rsp+$10]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$b4vle) ; <fold >
        inst b4vle
                    overify TAG_BYTE4, TAG_BYTE4
                    vmovdqa xmm0, [rsp+$10]
                    vpcmpgtb xmm0, xmm0, [rsp]
                    vpxor   xmm0, xmm0, [b8.02]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$b4ve) ; <fold >
        inst b4ve
                    overify TAG_BYTE4, TAG_BYTE4
                    vmovdqa xmm0, [rsp+$10]
                    vpcmpeqb xmm0, xmm0, [rsp]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$b4vne) ; <fold >
        inst b4vne
                    overify TAG_BYTE4, TAG_BYTE4
                    vmovdqa xmm0, [rsp+$10]
                    vpcmpeqb xmm0, xmm0, [rsp]
                    vpxor   xmm0, xmm0, [b8.02]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$b4vmuls) ; <fold >
        inst b4vmuls
                    overify TAG_BYTE4, TAG_BYTE4
                    vpmovsxbw xmm0, [rsp+$10]
                    vpmovsxbw xmm1, [rsp+$00]
                    vpmullw xmm0, xmm0, xmm1
                    vpaddw  xmm0, xmm0, [s8.05]
                    vpsraw  xmm0, xmm0, $07
                    vpacksswb xmm0, xmm0, xmm0
                    vpand   xmm0, xmm0, [b8.02]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$b4vadds) ; <fold >
        inst b4vadds
                    overify TAG_BYTE4, TAG_BYTE4
                    vmovdqa xmm0, [rsp+$10]
                    vpaddsb xmm0, xmm0, [rsp]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$b4vsubs) ; <fold >
        inst b4vsubs
                    overify TAG_BYTE4, TAG_BYTE4
                    vmovdqa xmm0, [rsp+$10]
                    vpsubsb xmm0, xmm0, [rsp]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$b4vmulu) ; <fold >
        inst b4vmulu
                    overify TAG_BYTE4, TAG_BYTE4
                    vpmovzxbw xmm0, [rsp+$10]
                    vpmovzxbw xmm1, [rsp+$00]
                    vpmullw xmm0, xmm0, xmm1
                    vpaddw  xmm0, xmm0, [s8.00]
                    vpsrlw  xmm0, xmm0, $08
                    vpackuswb xmm0, xmm0, xmm0
                    vpand   xmm0, xmm0, [b8.02]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$b4vaddu) ; <fold >
        inst b4vaddu
                    overify TAG_BYTE4, TAG_BYTE4
                    vmovdqa xmm0, [rsp+$10]
                    vpaddusb xmm0, xmm0, [rsp]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$b4vsubu) ; <fold >
        inst b4vsubu
                    overify TAG_BYTE4, TAG_BYTE4
                    vmovdqa xmm0, [rsp+$10]
                    vpsubusb xmm0, xmm0, [rsp]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>
; </fold>