instruction.float2.inc

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

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

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

    if(used inst$f2pop) ; <fold >
        inst f2pop ; (): value in xmm0
                    overify TAG_FLOAT2
                    vmovq   xmm0, [rsp]
                    pop1set
        end_inst
    end if ; </fold>
; </fold>

; <fold conversion>
    if(used inst$f2toi2) ; <fold >
        inst f2toi2
                    overify TAG_FLOAT2
                    vmovq   xmm0, [rsp]
                    vcvttps2dq xmm1, xmm0
                    vmovdqa xmm2, [f8.00]
                    vcmpps  xmm2, xmm2, xmm0, $02
                    vcmpps  xmm3, xmm0, xmm0, $07
                    vpaddd  xmm0, xmm1, xmm2
                    vpand   xmm0, xmm0, xmm3
                    vmovdqa xword[rsp], xmm0
                    set     TAG_INT2
        end_inst
    end if ; </fold>

    if(used inst$f2tol2) ; <fold >
        inst f2tol2
                    overify TAG_FLOAT2
                    vcvtps2pd xmm0, [rsp]
                    vcvttpd2qq xmm1, xmm0
                    vmovdqa xmm2, [d8.01]
                    vcmppd  xmm2, xmm2, xmm0, $02
                    vcmppd  xmm3, xmm0, xmm0, $07
                    vpaddq  xmm0, xmm1, xmm2
                    vpand   xmm0, xmm0, xmm3
                    vmovdqa xword[rsp], xmm0
                    set     TAG_LONG2
        end_inst
    end if ; </fold>

    if(used inst$f2tof) ; <fold >
        inst f2tof
                    overify TAG_FLOAT2
                    vmovd   xmm0, [rsp]
                    vmovdqa xword[rsp], xmm0
                    set     TAG_FLOAT
        end_inst
    end if ; </fold>

    if(used inst$f2tof4) ; <fold >
        inst f2tof4
                    overify TAG_FLOAT2
                    vmovq   xmm0, [rsp]
                    vmovdqa xword[rsp], xmm0
                    set     TAG_FLOAT4
        end_inst
    end if ; </fold>

    if(used inst$f2tof8) ; <fold >
        inst f2tof8
                    overify TAG_FLOAT2
                    push1
                    vmovq   xmm0, [rsp+$10]
                    vmovdqu yword[rsp], ymm0
                    set     TAG_FLOAT8
        end_inst
    end if ; </fold>

    if(used inst$f2tod2) ; <fold >
        inst f2tod2
                    overify TAG_FLOAT2
                    vcvtps2pd xmm0, [rsp]
                    vmovdqa xword[rsp], xmm0
                    set     TAG_DOUBLE2
        end_inst
    end if ; </fold>
; </fold>

; <fold relation>
    if(used inst$f2se) ; <fold >
        inst f2se
                    overify TAG_FLOAT2, TAG_FLOAT2
                    vmovdqa xmm0, [rsp+$10]
                    vcmpps  xmm0, xmm0, [rsp], $00
                    vmovmskps eax, xmm0
                    and     eax, $03
                    cmp     eax, $03
                    sete    al
                    movsx   eax, al
                    vmovd   xmm0, eax
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set TAG_INT
        end_inst
    end if ; </fold>

    if(used inst$f2sne) ; <fold >
        inst f2sne
                    overify TAG_FLOAT2, TAG_FLOAT2
                    vmovdqa xmm0, [rsp+$10]
                    vcmpps  xmm0, xmm0, [rsp], $00
                    vmovmskps eax, xmm0
                    and     eax, $03
                    cmp     eax, $03
                    setne   al
                    movsx   eax, al
                    vmovd   xmm0, eax
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set TAG_INT
        end_inst
    end if ; </fold>
; </fold>

; <fold scalar>
    if(used inst$f2sneg | used inst$f2vneg) ; <fold >
        inst f2sneg, f2vneg
                    overify TAG_FLOAT2
                    vpxor   xmm0, xmm0, xmm0
                    vsubps  xmm0, xmm0, [rsp]
                    vmovdqa xword[rsp], xmm0
        end_inst
    end if ; </fold>

    if(used inst$f2smul) ; <fold >
        inst f2smul
                    overify TAG_FLOAT2, TAG_FLOAT2
                    vmovdqa xmm0, [rsp+$10]
                    vmovdqa xmm1, [rsp+$00]
                    vshufps xmm2, xmm1, xmm1, $e4
                    vshufps xmm3, xmm2, xmm2, $e1
                    vmulps  xmm2, xmm2, [f2.c0]
                    vmulps  xmm1, xmm0, xmm3
                    vmulps  xmm0, xmm0, xmm2
                    vhaddps xmm0, xmm0, xmm1
                    vshufps xmm0, xmm0, xmm0, $d8
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$f2sdiv) ; <fold >
        inst f2sdiv
                    overify TAG_FLOAT2, TAG_FLOAT2
                    vmovdqa xmm0, [rsp+$10]
                    vmovdqa xmm1, [rsp+$00]
                    vmulps  xmm1, xmm1, [f2.c0]
                    vmulps  xmm2, xmm1, xmm1
                    vhaddps xmm2, xmm2, xmm2
                    vshufps xmm2, xmm2, xmm2, $d8
                    vdivps  xmm1, xmm1, xmm2
                    vpand   xmm1, xmm1, [i8.04]
                    vshufps xmm2, xmm1, xmm1, $e4
                    vshufps xmm3, xmm2, xmm2, $e1
                    vmulps  xmm2, xmm2, [f2.c0]
                    vmulps  xmm1, xmm0, xmm3
                    vmulps  xmm0, xmm0, xmm2
                    vhaddps xmm0, xmm0, xmm1
                    vshufps xmm0, xmm0, xmm0, $d8
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$f2sdivu) ; <fold >
        inst f2sdivu
                    overify TAG_FLOAT2, TAG_FLOAT2
                    vmovdqa xmm0, [rsp+$00]
                    vmovdqa xmm1, [rsp+$10]
                    vmulps  xmm0, xmm0, [f2.c0]
                    vmulps  xmm2, xmm0, xmm0
                    vhaddps xmm2, xmm2, xmm2
                    vshufps xmm2, xmm2, xmm2, $d8
                    vdivps  xmm0, xmm0, xmm2
                    vpand   xmm0, xmm0, [i8.04]
                    vshufps xmm2, xmm1, xmm1, $e4
                    vshufps xmm3, xmm2, xmm2, $e1
                    vmulps  xmm2, xmm2, [f2.c0]
                    vmulps  xmm1, xmm0, xmm3
                    vmulps  xmm0, xmm0, xmm2
                    vhaddps xmm0, xmm0, xmm1
                    vshufps xmm0, xmm0, xmm0, $d8
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$f2sadd | used inst$f2vadd) ; <fold >
        inst f2sadd, f2vadd
                    overify TAG_FLOAT2, TAG_FLOAT2
                    vmovdqa xmm0, [rsp+$10]
                    vaddps  xmm0, xmm0, [rsp]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$f2ssub | used inst$f2vsub) ; <fold >
        inst f2ssub, f2vsub
                    overify TAG_FLOAT2, TAG_FLOAT2
                    vmovdqa xmm0, [rsp+$10]
                    vsubps  xmm0, xmm0, [rsp]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>
; </fold>

; <fold vector>
    if(used inst$f2vmul) ; <fold >
        inst f2vmul
                    overify TAG_FLOAT2, TAG_FLOAT2
                    vmovdqa xmm0, [rsp+$10]
                    vmulps  xmm0, xmm0, [rsp]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$f2vdiv) ; <fold >
        inst f2vdiv
                    overify TAG_FLOAT2, TAG_FLOAT2
                    vmovdqa xmm0, [rsp+$10]
                    vdivps  xmm0, xmm0, [rsp]
                    vpand   xmm0, xmm0, [i8.04]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set
        end_inst
    end if ; </fold>

    if(used inst$f2vg) ; <fold >
        inst f2vg
                    overify TAG_FLOAT2, TAG_FLOAT2
                    vmovdqa xmm0, [rsp+$10]
                    vmovdqa xmm1, [rsp+$00]
                    vcmpps  xmm0, xmm1, xmm0, $01
                    vpand   xmm0, xmm0, [i8.04]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set TAG_INT2
        end_inst
    end if ; </fold>

    if(used inst$f2vge) ; <fold >
        inst f2vge
                    overify TAG_FLOAT2, TAG_FLOAT2
                    vmovdqa xmm0, [rsp+$10]
                    vmovdqa xmm1, [rsp+$00]
                    vcmpps  xmm0, xmm1, xmm0, $02
                    vpand   xmm0, xmm0, [i8.04]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set TAG_INT2
        end_inst
    end if ; </fold>

    if(used inst$f2vl) ; <fold >
        inst f2vl
                    overify TAG_FLOAT2, TAG_FLOAT2
                    vmovdqa xmm0, [rsp+$10]
                    vmovdqa xmm1, [rsp+$00]
                    vcmpps  xmm0, xmm0, xmm1, $01
                    vpand   xmm0, xmm0, [i8.04]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set TAG_INT2
        end_inst
    end if ; </fold>

    if(used inst$f2vle) ; <fold >
        inst f2vle
                    overify TAG_FLOAT2, TAG_FLOAT2
                    vmovdqa xmm0, [rsp+$10]
                    vmovdqa xmm1, [rsp+$00]
                    vcmpps  xmm0, xmm0, xmm1, $02
                    vpand   xmm0, xmm0, [i8.04]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set TAG_INT2
        end_inst
    end if ; </fold>

    if(used inst$f2ve) ; <fold >
        inst f2ve
                    overify TAG_FLOAT2, TAG_FLOAT2
                    vmovdqa xmm0, [rsp+$10]
                    vmovdqa xmm1, [rsp+$00]
                    vcmpps  xmm0, xmm0, xmm1, $00
                    vpand   xmm0, xmm0, [i8.04]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set TAG_INT2
        end_inst
    end if ; </fold>

    if(used inst$f2vne) ; <fold >
        inst f2vne
                    overify TAG_FLOAT2, TAG_FLOAT2
                    vmovdqa xmm0, [rsp+$10]
                    vmovdqa xmm1, [rsp+$00]
                    vcmpps  xmm0, xmm0, xmm1, $04
                    vpand   xmm0, xmm0, [i8.04]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set TAG_INT2
        end_inst
    end if ; </fold>
; </fold>