;
; Исходный код среды исполнения ПВТ-ОО.
;
; Этот исходный код является частью проекта ПВТ-ОО.
;
; Copyright © 2021 Малик Разработчик
;
; Это свободная программа: вы можете перераспространять её и/или
; изменять её на условиях Меньшей Стандартной общественной лицензии GNU в том виде,
; в каком она была опубликована Фондом свободного программного обеспечения;
; либо версии 3 лицензии, либо (по вашему выбору) любой более поздней версии.
;
; Эта программа распространяется в надежде, что она может быть полезна,
; но БЕЗО ВСЯКИХ ГАРАНТИЙ; даже без неявной гарантии ТОВАРНОГО ВИДА
; или ПРИГОДНОСТИ ДЛЯ ОПРЕДЕЛЁННЫХ ЦЕЛЕЙ. Подробнее см. в Меньшей Стандартной
; общественной лицензии GNU.
;
; Вы должны были получить копию Меньшей Стандартной общественной лицензии GNU
; вместе с этой программой. Если это не так, см.
; <http://www.gnu.org/licenses/>.
;
; <fold push/pop/peek>
if(used inst$i4push) ; <fold >
inst i4push ; (value in xmm0)
push1
vmovdqa xword[rsp], xmm0
set TAG_INT4
end_inst
end if ; </fold>
if(used inst$i4pop) ; <fold >
inst i4pop ; (): value in xmm0
overify TAG_INT4
vmovdqa xmm0, [rsp]
pop1set
end_inst
end if ; </fold>
; </fold>
; <fold conversion>
if(used inst$i4tob4) ; <fold >
inst i4tob4
overify TAG_INT4
vmovdqa xmm0, [rsp]
vpand xmm0, xmm0, [i8.03]
vpxor xmm1, xmm0, xmm0
vpackusdw xmm0, xmm0, xmm1
vpackuswb xmm0, xmm0, xmm1
vmovdqa xword[rsp], xmm0
set TAG_BYTE4
end_inst
end if ; </fold>
if(used inst$i4tos4) ; <fold >
inst i4tos4
overify TAG_INT4
vmovdqa xmm0, [rsp]
vpand xmm0, xmm0, [i8.02]
vpxor xmm1, xmm0, xmm0
vpackusdw xmm0, xmm0, xmm1
vmovdqa xword[rsp], xmm0
set TAG_SHORT4
end_inst
end if ; </fold>
if(used inst$i4toi) ; <fold >
inst i4toi
overify TAG_INT4
vmovd xmm0, [rsp]
vmovdqa xword[rsp], xmm0
set TAG_INT
end_inst
end if ; </fold>
if(used inst$i4toi2) ; <fold >
inst i4toi2
overify TAG_INT4
vmovq xmm0, [rsp]
vmovdqa xword[rsp], xmm0
set TAG_INT2
end_inst
end if ; </fold>
if(used inst$i4toi8) ; <fold >
inst i4toi8
overify TAG_INT4
push1
vmovdqa xmm0, [rsp+$10]
vmovdqu yword[rsp], ymm0
set TAG_INT8
end_inst
end if ; </fold>
if(used inst$i4tol4) ; <fold >
inst i4tol4
overify TAG_INT4
push1
vpmovsxdq ymm0, [rsp+$10]
vmovdqu yword[rsp], ymm0
set TAG_LONG4
end_inst
end if ; </fold>
if(used inst$i4tof4) ; <fold >
inst i4tof4
overify TAG_INT4
vcvtdq2ps xmm0, [rsp]
vmovdqa xword[rsp], xmm0
set TAG_FLOAT4
end_inst
end if ; </fold>
if(used inst$i4tod4) ; <fold >
inst i4tod4
overify TAG_INT4
push1
vcvtdq2pd ymm0, [rsp+$10]
vmovdqu yword[rsp], ymm0
set TAG_DOUBLE4
end_inst
end if ; </fold>
; </fold>
; <fold relation>
if(used inst$i4se) ; <fold >
inst i4se
overify TAG_INT4, TAG_INT4
vmovdqa xmm0, [rsp+$10]
vpcmpeqd xmm0, xmm0, [rsp]
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$i4sne) ; <fold >
inst i4sne
overify TAG_INT4, TAG_INT4
vmovdqa xmm0, [rsp+$10]
vpcmpeqd xmm0, xmm0, [rsp]
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$i4not) ; <fold >
inst i4not
overify TAG_INT4
vmovdqa xmm0, [rsp]
vpxor xmm0, xmm0, [i8.01]
vmovdqa xword[rsp], xmm0
end_inst
end if ; </fold>
if(used inst$i4and) ; <fold >
inst i4and
overify TAG_INT4, TAG_INT4
vmovdqa xmm0, [rsp+$10]
vpand xmm0, xmm0, [rsp]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$i4or) ; <fold >
inst i4or
overify TAG_INT4, TAG_INT4
vmovdqa xmm0, [rsp+$10]
vpor xmm0, xmm0, [rsp]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$i4xor) ; <fold >
inst i4xor
overify TAG_INT4, TAG_INT4
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$i4sneg | used inst$i4vneg) ; <fold >
inst i4sneg, i4vneg
overify TAG_INT4
vpxor xmm0, xmm0, xmm0
vpsubd xmm0, xmm0, [rsp]
vmovdqa xword[rsp], xmm0
end_inst
end if ; </fold>
if(used inst$i4smul) ; <fold >
inst i4smul
overify TAG_INT4, TAG_INT4
vmovdqa xmm0, [rsp+$10]
vmovdqa 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
end_inst
end if ; </fold>
if(used inst$i4sadd | used inst$i4vadd) ; <fold >
inst i4sadd, i4vadd
overify TAG_INT4, TAG_INT4
vmovdqa xmm0, [rsp+$10]
vpaddd xmm0, xmm0, [rsp]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$i4ssub | used inst$i4vsub) ; <fold >
inst i4ssub, i4vsub
overify TAG_INT4, TAG_INT4
vmovdqa xmm0, [rsp+$10]
vpsubd xmm0, xmm0, [rsp]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$i4ssar | used inst$i4vsar) ; <fold >
inst i4ssar, i4vsar
overify TAG_INT4, TAG_INT
mov ecx, [rsp]
and ecx, $1f
vmovdqa xmm0, [rsp+$10]
vmovd xmm1, ecx
vpsrad xmm0, xmm0, xmm1
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$i4ssal | used inst$i4vsal) ; <fold >
inst i4ssal, i4vsal
overify TAG_INT4, TAG_INT
mov ecx, [rsp]
and ecx, $1f
vmovdqa xmm0, [rsp+$10]
vmovd xmm1, ecx
vpslld xmm0, xmm0, xmm1
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$i4sshr | used inst$i4vshr) ; <fold >
inst i4sshr, i4vshr
overify TAG_INT4, TAG_INT
mov ecx, [rsp]
and ecx, $1f
vmovdqa xmm0, [rsp+$10]
vmovd xmm1, ecx
vpsrld xmm0, xmm0, xmm1
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
; </fold>
; <fold vector>
if(used inst$i4vpack) ; <fold >
inst i4vpack
overify TAG_INT4
vmovdqa xmm0, [rsp]
vpxor xmm1, xmm0, xmm0
vpackusdw xmm0, xmm0, xmm1
vmovdqa xword[rsp], xmm0
set TAG_SHORT4
end_inst
end if ; </fold>
if(used inst$i4vunpckl) ; <fold >
inst i4vunpckl
overify TAG_INT4
push1
vmovdqa xmm0, [rsp+$10]
vpxor xmm2, xmm0, xmm0
vpunpckhdq xmm1, xmm0, xmm2
vpunpckldq xmm0, xmm0, xmm2
vinserti128 ymm0, ymm0, xmm1, $01
vmovdqu yword[rsp], ymm0
set TAG_LONG4
end_inst
end if ; </fold>
if(used inst$i4vunpcku) ; <fold >
inst i4vunpcku
overify TAG_INT4
push1
vmovdqa xmm0, [rsp+$10]
vpxor xmm2, xmm0, xmm0
vpunpckhdq xmm1, xmm2, xmm0
vpunpckldq xmm0, xmm2, xmm0
vinserti128 ymm0, ymm0, xmm1, $01
vmovdqu yword[rsp], ymm0
set TAG_LONG4
end_inst
end if ; </fold>
if(used inst$i4vmul) ; <fold >
inst i4vmul
overify TAG_INT4, TAG_INT4
vmovdqa xmm0, [rsp+$10]
vpmulld xmm0, xmm0, [rsp]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$i4vg) ; <fold >
inst i4vg
overify TAG_INT4, TAG_INT4
vmovdqa xmm0, [rsp+$10]
vpcmpgtd xmm0, xmm0, [rsp]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$i4vge) ; <fold >
inst i4vge
overify TAG_INT4, TAG_INT4
vmovdqa xmm0, [rsp]
vpcmpgtd xmm0, xmm0, [rsp+$10]
vpxor xmm0, xmm0, [i8.01]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$i4vl) ; <fold >
inst i4vl
overify TAG_INT4, TAG_INT4
vmovdqa xmm0, [rsp]
vpcmpgtd xmm0, xmm0, [rsp+$10]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$i4vle) ; <fold >
inst i4vle
overify TAG_INT4, TAG_INT4
vmovdqa xmm0, [rsp+$10]
vpcmpgtd xmm0, xmm0, [rsp]
vpxor xmm0, xmm0, [i8.01]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$i4ve) ; <fold >
inst i4ve
overify TAG_INT4, TAG_INT4
vmovdqa xmm0, [rsp+$10]
vpcmpeqd xmm0, xmm0, [rsp]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$i4vne) ; <fold >
inst i4vne
overify TAG_INT4, TAG_INT4
vmovdqa xmm0, [rsp+$10]
vpcmpeqd xmm0, xmm0, [rsp]
vpxor xmm0, xmm0, [i8.01]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
; </fold>