instruction.double4.inc

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

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

; <fold push/pop/peek>
    if(used inst$d4push) ; <fold >
        inst d4push ; (value in ymm0)
                    push2
                    vmovdqu yword[rsp], ymm0
                    set     TAG_DOUBLE4
        end_inst
    end if ; </fold>

    if(used inst$d4pop) ; <fold >
        inst d4pop ; (): value in ymm0
                    overify TAG_DOUBLE4
                    vmovdqu ymm0, [rsp]
                    pop2set
        end_inst
    end if ; </fold>
; </fold>

; <fold conversion>
    if(used inst$d4toi4) ; <fold >
        inst d4toi4
                    overify TAG_DOUBLE4
                    vmovdqu ymm0, [rsp]
                    vcvttpd2dq xmm1, ymm0
                    vmovdqa ymm2, [d8.00]
                    vmovdqa xmm3, [i8.01]
                    vcmppd  k1, ymm2, ymm0, $02
                    vcmppd  k2, ymm0, ymm0, $07
                    vmovdqa32 xmm2{k1}{z}, xmm3
                    vmovdqa32 xmm3{k2}{z}, xmm3
                    vpaddd  xmm0, xmm1, xmm2
                    vpand   xmm0, xmm0, xmm3
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set TAG_INT4
        end_inst
    end if ; </fold>

    if(used inst$d4tol4) ; <fold >
        inst d4tol4
                    overify TAG_DOUBLE4
                    vmovdqu ymm0, [rsp]
                    vcvttpd2qq ymm1, ymm0
                    vmovdqa ymm2, [d8.01]
                    vcmppd  ymm2, ymm2, ymm0, $02
                    vcmppd  ymm3, ymm0, ymm0, $07
                    vpaddq  ymm0, ymm1, ymm2
                    vpand   ymm0, ymm0, ymm3
                    vmovdqu yword[rsp], ymm0
                    set     TAG_LONG4
        end_inst
    end if ; </fold>

    if(used inst$d4tof4) ; <fold >
        inst d4tof4
                    overify TAG_DOUBLE4
                    vmovdqu ymm0, [rsp]
                    vcvtpd2ps xmm0, ymm0
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set TAG_FLOAT4
        end_inst
    end if ; </fold>

    if(used inst$d4tod) ; <fold >
        inst d4tod
                    overify TAG_DOUBLE4
                    vmovq   xmm0, [rsp]
                    vmovdqa xword[rsp+$10], xmm0
                    pop1set TAG_DOUBLE
        end_inst
    end if ; </fold>

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

    if(used inst$d4tod8) ; <fold >
        inst d4tod8
                    overify TAG_DOUBLE4
                    push2
                    vmovdqu ymm0, [rsp+$20]
                    vmovdqu64 zword[rsp], zmm0
                    set     TAG_DOUBLE8
        end_inst
    end if ; </fold>
; </fold>

; <fold relation>
    if(used inst$d4se) ; <fold >
        inst d4se
                    overify TAG_DOUBLE4, TAG_DOUBLE4
                    vmovdqu ymm0, [rsp+$20]
                    vmovdqu ymm1, [rsp+$00]
                    vcmppd  ymm0, ymm0, ymm1, $00
                    vmovmskpd eax, ymm0
                    cmp     eax, $0f
                    sete    al
                    movsx   eax, al
                    vmovd   xmm0, eax
                    vmovdqa xword[rsp+$30], xmm0
                    pop3set TAG_INT
        end_inst
    end if ; </fold>

    if(used inst$d4sne) ; <fold >
        inst d4sne
                    overify TAG_DOUBLE4, TAG_DOUBLE4
                    vmovdqu ymm0, [rsp+$20]
                    vmovdqu ymm1, [rsp+$00]
                    vcmppd  ymm0, ymm0, ymm1, $00
                    vmovmskpd eax, ymm0
                    cmp     eax, $0f
                    setne   al
                    movsx   eax, al
                    vmovd   xmm0, eax
                    vmovdqa xword[rsp+$30], xmm0
                    pop3set TAG_INT
        end_inst
    end if ; </fold>
; </fold>

; <fold scalar>
    if(used inst$d4sneg | used inst$d4vneg) ; <fold >
        inst d4sneg, d4vneg
                    overify TAG_DOUBLE4
                    vmovdqu ymm0, [rsp]
                    vpxor   ymm1, ymm0, ymm0
                    vsubpd  ymm0, ymm1, ymm0
                    vmovdqu yword[rsp], ymm0
        end_inst
    end if ; </fold>

    if(used inst$d4smul) ; <fold >
        inst d4smul
                    overify TAG_DOUBLE4, TAG_DOUBLE4
                    vmovdqu ymm0, [rsp+$20]
                    vmovdqu ymm1, [rsp+$00]
                    vshuff64x2 ymm4, ymm1, ymm1, $02
                    vshuff64x2 ymm6, ymm4, ymm4, $01
                    vshufpd ymm5, ymm4, ymm4, $05
                    vshufpd ymm7, ymm6, ymm6, $05
                    vmulpd  ymm4, ymm4, [d4.q0]
                    vmulpd  ymm5, ymm5, [d4.q1]
                    vmulpd  ymm6, ymm6, [d4.q2]
                    vmulpd  ymm7, ymm7, [d4.q3]
                    vmulpd  ymm3, ymm0, ymm7
                    vmulpd  ymm2, ymm0, ymm6
                    vmulpd  ymm1, ymm0, ymm5
                    vmulpd  ymm0, ymm0, ymm4
                    vextractf128 xmm4, ymm0, $01
                    vextractf128 xmm5, ymm1, $01
                    vextractf128 xmm6, ymm2, $01
                    vextractf128 xmm7, ymm3, $01
                    vinsertf128 ymm0, ymm0, xmm2, $01
                    vinsertf128 ymm2, ymm1, xmm3, $01
                    vinsertf128 ymm1, ymm4, xmm6, $01
                    vinsertf128 ymm3, ymm5, xmm7, $01
                    vaddpd  ymm0, ymm0, ymm1
                    vaddpd  ymm1, ymm2, ymm3
                    vshufpd ymm2, ymm0, ymm1, $00
                    vshufpd ymm3, ymm0, ymm1, $0f
                    vaddpd  ymm0, ymm2, ymm3
                    vmovdqu yword[rsp+$20], ymm0
                    pop2set
        end_inst
    end if ; </fold>

    if(used inst$d4sdiv) ; <fold >
        inst d4sdiv
                    overify TAG_DOUBLE4, TAG_DOUBLE4
                    vmovdqu ymm0, [rsp+$20]
                    vmovdqu ymm1, [rsp+$00]
                    vmulpd  ymm1, ymm1, [d4.q0]
                    vmulpd  ymm2, ymm1, ymm1
                    vextractf128 xmm3, ymm2, $01
                    vhaddpd xmm2, xmm2, xmm3
                    vhaddpd xmm2, xmm2, xmm2
                    vinsertf128 ymm2, ymm2, xmm2, $01
                    vdivpd  ymm1, ymm1, ymm2
                    vshuff64x2 ymm4, ymm1, ymm1, $02
                    vshuff64x2 ymm6, ymm4, ymm4, $01
                    vshufpd ymm5, ymm4, ymm4, $05
                    vshufpd ymm7, ymm6, ymm6, $05
                    vmulpd  ymm4, ymm4, [d4.q0]
                    vmulpd  ymm5, ymm5, [d4.q1]
                    vmulpd  ymm6, ymm6, [d4.q2]
                    vmulpd  ymm7, ymm7, [d4.q3]
                    vmulpd  ymm3, ymm0, ymm7
                    vmulpd  ymm2, ymm0, ymm6
                    vmulpd  ymm1, ymm0, ymm5
                    vmulpd  ymm0, ymm0, ymm4
                    vextractf128 xmm4, ymm0, $01
                    vextractf128 xmm5, ymm1, $01
                    vextractf128 xmm6, ymm2, $01
                    vextractf128 xmm7, ymm3, $01
                    vinsertf128 ymm0, ymm0, xmm2, $01
                    vinsertf128 ymm2, ymm1, xmm3, $01
                    vinsertf128 ymm1, ymm4, xmm6, $01
                    vinsertf128 ymm3, ymm5, xmm7, $01
                    vaddpd  ymm0, ymm0, ymm1
                    vaddpd  ymm1, ymm2, ymm3
                    vshufpd ymm2, ymm0, ymm1, $00
                    vshufpd ymm3, ymm0, ymm1, $0f
                    vaddpd  ymm0, ymm2, ymm3
                    vmovdqu yword[rsp+$20], ymm0
                    pop2set
        end_inst
    end if ; </fold>

    if(used inst$d4sdivu) ; <fold >
        inst d4sdivu
                    overify TAG_DOUBLE4, TAG_DOUBLE4
                    vmovdqu ymm0, [rsp+$00]
                    vmovdqu ymm1, [rsp+$20]
                    vmulpd  ymm0, ymm0, [d4.q0]
                    vmulpd  ymm2, ymm0, ymm0
                    vextractf128 xmm3, ymm2, $01
                    vhaddpd xmm2, xmm2, xmm3
                    vhaddpd xmm2, xmm2, xmm2
                    vinsertf128 ymm2, ymm2, xmm2, $01
                    vdivpd  ymm0, ymm0, ymm2
                    vshuff64x2 ymm4, ymm1, ymm1, $02
                    vshuff64x2 ymm6, ymm4, ymm4, $01
                    vshufpd ymm5, ymm4, ymm4, $05
                    vshufpd ymm7, ymm6, ymm6, $05
                    vmulpd  ymm4, ymm4, [d4.q0]
                    vmulpd  ymm5, ymm5, [d4.q1]
                    vmulpd  ymm6, ymm6, [d4.q2]
                    vmulpd  ymm7, ymm7, [d4.q3]
                    vmulpd  ymm3, ymm0, ymm7
                    vmulpd  ymm2, ymm0, ymm6
                    vmulpd  ymm1, ymm0, ymm5
                    vmulpd  ymm0, ymm0, ymm4
                    vextractf128 xmm4, ymm0, $01
                    vextractf128 xmm5, ymm1, $01
                    vextractf128 xmm6, ymm2, $01
                    vextractf128 xmm7, ymm3, $01
                    vinsertf128 ymm0, ymm0, xmm2, $01
                    vinsertf128 ymm2, ymm1, xmm3, $01
                    vinsertf128 ymm1, ymm4, xmm6, $01
                    vinsertf128 ymm3, ymm5, xmm7, $01
                    vaddpd  ymm0, ymm0, ymm1
                    vaddpd  ymm1, ymm2, ymm3
                    vshufpd ymm2, ymm0, ymm1, $00
                    vshufpd ymm3, ymm0, ymm1, $0f
                    vaddpd  ymm0, ymm2, ymm3
                    vmovdqu yword[rsp+$20], ymm0
                    pop2set
        end_inst
    end if ; </fold>

    if(used inst$d4sadd | used inst$d4vadd) ; <fold >
        inst d4sadd, d4vadd
                    overify TAG_DOUBLE4, TAG_DOUBLE4
                    vmovdqu ymm0, [rsp+$20]
                    vmovdqu ymm1, [rsp+$00]
                    vaddpd  ymm0, ymm0, ymm1
                    vmovdqu yword[rsp+$20], ymm0
                    pop2set
        end_inst
    end if ; </fold>

    if(used inst$d4ssub | used inst$d4vsub) ; <fold >
        inst d4ssub, d4vsub
                    overify TAG_DOUBLE4, TAG_DOUBLE4
                    vmovdqu ymm0, [rsp+$20]
                    vmovdqu ymm1, [rsp+$00]
                    vsubpd  ymm0, ymm0, ymm1
                    vmovdqu yword[rsp+$20], ymm0
                    pop2set
        end_inst
    end if ; </fold>
; </fold>

; <fold vector>
    if(used inst$d4vmul) ; <fold >
        inst d4vmul
                    overify TAG_DOUBLE4, TAG_DOUBLE4
                    vmovdqu ymm0, [rsp+$20]
                    vmovdqu ymm1, [rsp+$00]
                    vmulpd  ymm0, ymm0, ymm1
                    vmovdqu yword[rsp+$20], ymm0
                    pop2set
        end_inst
    end if ; </fold>

    if(used inst$d4vdiv) ; <fold >
        inst d4vdiv
                    overify TAG_DOUBLE4, TAG_DOUBLE4
                    vmovdqu ymm0, [rsp+$20]
                    vmovdqu ymm1, [rsp+$00]
                    vdivpd  ymm0, ymm0, ymm1
                    vmovdqu yword[rsp+$20], ymm0
                    pop2set
        end_inst
    end if ; </fold>

    if(used inst$d4vg) ; <fold >
        inst d4vg
                    overify TAG_DOUBLE4, TAG_DOUBLE4
                    vmovdqu ymm0, [rsp+$20]
                    vmovdqu ymm1, [rsp+$00]
                    vcmppd  ymm0, ymm1, ymm0, $01
                    vmovdqu yword[rsp+$20], ymm0
                    pop2set TAG_LONG4
        end_inst
    end if ; </fold>

    if(used inst$d4vge) ; <fold >
        inst d4vge
                    overify TAG_DOUBLE4, TAG_DOUBLE4
                    vmovdqu ymm0, [rsp+$20]
                    vmovdqu ymm1, [rsp+$00]
                    vcmppd  ymm0, ymm1, ymm0, $02
                    vmovdqu yword[rsp+$20], ymm0
                    pop2set TAG_LONG4
        end_inst
    end if ; </fold>

    if(used inst$d4vl) ; <fold >
        inst d4vl
                    overify TAG_DOUBLE4, TAG_DOUBLE4
                    vmovdqu ymm0, [rsp+$20]
                    vmovdqu ymm1, [rsp+$00]
                    vcmppd  ymm0, ymm0, ymm1, $01
                    vmovdqu yword[rsp+$20], ymm0
                    pop2set TAG_LONG4
        end_inst
    end if ; </fold>

    if(used inst$d4vle) ; <fold >
        inst d4vle
                    overify TAG_DOUBLE4, TAG_DOUBLE4
                    vmovdqu ymm0, [rsp+$20]
                    vmovdqu ymm1, [rsp+$00]
                    vcmppd  ymm0, ymm0, ymm1, $02
                    vmovdqu yword[rsp+$20], ymm0
                    pop2set TAG_LONG4
        end_inst
    end if ; </fold>

    if(used inst$d4ve) ; <fold >
        inst d4ve
                    overify TAG_DOUBLE4, TAG_DOUBLE4
                    vmovdqu ymm0, [rsp+$20]
                    vmovdqu ymm1, [rsp+$00]
                    vcmppd  ymm0, ymm0, ymm1, $00
                    vmovdqu yword[rsp+$20], ymm0
                    pop2set TAG_LONG4
        end_inst
    end if ; </fold>

    if(used inst$d4vne) ; <fold >
        inst d4vne
                    overify TAG_DOUBLE4, TAG_DOUBLE4
                    vmovdqu ymm0, [rsp+$20]
                    vmovdqu ymm1, [rsp+$00]
                    vcmppd  ymm0, ymm0, ymm1, $04
                    vmovdqu yword[rsp+$20], ymm0
                    pop2set TAG_LONG4
        end_inst
    end if ; </fold>
; </fold>