;
; Исходный код среды исполнения ПВТ-ОО.
;
; Этот исходный код является частью проекта ПВТ-ОО.
;
; Copyright © 2021 Малик Разработчик
;
; Это свободная программа: вы можете перераспространять её и/или
; изменять её на условиях Меньшей Стандартной общественной лицензии GNU в том виде,
; в каком она была опубликована Фондом свободного программного обеспечения;
; либо версии 3 лицензии, либо (по вашему выбору) любой более поздней версии.
;
; Эта программа распространяется в надежде, что она может быть полезна,
; но БЕЗО ВСЯКИХ ГАРАНТИЙ; даже без неявной гарантии ТОВАРНОГО ВИДА
; или ПРИГОДНОСТИ ДЛЯ ОПРЕДЕЛЁННЫХ ЦЕЛЕЙ. Подробнее см. в Меньшей Стандартной
; общественной лицензии GNU.
;
; Вы должны были получить копию Меньшей Стандартной общественной лицензии GNU
; вместе с этой программой. Если это не так, см.
; <http://www.gnu.org/licenses/>.
;
; <fold push/pop/peek>
if(used inst$s2push) ; <fold >
inst s2push ; (value in xmm0)
push1
vmovdqa xword[rsp], xmm0
set TAG_SHORT2
end_inst
end if ; </fold>
if(used inst$s2pop) ; <fold >
inst s2pop ; (): value in xmm0
overify TAG_SHORT2
vmovd xmm0, [rsp]
pop1set
end_inst
end if ; </fold>
; </fold>
; <fold conversion>
if(used inst$s2tob2) ; <fold >
inst s2tob2
overify TAG_SHORT2
vmovdqa xmm0, [rsp]
vpand xmm0, xmm0, [s8.00]
vpxor xmm1, xmm0, xmm0
vpackuswb xmm0, xmm0, xmm1
vmovdqa xword[rsp], xmm0
set TAG_BYTE2
end_inst
end if ; </fold>
if(used inst$s2tos) ; <fold >
inst s2tos
overify TAG_SHORT2
movsx eax, word[rsp]
vmovd xmm0, eax
vmovdqa xword[rsp], xmm0
set TAG_INT
end_inst
end if ; </fold>
if(used inst$s2tos4) ; <fold >
inst s2tos4
overify TAG_SHORT2
vmovdqa xmm0, [rsp]
vpand xmm0, xmm0, [s8.03]
vmovdqa xword[rsp], xmm0
set TAG_SHORT4
end_inst
end if ; </fold>
if(used inst$s2tos8) ; <fold >
inst s2tos8
overify TAG_SHORT2
vmovdqa xmm0, [rsp]
vpand xmm0, xmm0, [s8.03]
vmovdqa xword[rsp], xmm0
set TAG_SHORT8
end_inst
end if ; </fold>
if(used inst$s2toi2) ; <fold >
inst s2toi2
overify TAG_SHORT2
vpmovsxwd xmm0, [rsp]
vmovdqa xword[rsp], xmm0
set TAG_INT2
end_inst
end if ; </fold>
if(used inst$s2tol2) ; <fold >
inst s2tol2
overify TAG_SHORT2
vpmovsxwq xmm0, [rsp]
vmovdqa xword[rsp], xmm0
set TAG_LONG2
end_inst
end if ; </fold>
; </fold>
; <fold relation>
if(used inst$s2se) ; <fold >
inst s2se
overify TAG_SHORT2, TAG_SHORT2
vpmovsxwd xmm0, [rsp+$10]
vpmovsxwd xmm1, [rsp+$00]
vpcmpeqd xmm0, xmm0, xmm1
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$s2sne) ; <fold >
inst s2sne
overify TAG_SHORT2, TAG_SHORT2
vpmovsxwd xmm0, [rsp+$10]
vpmovsxwd xmm1, [rsp+$00]
vpcmpeqd xmm0, xmm0, xmm1
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 bitwise>
if(used inst$s2not) ; <fold >
inst s2not
overify TAG_SHORT2
vmovdqa xmm0, [rsp]
vpxor xmm0, xmm0, [s8.03]
vmovdqa xword[rsp], xmm0
end_inst
end if ; </fold>
if(used inst$s2and) ; <fold >
inst s2and
overify TAG_SHORT2, TAG_SHORT2
vmovdqa xmm0, [rsp+$10]
vpand xmm0, xmm0, [rsp]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$s2or) ; <fold >
inst s2or
overify TAG_SHORT2, TAG_SHORT2
vmovdqa xmm0, [rsp+$10]
vpor xmm0, xmm0, [rsp]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$s2xor) ; <fold >
inst s2xor
overify TAG_SHORT2, TAG_SHORT2
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$s2sneg) ; <fold >
inst s2sneg
overify TAG_SHORT2
vpmovsxwd xmm0, [rsp]
vpxor xmm1, xmm0, xmm0
vpsubd xmm0, xmm1, xmm0
vmovdqa xword[rsp], xmm0
set TAG_INT2
end_inst
end if ; </fold>
if(used inst$s2smul) ; <fold >
inst s2smul
overify TAG_SHORT2, TAG_SHORT2
vpmovsxwd xmm0, [rsp+$10]
vpmovsxwd xmm1, [rsp+$00]
vshufps xmm2, xmm1, xmm1, $e4
vshufps xmm3, xmm2, xmm2, $e1
vpmulld xmm2, xmm2, [i2.c0]
vpmulld xmm1, xmm0, xmm3
vpmulld xmm0, xmm0, xmm2
vphaddd xmm0, xmm0, xmm1
vshufps xmm0, xmm0, xmm0, $d8
vmovdqa xword[rsp+$10], xmm0
pop1set TAG_INT2
end_inst
end if ; </fold>
if(used inst$s2sadd) ; <fold >
inst s2sadd
overify TAG_SHORT2, TAG_SHORT2
vpmovsxwd xmm0, [rsp+$10]
vpmovsxwd xmm1, [rsp+$00]
vpaddd xmm0, xmm0, xmm1
vmovdqa xword[rsp+$10], xmm0
pop1set TAG_INT2
end_inst
end if ; </fold>
if(used inst$s2ssub) ; <fold >
inst s2ssub
overify TAG_SHORT2, TAG_SHORT2
vpmovsxwd xmm0, [rsp+$10]
vpmovsxwd xmm1, [rsp+$00]
vpsubd xmm0, xmm0, xmm1
vmovdqa xword[rsp+$10], xmm0
pop1set TAG_INT2
end_inst
end if ; </fold>
if(used inst$s2ssar) ; <fold >
inst s2ssar
overify TAG_SHORT2, TAG_INT
mov ecx, [rsp]
and ecx, $1f
vpmovsxwd xmm0, [rsp+$10]
vmovd xmm1, ecx
vpsrad xmm0, xmm0, xmm1
vmovdqa xword[rsp+$10], xmm0
pop1set TAG_INT2
end_inst
end if ; </fold>
if(used inst$s2ssal) ; <fold >
inst s2ssal
overify TAG_SHORT2, TAG_INT
mov ecx, [rsp]
and ecx, $1f
vpmovsxwd xmm0, [rsp+$10]
vmovd xmm1, ecx
vpslld xmm0, xmm0, xmm1
vmovdqa xword[rsp+$10], xmm0
pop1set TAG_INT2
end_inst
end if ; </fold>
if(used inst$s2sshr) ; <fold >
inst s2sshr
overify TAG_SHORT2, TAG_INT
mov ecx, [rsp]
and ecx, $1f
vpmovsxwd xmm0, [rsp+$10]
vmovd xmm1, ecx
vpsrld xmm0, xmm0, xmm1
vmovdqa xword[rsp+$10], xmm0
pop1set TAG_INT2
end_inst
end if ; </fold>
; </fold>
; <fold vector>
if(used inst$s2vpack) ; <fold >
inst s2vpack
overify TAG_SHORT2
vmovdqa xmm0, [rsp]
vpxor xmm1, xmm0, xmm0
vpackuswb xmm0, xmm0, xmm1
vmovdqa xword[rsp], xmm0
set TAG_BYTE2
end_inst
end if ; </fold>
if(used inst$s2vunpckl) ; <fold >
inst s2vunpckl
overify TAG_SHORT2
vmovdqa xmm0, [rsp]
vpxor xmm1, xmm0, xmm0
vpunpcklwd xmm0, xmm0, xmm1
vmovdqa xword[rsp], xmm0
set TAG_INT2
end_inst
end if ; </fold>
if(used inst$s2vunpcku) ; <fold >
inst s2vunpcku
overify TAG_SHORT2
vmovdqa xmm0, [rsp]
vpxor xmm1, xmm0, xmm0
vpunpcklwd xmm0, xmm1, xmm0
vmovdqa xword[rsp], xmm0
set TAG_INT2
end_inst
end if ; </fold>
if(used inst$s2vneg) ; <fold >
inst s2vneg
overify TAG_SHORT2
vpxor xmm0, xmm0, xmm0
vpsubw xmm0, xmm0, [rsp]
vmovdqa xword[rsp], xmm0
end_inst
end if ; </fold>
if(used inst$s2vmul) ; <fold >
inst s2vmul
overify TAG_SHORT2, TAG_SHORT2
vmovdqa xmm0, [rsp+$10]
vpmullw xmm0, xmm0, [rsp]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$s2vadd) ; <fold >
inst s2vadd
overify TAG_SHORT2, TAG_SHORT2
vmovdqa xmm0, [rsp+$10]
vpaddw xmm0, xmm0, [rsp]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$s2vsub) ; <fold >
inst s2vsub
overify TAG_SHORT2, TAG_SHORT2
vmovdqa xmm0, [rsp+$10]
vpsubw xmm0, xmm0, [rsp]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$s2vsar) ; <fold >
inst s2vsar
overify TAG_SHORT2, TAG_INT
mov ecx, [rsp]
and ecx, $1f
vmovdqa xmm0, [rsp+$10]
vmovd xmm1, ecx
vpsraw xmm0, xmm0, xmm1
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$s2vsal) ; <fold >
inst s2vsal
overify TAG_SHORT2, TAG_INT
mov ecx, [rsp]
and ecx, $1f
vmovdqa xmm0, [rsp+$10]
vmovd xmm1, ecx
vpsllw xmm0, xmm0, xmm1
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$s2vshr) ; <fold >
inst s2vshr
overify TAG_SHORT2, TAG_INT
mov ecx, [rsp]
and ecx, $1f
vmovdqa xmm0, [rsp+$10]
vmovd xmm1, ecx
vpsrlw xmm0, xmm0, xmm1
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$s2vg) ; <fold >
inst s2vg
overify TAG_SHORT2, TAG_SHORT2
vmovdqa xmm0, [rsp+$10]
vpcmpgtw xmm0, xmm0, [rsp]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$s2vge) ; <fold >
inst s2vge
overify TAG_SHORT2, TAG_SHORT2
vmovdqa xmm0, [rsp]
vpcmpgtw xmm0, xmm0, [rsp+$10]
vpxor xmm0, xmm0, [s8.03]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$s2vl) ; <fold >
inst s2vl
overify TAG_SHORT2, TAG_SHORT2
vmovdqa xmm0, [rsp]
vpcmpgtw xmm0, xmm0, [rsp+$10]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$s2vle) ; <fold >
inst s2vle
overify TAG_SHORT2, TAG_SHORT2
vmovdqa xmm0, [rsp+$10]
vpcmpgtw xmm0, xmm0, [rsp]
vpxor xmm0, xmm0, [s8.03]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$s2ve) ; <fold >
inst s2ve
overify TAG_SHORT2, TAG_SHORT2
vmovdqa xmm0, [rsp+$10]
vpcmpeqw xmm0, xmm0, [rsp]
vpand xmm0, xmm0, [s8.03]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$s2vne) ; <fold >
inst s2vne
overify TAG_SHORT2, TAG_SHORT2
vmovdqa xmm0, [rsp+$10]
vpcmpeqw xmm0, xmm0, [rsp]
vpxor xmm0, xmm0, [s8.01]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$s2vmuls) ; <fold >
inst s2vmuls
overify TAG_SHORT2, TAG_SHORT2
vpmovsxwd xmm0, [rsp+$10]
vpmovsxwd xmm1, [rsp+$00]
vpmulld xmm0, xmm0, xmm1
vpaddd xmm0, xmm0, [i8.05]
vpsrad xmm0, xmm0, $0f
vpackssdw xmm0, xmm0, xmm0
vpand xmm0, xmm0, [s8.03]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$s2vadds) ; <fold >
inst s2vadds
overify TAG_SHORT2, TAG_SHORT2
vmovdqa xmm0, [rsp+$10]
vpaddsw xmm0, xmm0, [rsp]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$s2vsubs) ; <fold >
inst s2vsubs
overify TAG_SHORT2, TAG_SHORT2
vmovdqa xmm0, [rsp+$10]
vpsubsw xmm0, xmm0, [rsp]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$s2vmulu) ; <fold >
inst s2vmulu
overify TAG_SHORT2, TAG_SHORT2
vpmovzxwd xmm0, [rsp+$10]
vpmovzxwd xmm1, [rsp+$00]
vpmulld xmm0, xmm0, xmm1
vpaddd xmm0, xmm0, [i8.02]
vpsrld xmm0, xmm0, $10
vpackusdw xmm0, xmm0, xmm0
vpand xmm0, xmm0, [s8.03]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$s2vaddu) ; <fold >
inst s2vaddu
overify TAG_SHORT2, TAG_SHORT2
vmovdqa xmm0, [rsp+$10]
vpaddusw xmm0, xmm0, [rsp]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
if(used inst$s2vsubu) ; <fold >
inst s2vsubu
overify TAG_SHORT2, TAG_SHORT2
vmovdqa xmm0, [rsp+$10]
vpsubusw xmm0, xmm0, [rsp]
vmovdqa xword[rsp+$10], xmm0
pop1set
end_inst
end if ; </fold>
; </fold>