;
; Реализация среды исполнения языка программирования
; Объектно-ориентированный продвинутый векторный транслятор
;
; Copyright © 2021, 2024 Малик Разработчик
;
; Это свободная программа: вы можете перераспространять ее и/или изменять
; ее на условиях Меньшей Стандартной общественной лицензии GNU в том виде,
; в каком она была опубликована Фондом свободного программного обеспечения;
; либо версии 3 лицензии, либо (по вашему выбору) любой более поздней версии.
;
; Эта программа распространяется в надежде, что она будет полезной,
; но БЕЗО ВСЯКИХ ГАРАНТИЙ; даже без неявной гарантии ТОВАРНОГО ВИДА
; или ПРИГОДНОСТИ ДЛЯ ОПРЕДЕЛЕННЫХ ЦЕЛЕЙ. Подробнее см. в Меньшей Стандартной
; общественной лицензии GNU.
;
; Вы должны были получить копию Меньшей Стандартной общественной лицензии GNU
; вместе с этой программой. Если это не так, см.
; <https://www.gnu.org/licenses/>.
;
; <fold константы инструкций высокого уровня>
if(used inst$smuld2 | used inst$sdivd2 | used inst$sdivud2) ; <fold smuld2>
cons smuld2, $10
.c0: dq $3ff0000000000000, $bff0000000000000
end if ; </fold>
if(used inst$smuld4 | used inst$sdivd4 | used inst$sdivud4) ; <fold smuld4>
cons smuld4, $20
.q0: dq $3ff0000000000000, $bff0000000000000, $bff0000000000000, $bff0000000000000
.q1: dq $3ff0000000000000, $3ff0000000000000, $3ff0000000000000, $bff0000000000000
.q2: dq $3ff0000000000000, $bff0000000000000, $3ff0000000000000, $3ff0000000000000
.q3: dq $3ff0000000000000, $3ff0000000000000, $bff0000000000000, $3ff0000000000000
end if ; </fold>
if(used inst$smuld8 | used inst$sdivd8 | used inst$sdivud8) ; <fold smuld8>
cons smuld8, $40
.o0: dq $3ff0000000000000, $bff0000000000000, $bff0000000000000, $bff0000000000000, $bff0000000000000, $bff0000000000000, $bff0000000000000, $bff0000000000000
.o1: dq $3ff0000000000000, $3ff0000000000000, $3ff0000000000000, $bff0000000000000, $3ff0000000000000, $bff0000000000000, $bff0000000000000, $3ff0000000000000
.o2: dq $3ff0000000000000, $bff0000000000000, $3ff0000000000000, $3ff0000000000000, $3ff0000000000000, $3ff0000000000000, $bff0000000000000, $bff0000000000000
.o3: dq $3ff0000000000000, $3ff0000000000000, $bff0000000000000, $3ff0000000000000, $3ff0000000000000, $bff0000000000000, $3ff0000000000000, $bff0000000000000
.o4: dq $3ff0000000000000, $bff0000000000000, $bff0000000000000, $bff0000000000000, $3ff0000000000000, $3ff0000000000000, $3ff0000000000000, $3ff0000000000000
.o5: dq $3ff0000000000000, $3ff0000000000000, $bff0000000000000, $3ff0000000000000, $bff0000000000000, $3ff0000000000000, $bff0000000000000, $3ff0000000000000
.o6: dq $3ff0000000000000, $3ff0000000000000, $3ff0000000000000, $bff0000000000000, $bff0000000000000, $3ff0000000000000, $3ff0000000000000, $bff0000000000000
.o7: dq $3ff0000000000000, $bff0000000000000, $3ff0000000000000, $3ff0000000000000, $bff0000000000000, $bff0000000000000, $3ff0000000000000, $3ff0000000000000
end if ; </fold>
if(used inst$smulf2 | used inst$sdivf2 | used inst$sdivuf2) ; <fold smulf2>
cons smulf2, $10
.c0: dd $3f800000, $bf800000, $00000000, $00000000
end if ; </fold>
if(used inst$smulf4 | used inst$sdivf4 | used inst$sdivuf4) ; <fold smulf4>
cons smulf4, $10
.q0: dd $3f800000, $bf800000, $bf800000, $bf800000
.q1: dd $3f800000, $3f800000, $3f800000, $bf800000
.q2: dd $3f800000, $bf800000, $3f800000, $3f800000
.q3: dd $3f800000, $3f800000, $bf800000, $3f800000
end if ; </fold>
if(used inst$smulf8 | used inst$sdivf8 | used inst$sdivuf8) ; <fold smulf8>
cons smulf8, $20
.o0: dd $3f800000, $bf800000, $bf800000, $bf800000, $bf800000, $bf800000, $bf800000, $bf800000
.o1: dd $3f800000, $3f800000, $3f800000, $bf800000, $3f800000, $bf800000, $bf800000, $3f800000
.o2: dd $3f800000, $bf800000, $3f800000, $3f800000, $3f800000, $3f800000, $bf800000, $bf800000
.o3: dd $3f800000, $3f800000, $bf800000, $3f800000, $3f800000, $bf800000, $3f800000, $bf800000
.o4: dd $3f800000, $bf800000, $bf800000, $bf800000, $3f800000, $3f800000, $3f800000, $3f800000
.o5: dd $3f800000, $3f800000, $bf800000, $3f800000, $bf800000, $3f800000, $bf800000, $3f800000
.o6: dd $3f800000, $3f800000, $3f800000, $bf800000, $bf800000, $3f800000, $3f800000, $bf800000
.o7: dd $3f800000, $bf800000, $3f800000, $3f800000, $bf800000, $bf800000, $3f800000, $3f800000
end if ; </fold>
if(used inst$smuli2) ; <fold smuli2>
cons smuli2, $10
.c0: dd $00000001, $ffffffff, $00000000, $00000000
end if ; </fold>
if(used inst$smuli4) ; <fold smuli4>
cons smuli4, $10
.q0: dd $00000001, $ffffffff, $ffffffff, $ffffffff
.q1: dd $00000001, $00000001, $00000001, $ffffffff
.q2: dd $00000001, $ffffffff, $00000001, $00000001
.q3: dd $00000001, $00000001, $ffffffff, $00000001
end if ; </fold>
if(used inst$smuli8) ; <fold smuli8>
cons smuli8, $20
.o0: dd $00000001, $ffffffff, $ffffffff, $ffffffff, $ffffffff, $ffffffff, $ffffffff, $ffffffff
.o1: dd $00000001, $00000001, $00000001, $ffffffff, $00000001, $ffffffff, $ffffffff, $00000001
.o2: dd $00000001, $ffffffff, $00000001, $00000001, $00000001, $00000001, $ffffffff, $ffffffff
.o3: dd $00000001, $00000001, $ffffffff, $00000001, $00000001, $ffffffff, $00000001, $ffffffff
.o4: dd $00000001, $ffffffff, $ffffffff, $ffffffff, $00000001, $00000001, $00000001, $00000001
.o5: dd $00000001, $00000001, $ffffffff, $00000001, $ffffffff, $00000001, $ffffffff, $00000001
.o6: dd $00000001, $00000001, $00000001, $ffffffff, $ffffffff, $00000001, $00000001, $ffffffff
.o7: dd $00000001, $ffffffff, $00000001, $00000001, $ffffffff, $ffffffff, $00000001, $00000001
end if ; </fold>
if(used inst$smull2) ; <fold smull2>
cons smull2, $10
.c0: dq $0000000000000001, $ffffffffffffffff
end if ; </fold>
if(used inst$smull4) ; <fold smull4>
cons smull4, $20
.q0: dq $0000000000000001, $ffffffffffffffff, $ffffffffffffffff, $ffffffffffffffff
.q1: dq $0000000000000001, $0000000000000001, $0000000000000001, $ffffffffffffffff
.q2: dq $0000000000000001, $ffffffffffffffff, $0000000000000001, $0000000000000001
.q3: dq $0000000000000001, $0000000000000001, $ffffffffffffffff, $0000000000000001
end if ; </fold>
if(used inst$smull8) ; <fold smull8>
cons smull8, $40
.o0: dq $0000000000000001, $ffffffffffffffff, $ffffffffffffffff, $ffffffffffffffff, $ffffffffffffffff, $ffffffffffffffff, $ffffffffffffffff, $ffffffffffffffff
.o1: dq $0000000000000001, $0000000000000001, $0000000000000001, $ffffffffffffffff, $0000000000000001, $ffffffffffffffff, $ffffffffffffffff, $0000000000000001
.o2: dq $0000000000000001, $ffffffffffffffff, $0000000000000001, $0000000000000001, $0000000000000001, $0000000000000001, $ffffffffffffffff, $ffffffffffffffff
.o3: dq $0000000000000001, $0000000000000001, $ffffffffffffffff, $0000000000000001, $0000000000000001, $ffffffffffffffff, $0000000000000001, $ffffffffffffffff
.o4: dq $0000000000000001, $ffffffffffffffff, $ffffffffffffffff, $ffffffffffffffff, $0000000000000001, $0000000000000001, $0000000000000001, $0000000000000001
.o5: dq $0000000000000001, $0000000000000001, $ffffffffffffffff, $0000000000000001, $ffffffffffffffff, $0000000000000001, $ffffffffffffffff, $0000000000000001
.o6: dq $0000000000000001, $0000000000000001, $0000000000000001, $ffffffffffffffff, $ffffffffffffffff, $0000000000000001, $0000000000000001, $ffffffffffffffff
.o7: dq $0000000000000001, $ffffffffffffffff, $0000000000000001, $0000000000000001, $ffffffffffffffff, $ffffffffffffffff, $0000000000000001, $0000000000000001
end if ; </fold>
if(used cons$zero) ; <fold zero>
label cons$zero at cons$long8.1+$20
end if ; </fold>
; <fold double8>
cons double8, $40
.1: dq $3ff0000000000000, $0000000000000000, $0000000000000000, $0000000000000000, $0000000000000000, $0000000000000000, $0000000000000000, $0000000000000000
.imax: dq $41e0000000000000, $41e0000000000000, $41e0000000000000, $41e0000000000000, $41e0000000000000, $41e0000000000000, $41e0000000000000, $41e0000000000000
.lmax: dq $43e0000000000000, $43e0000000000000, $43e0000000000000, $43e0000000000000, $43e0000000000000, $43e0000000000000, $43e0000000000000, $43e0000000000000
; </fold>
; <fold float8>
cons float8, $20
.1: dd $3f800000, $00000000, $00000000, $00000000, $00000000, $00000000, $00000000, $00000000
.imax: dd $4f000000, $4f000000, $4f000000, $4f000000, $4f000000, $4f000000, $4f000000, $4f000000
; </fold>
; <fold byte8>
cons byte8, $10
.1: db $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
.m1: db $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff
.mask8: db $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff, $00, $00, $00, $00, $00, $00, $00, $00
.mask4: db $ff, $ff, $ff, $ff, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
.mask2: db $ff, $ff, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
; </fold>
; <fold short2>
cons short2, $10
.$007f: dw $007f, $007f, $0000, $0000, $0000, $0000, $0000, $0000
.$00ff: dw $00ff, $00ff, $0000, $0000, $0000, $0000, $0000, $0000
; </fold>
; <fold short4>
cons short4, $10
.$007f: dw $007f, $007f, $007f, $007f, $0000, $0000, $0000, $0000
.$00ff: dw $00ff, $00ff, $00ff, $00ff, $0000, $0000, $0000, $0000
; </fold>
; <fold short8>
cons short8, $10
.1: dw $0001, $0000, $0000, $0000, $0000, $0000, $0000, $0000
.m1: dw $ffff, $ffff, $ffff, $ffff, $ffff, $ffff, $ffff, $ffff
.mask4: dw $ffff, $ffff, $ffff, $ffff, $0000, $0000, $0000, $0000
.mask2: dw $ffff, $ffff, $0000, $0000, $0000, $0000, $0000, $0000
.$007f: dw $007f, $007f, $007f, $007f, $007f, $007f, $007f, $007f
.$00ff: dw $00ff, $00ff, $00ff, $00ff, $00ff, $00ff, $00ff, $00ff
label .mask8 at .m1
; </fold>
; <fold int>
cons int, $10
.max: dd $7fffffff
; </fold>
; <fold int2>
cons int2, $10
.$7fff: dd $00007fff, $00007fff, $00000000, $00000000
.$ffff: dd $0000ffff, $0000ffff, $00000000, $00000000
; </fold>
; <fold int4>
cons int4, $10
.m1_0: dd $ffffffff, $00000000, $00000000, $00000000
.newvi: dd $00000008, $00000004, $00000000, $00000001
.newvl: dd $00000004, $00000002, $00000000, $00000001
label .$7fff at cons$int8.$7fff
label .$ffff at cons$int8.$ffff
label .newvf at .newvi
label .newvd at .newvl
; </fold>
; <fold int8>
cons int8, $20
.1: dd $00000001, $00000000, $00000000, $00000000, $00000000, $00000000, $00000000, $00000000
.m1: dd $ffffffff, $ffffffff, $ffffffff, $ffffffff, $ffffffff, $ffffffff, $ffffffff, $ffffffff
.m1_0: dd $ffffffff, $ffffffff, $00000000, $00000000, $ffffffff, $ffffffff, $00000000, $00000000
.maskw: dd $0000ffff, $0000ffff, $0000ffff, $0000ffff, $0000ffff, $0000ffff, $0000ffff, $0000ffff
.maskb: dd $000000ff, $000000ff, $000000ff, $000000ff, $000000ff, $000000ff, $000000ff, $000000ff
.newvi: dd $00000018, $00000014, $00000010, $0000000c, $00000008, $00000004, $00000000, $00000001
.newvl: dd $0000000c, $0000000a, $00000008, $00000006, $00000004, $00000002, $00000000, $00000001
.$7fff: dd $00007fff, $00007fff, $00007fff, $00007fff, $00007fff, $00007fff, $00007fff, $00007fff
.$ffff: dd $0000ffff, $0000ffff, $0000ffff, $0000ffff, $0000ffff, $0000ffff, $0000ffff, $0000ffff
label .mask2 at .m1_0
label .mask4 at .m1
label .mask8 at .m1
label .newvf at .newvi
label .newvd at .newvl
; </fold>
; <fold long>
cons long, $10
.m1: dq $ffffffffffffffff
.max: dq $7fffffffffffffff
.min: dq $8000000000000000
; </fold>
; <fold long2>
cons long2, $10
.m1_0: dq $ffffffffffffffff, $0000000000000000
; </fold>
; <fold long8>
cons long8, $40
.1: dq $0000000000000001, $0000000000000000, $0000000000000000, $0000000000000000, $0000000000000000, $0000000000000000, $0000000000000000, $0000000000000000
.m1: dq $ffffffffffffffff, $ffffffffffffffff, $ffffffffffffffff, $ffffffffffffffff, $ffffffffffffffff, $ffffffffffffffff, $ffffffffffffffff, $ffffffffffffffff
.maskd: dq $00000000ffffffff, $00000000ffffffff, $00000000ffffffff, $00000000ffffffff, $00000000ffffffff, $00000000ffffffff, $00000000ffffffff, $00000000ffffffff
.maskw: dq $000000000000ffff, $000000000000ffff, $000000000000ffff, $000000000000ffff, $000000000000ffff, $000000000000ffff, $000000000000ffff, $000000000000ffff
.maskb: dq $00000000000000ff, $00000000000000ff, $00000000000000ff, $00000000000000ff, $00000000000000ff, $00000000000000ff, $00000000000000ff, $00000000000000ff
label .mask2 at .m1
label .mask4 at .m1
; </fold>
; </fold>