instruction.byte.inc

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

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

; <fold conversion>
    if(used inst$btob2) ; <fold >
        inst btob2
                    overify TAG_INT
                    and     dword[rsp], $ff
                    set     TAG_BYTE2
        end_inst
    end if ; </fold>

    if(used inst$btob4) ; <fold >
        inst btob4
                    overify TAG_INT
                    and     dword[rsp], $ff
                    set     TAG_BYTE4
        end_inst
    end if ; </fold>

    if(used inst$btob8) ; <fold >
        inst btob8
                    overify TAG_INT
                    and     qword[rsp], $ff
                    set     TAG_BYTE8
        end_inst
    end if ; </fold>

    if(used inst$btos | used inst$btoi) ; <fold >
        inst btos, btoi
                    overify TAG_INT
                    movsx   eax, byte[rsp]
                    mov     dword[rsp], eax
        end_inst
    end if ; </fold>

    if(used inst$btol) ; <fold >
        inst btol
                    overify TAG_INT
                    movsx   rax, byte[rsp]
                    mov     qword[rsp], rax
                    set     TAG_LONG
        end_inst
    end if ; </fold>
; </fold>

; <fold bitwise>
    if(used inst$bnot) ; <fold >
        inst bnot
                    overify TAG_INT
                    movsx   eax, byte[rsp]
                    not     eax
                    mov     dword[rsp], eax
        end_inst
    end if ; </fold>

    if(used inst$band) ; <fold >
        inst band
                    overify TAG_INT, TAG_INT
                    movsx   eax, byte[rsp+$10]
                    movsx   ecx, byte[rsp+$00]
                    and     eax, ecx
                    mov     dword[rsp+$10], eax
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$bor) ; <fold >
        inst bor
                    overify TAG_INT, TAG_INT
                    movsx   eax, byte[rsp+$10]
                    movsx   ecx, byte[rsp+$00]
                    or      eax, ecx
                    mov     dword[rsp+$10], eax
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$bxor) ; <fold >
        inst bxor
                    overify TAG_INT, TAG_INT
                    movsx   eax, byte[rsp+$10]
                    movsx   ecx, byte[rsp+$00]
                    xor     eax, ecx
                    mov     dword[rsp+$10], eax
                    pop1set
        end_inst
    end if ; </fold>
; </fold>

; <fold vector>
    if(used inst$bvunpckl) ; <fold >
        inst bvunpckl
                    overify TAG_INT
                    and     dword[rsp], $ff
        end_inst
    end if ; </fold>

    if(used inst$bvunpcku) ; <fold >
        inst bvunpcku
                    overify TAG_INT
                    movsx   eax, byte[rsp]
                    shl     eax, $08
                    mov     dword[rsp], eax
        end_inst
    end if ; </fold>

    if(used inst$bvneg) ; <fold >
        inst bvneg
                    overify TAG_INT
                    mov     al, [rsp]
                    neg     al
                    movsx   eax, al
                    mov     dword[rsp], eax
        end_inst
    end if ; </fold>

    if(used inst$bvmul) ; <fold >
        inst bvmul
                    overify TAG_INT, TAG_INT
                    mov     al, [rsp+$10]
                    imul    byte[rsp+$00]
                    movsx   eax, al
                    mov     dword[rsp+$10], eax
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$bvadd) ; <fold >
        inst bvadd
                    overify TAG_INT, TAG_INT
                    mov     al, [rsp+$10]
                    add     al, [rsp+$00]
                    movsx   eax, al
                    mov     dword[rsp+$10], eax
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$bvsub) ; <fold >
        inst bvsub
                    overify TAG_INT, TAG_INT
                    mov     al, [rsp+$10]
                    sub     al, [rsp+$00]
                    movsx   eax, al
                    mov     dword[rsp+$10], eax
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$bvsar) ; <fold >
        inst bvsar
                    overify TAG_INT, TAG_INT
                    mov     cl, [rsp+$00]
                    mov     al, [rsp+$10]
                    sar     al, cl
                    movsx   eax, al
                    mov     dword[rsp+$10], eax
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$bvsal) ; <fold >
        inst bvsal
                    overify TAG_INT, TAG_INT
                    mov     cl, [rsp+$00]
                    mov     al, [rsp+$10]
                    sal     al, cl
                    movsx   eax, al
                    mov     dword[rsp+$10], eax
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$bvshr) ; <fold >
        inst bvshr
                    overify TAG_INT, TAG_INT
                    mov     cl, [rsp+$00]
                    mov     al, [rsp+$10]
                    shr     al, cl
                    movsx   eax, al
                    mov     dword[rsp+$10], eax
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$bvg) ; <fold >
        inst bvg
                    overify TAG_INT, TAG_INT
                    mov     al, [rsp+$10]
                    cmp     al, [rsp+$00]
                    setng   al
                    dec     al
                    movsx   eax, al
                    mov     dword[rsp+$10], eax
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$bvge) ; <fold >
        inst bvge
                    overify TAG_INT, TAG_INT
                    mov     al, [rsp+$10]
                    cmp     al, [rsp+$00]
                    setnge  al
                    dec     al
                    movsx   eax, al
                    mov     dword[rsp+$10], eax
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$bvl) ; <fold >
        inst bvl
                    overify TAG_INT, TAG_INT
                    mov     al, [rsp+$10]
                    cmp     al, [rsp+$00]
                    setnl   al
                    dec     al
                    movsx   eax, al
                    mov     dword[rsp+$10], eax
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$bvle) ; <fold >
        inst bvle
                    overify TAG_INT, TAG_INT
                    mov     al, [rsp+$10]
                    cmp     al, [rsp+$00]
                    setnle  al
                    dec     al
                    movsx   eax, al
                    mov     dword[rsp+$10], eax
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$bve) ; <fold >
        inst bve
                    overify TAG_INT, TAG_INT
                    mov     al, [rsp+$10]
                    cmp     al, [rsp+$00]
                    setne   al
                    dec     al
                    movsx   eax, al
                    mov     dword[rsp+$10], eax
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$bvne) ; <fold >
        inst bvne
                    overify TAG_INT, TAG_INT
                    mov     al, [rsp+$10]
                    cmp     al, [rsp+$00]
                    sete    al
                    dec     al
                    movsx   eax, al
                    mov     dword[rsp+$10], eax
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$bvmuls) ; <fold >
        inst bvmuls
                    overify TAG_INT, TAG_INT
                    movsx   eax, byte[rsp+$10]
                    movsx   ecx, byte[rsp+$00]
                    vmovd   xmm0, eax
                    vmovd   xmm1, ecx
                    vpmullw xmm0, xmm0, xmm1
                    vpaddw  xmm0, xmm0, [s8.05] ; $0040
                    vpsraw  xmm0, xmm0, $07
                    vpacksswb xmm0, xmm0, xmm0
                    vpand   xmm0, xmm0, [b8.04]
                    vpmovsxbd xmm0, xmm0
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$bvadds) ; <fold >
        inst bvadds
                    overify TAG_INT, TAG_INT
                    movzx   eax, byte[rsp+$10]
                    movzx   ecx, byte[rsp+$00]
                    vmovd   xmm0, eax
                    vmovd   xmm1, ecx
                    vpaddsb xmm0, xmm0, xmm1
                    vpmovsxbd xmm0, xmm0
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$bvsubs) ; <fold >
        inst bvsubs
                    overify TAG_INT, TAG_INT
                    movzx   eax, byte[rsp+$10]
                    movzx   ecx, byte[rsp+$00]
                    vmovd   xmm0, eax
                    vmovd   xmm1, ecx
                    vpsubsb xmm0, xmm0, xmm1
                    vpmovsxbd xmm0, xmm0
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$bvmulu) ; <fold >
        inst bvmulu
                    overify TAG_INT, TAG_INT
                    movzx   eax, byte[rsp+$10]
                    movzx   ecx, byte[rsp+$00]
                    vmovd   xmm0, eax
                    vmovd   xmm1, ecx
                    vpmullw xmm0, xmm0, xmm1
                    vpaddw  xmm0, xmm0, [s8.00] ; $00ff
                    vpsrlw  xmm0, xmm0, $08
                    vpackuswb xmm0, xmm0, xmm0
                    vpand   xmm0, xmm0, [b8.04]
                    vpmovsxbd xmm0, xmm0
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$bvaddu) ; <fold >
        inst bvaddu
                    overify TAG_INT, TAG_INT
                    movzx   eax, byte[rsp+$10]
                    movzx   ecx, byte[rsp+$00]
                    vmovd   xmm0, eax
                    vmovd   xmm1, ecx
                    vpaddusb xmm0, xmm0, xmm1
                    vpmovsxbd xmm0, xmm0
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$bvsubu) ; <fold >
        inst bvsubu
                    overify TAG_INT, TAG_INT
                    movzx   eax, byte[rsp+$10]
                    movzx   ecx, byte[rsp+$00]
                    vmovd   xmm0, eax
                    vmovd   xmm1, ecx
                    vpsubusb xmm0, xmm0, xmm1
                    vpmovsxbd xmm0, xmm0
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>
; </fold>