Nasm-X86 v20210629 Perl 5 v5.30.3 amd64-freebsd
- Status
- Unknown
- From
- Slaven Rezić
- Dist
-
Nasm-X86 v20210629
- Platform
- Perl 5 v5.30.3 amd64-freebsd
- Date
- 2021-06-30 05:09:33
- ID
- 5b91bf9e-d961-11eb-99fe-df381f24ea8f
This distribution has been tested as part of the CPAN Testers
project, supporting the Perl programming language. See
http://wiki.cpantesters.org/ for more information or email
questions to cpan-testers-discuss@perl.org
--
Dear Philip R Brenan,
This is a computer-generated report for Nasm-X86-20210629
on perl 5.30.3, created by CPAN-Reporter-1.2018.
Thank you for uploading your work to CPAN. However, attempting to
test your distribution gave an inconclusive result.
This could be because your distribution had an error during the make/build
stage, did not define tests, tests could not be found, because your tests were
interrupted before they finished, or because the results of the tests could not
be parsed. You may wish to consult the CPAN Testers Wiki:
http://wiki.cpantesters.org/wiki/CPANAuthorNotes
Sections of this report:
* Tester comments
* Program output
* Prerequisites
* Environment and other context
------------------------------
TESTER COMMENTS
------------------------------
Additional comments from tester:
none provided
------------------------------
PROGRAM OUTPUT
------------------------------
Output from './Build test':
Unable to confirm presence of command: nasm
at /usr/perl5.30.3p/lib/site_perl/5.30.3/Data/Table/Text.pm line 4684, <DATA> line 2744.
Data::Table::Text::confirmHasCommandLineCommand("nasm") called at (eval 439) line 12
eval 'use Time::HiRes qw(time);
use Test::Most;
bail_on_fail;
my $develop = -e q(/home/phil/); # Developing
my $localTest = ((caller(1))[0]//\'Nasm::X86\') eq "Nasm::X86"; # Local testing mode
Test::More->builder->output("/dev/null") if $localTest; # Reduce number of confirmation messages during testing
if ($^O =~ m(bsd|linux|cygwin)i) # Supported systems
{if (confirmHasCommandLineCommand(q(nasm)) and LocateIntelEmulator) # Network assembler and Intel Software Development emulator
{plan tests => 109;
}
else
{plan skip_all => qq(Nasm or Intel 64 emulator not available);
}
}
else
{plan skip_all => qq(Not supported on: $^O);
}
my $start = time; # Tests
eval {goto latest} if !caller(0) and -e "/home/phil"; # Go to latest test if specified
if (1) { #TPrintOutStringNL #TPrintErrStringNL #TAssemble
PrintOutStringNL "Hello World";
PrintOutStringNL "Hello\\nWorld";
PrintErrStringNL "Hello World";
ok Assemble(debug => 0, eq => <<END);
Hello World
Hello
World
END
}
if (1) { #TMov #TComment #TRs #TPrintOutMemory
Comment "Print a string from memory";
my $s = "Hello World";
Mov rax, Rs($s);
Mov rdi, length $s;
PrintOutMemory;
ok Assemble =~ m(Hello World);
}
if (1) { #TPrintOutRaxInHex #TPrintOutNL
my $q = Rs(\'abababab\');
Mov(rax, "[$q]");
PrintOutString "rax: ";
PrintOutRaxInHex;
PrintOutNL;
Xor rax, rax;
PrintOutString "rax: ";
PrintOutRaxInHex;
PrintOutNL;
ok Assemble =~ m(rax: 6261 6261 6261 6261.*rax: 0000 0000 0000 0000)s;
}
if (1) { #TPrintOutRegistersInHex #TRs
my $q = Rs(\'abababab\');
Mov(rax, 1);
Mov(rbx, 2);
Mov(rcx, 3);
Mov(rdx, 4);
Mov(r8, 5);
Lea r9, "[rax+rbx]";
PrintOutRegistersInHex;
my $r = Assemble;
ok $r =~ m( r8: 0000 0000 0000 0005.* r9: 0000 0000 0000 0003.*rax: 0000 0000 0000 0001)s;
ok $r =~ m(rbx: 0000 0000 0000 0002.*rcx: 0000 0000 0000 0003.*rdx: 0000 0000 0000 0004)s;
}
if (1) { #TDs
my $q = Rs(\'a\'..\'z\');
Mov rax, Ds(\'0\'x64); # Output area
Vmovdqu32(xmm0, "[$q]"); # Load
Vprolq (xmm0, xmm0, 32); # Rotate double words in quad words
Vmovdqu32("[rax]", xmm0); # Save
Mov rdi, 16;
PrintOutMemory;
ok Assemble =~ m(efghabcdmnopijkl)s;
}
if (1) {
my $q = Rs((\'a\'..\'p\')x2);
Mov rax, Ds(\'0\'x64);
Vmovdqu32(ymm0, "[$q]");
Vprolq (ymm0, ymm0, 32);
Vmovdqu32("[rax]", ymm0);
Mov rdi, 32;
PrintOutMemory;
ok Assemble =~ m(efghabcdmnopijklefghabcdmnopijkl)s;
}
if (1) {
my $q = Rs my $s = join \'\', (\'a\'..\'p\')x4; # Sample string
Mov rax, Ds(\'0\'x128);
Vmovdqu64 zmm0, "[$q]"; # Load zmm0 with sample string
Vprolq zmm1, zmm0, 32; # Rotate left 32 bits in lanes
Vmovdqu64 "[rax]", zmm1; # Save results
Mov rdi, length $s; # Print results
PrintOutMemoryNL;
is_deeply "$s\\n", <<END; # Initial string
abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop
END
is_deeply Assemble, <<END; # Assemble and run
efghabcdmnopijklefghabcdmnopijklefghabcdmnopijklefghabcdmnopijkl
END
}
if (1) { #TPrintOutRegisterInHex
my $q = Rs((\'a\'..\'p\')x4);
Mov r8,"[$q]";
PrintOutRegisterInHex r8;
ok Assemble =~ m(r8: 6867 6665 6463 6261)s;
}
if (1) {
my $q = Rs(\'a\'..\'p\');
Vmovdqu8 xmm0, "[$q]";
PrintOutRegisterInHex xmm0;
ok Assemble =~ m(xmm0: 706F 6E6D 6C6B 6A69 6867 6665 6463 6261)s;
}
if (1) {
my $q = Rs(\'a\'..\'p\', \'A\'..\'P\', );
Vmovdqu8 ymm0, "[$q]";
PrintOutRegisterInHex ymm0;
ok Assemble =~ m(ymm0: 504F 4E4D 4C4B 4A49 4847 4645 4443 4241 706F 6E6D 6C6B 6A69 6867 6665 6463 6261)s;
}
if (1) {
my $q = Rs((\'a\'..\'p\', \'A\'..\'P\') x 2);
Vmovdqu8 zmm0, "[$q]";
PrintOutRegisterInHex zmm0;
ok Assemble =~ m(zmm0: 504F 4E4D 4C4B 4A49 4847 4645 4443 4241 706F 6E6D 6C6B 6A69 6867 6665 6463 6261 504F 4E4D 4C4B 4A49 4847 4645 4443 4241 706F 6E6D 6C6B 6A69 6867 6665 6463 6261)s;
}
if (1) { #TAllocateMemory #TNasm::X86::Variable::freeMemory
my $N = Vq(size, 2048);
my $q = Rs(\'a\'..\'p\');
AllocateMemory($N, my $address = Vq(address));
Vmovdqu8 xmm0, "[$q]";
$address->setReg(rax);
Vmovdqu8 "[rax]", xmm0;
Mov rdi, 16;
PrintOutMemory;
PrintOutNL;
FreeMemory(address => $address, size=> $N);
ok Assemble(eq => <<END);
abcdefghijklmnop
END
}
if (1) { #TReadTimeStampCounter
for(1..10)
{ReadTimeStampCounter;
PrintOutRegisterInHex rax;
}
my @s = split /\\n/, Assemble;
my @S = sort @s;
is_deeply \\@s, \\@S;
}
if (1) { #TIf
Mov rax, 0;
Test rax,rax;
IfNz
{PrintOutRegisterInHex rax;
} sub
{PrintOutRegisterInHex rbx;
};
KeepFree rax;
Mov rax, 1;
Test rax,rax;
IfNz
{PrintOutRegisterInHex rcx;
} sub
{PrintOutRegisterInHex rdx;
};
ok Assemble =~ m(rbx.*rcx)s;
}
if (1) { #TFork #TGetPid #TGetPPid #TWaitPid
Fork; # Fork
Test rax,rax;
IfNz # Parent
{Mov rbx, rax;
WaitPid;
PrintOutRegisterInHex rax;
PrintOutRegisterInHex rbx;
KeepFree rax;
GetPid; # Pid of parent as seen in parent
Mov rcx,rax;
PrintOutRegisterInHex rcx;
}
sub # Child
{Mov r8,rax;
PrintOutRegisterInHex r8;
KeepFree rax;
GetPid; # Child pid as seen in child
Mov r9,rax;
PrintOutRegisterInHex r9;
KeepFree rax;
GetPPid; # Parent pid as seen in child
Mov r10,rax;
PrintOutRegisterInHex r10;
};
my $r = Assemble;
# r8: 0000 0000 0000 0000 #1 Return from fork as seen by child
# r9: 0000 0000 0003 0C63 #2 Pid of child
# r10: 0000 0000 0003 0C60 #3 Pid of parent from child
# rax: 0000 0000 0003 0C63 #4 Return from fork as seen by parent
# rbx: 0000 0000 0003 0C63 #5 Wait for child pid result
# rcx: 0000 0000 0003 0C60 #6 Pid of parent
if ($r =~ m(r8:( 0000){4}.*r9:(.*)\\s{5,}r10:(.*)\\s{5,}rax:(.*)\\s{5,}rbx:(.*)\\s{5,}rcx:(.*)\\s{2,})s)
{ok $2 eq $4;
ok $2 eq $5;
ok $3 eq $6;
ok $2 gt $6;
}
}
if (1) { #TGetUid
GetUid; # Userid
PrintOutRegisterInHex rax;
my $r = Assemble;
ok $r =~ m(rax:( 0000){3});
}
if (1) { #TStatSize
Mov rax, Rs($0); # File to stat
StatSize; # Stat the file
PrintOutRegisterInHex rax;
my $r = Assemble =~ s( ) ()gsr;
if ($r =~ m(rax:([0-9a-f]{16}))is) # Compare file size obtained with that from fileSize()
{is_deeply $1, sprintf("%016X", fileSize($0));
}
}
if (1) { #TOpenRead #TCloseFile #TOpenWrite
Mov rax, Rs($0); # File to read
OpenRead; # Open file
PrintOutRegisterInHex rax;
CloseFile; # Close file
PrintOutRegisterInHex rax;
KeepFree rax, rdi;
Mov rax, Rs(my $f = "zzzTemporaryFile.txt"); # File to write
OpenWrite; # Open file
CloseFile; # Close file
is_deeply Assemble, <<END; # Channel is now used for tracing
rax: 0000 0000 0000 0004
rax: 0000 0000 0000 0000
END
ok -e $f; # Created file
unlink $f;
}
if (1) { #TFor
For
{PrintOutRegisterInHex rax
} rax, 16, 1;
my $r = Assemble;
ok $r =~ m(( 0000){3} 0000)i;
ok $r =~ m(( 0000){3} 000F)i;
}
if (1) { #TPrintOutRaxInReverseInHex #TPrintOutMemoryInHex
Mov rax, 0x07654321;
Shl rax, 32;
Or rax, 0x07654321;
PushR rax;
PrintOutRaxInHex;
PrintOutNL;
PrintOutRaxInReverseInHex;
PrintOutNL;
KeepFree rax;
Mov rax, rsp;
Mov rdi, 8;
PrintOutMemoryInHex;
PrintOutNL;
PopR rax;
KeepFree rax, rdi;
Mov rax, 4096;
PushR rax;
Mov rax, rsp;
Mov rdi, 8;
PrintOutMemoryInHex;
PrintOutNL;
PopR rax;
is_deeply Assemble, <<END;
0765 4321 0765 4321
2143 6507 2143 6507
2143 6507 2143 6507
0010 0000 0000 0000
END
}
if (1) { #TPushR #TPopR
Mov rax, 0x11111111;
Mov rbx, 0x22222222;
PushR my @save = (rax, rbx);
Mov rax, 0x33333333;
PopR @save;
PrintOutRegisterInHex rax;
PrintOutRegisterInHex rbx;
is_deeply Assemble,<<END;
rax: 0000 0000 1111 1111
rbx: 0000 0000 2222 2222
END
}
if (1) { #TAllocateMemory #TFreeMemory #TClearMemory
my $N = Vq(size, 4096); # Size of the initial allocation which should be one or more pages
AllocateMemory($N, my $A = Vq(address));
ClearMemory($N, $A);
$A->setReg(rax);
$N->setReg(rdi);
PrintOutMemoryInHexNL;
FreeMemory($N, $A);
ok Assemble(eq => <<END);
0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
END
}
if (1) { #TCall #TS
Mov rax, 0x44332211;
PrintOutRegisterInHex rax;
my $s = Macro
{PrintOutRegisterInHex rax;
Inc rax;
PrintOutRegisterInHex rax;
};
Call $s;
PrintOutRegisterInHex rax;
my $r = Assemble;
ok $r =~ m(0000 0000 4433 2211.*2211.*2212.*0000 0000 4433 2212)s;
}
if (1) { #TReadFile #TPrintMemory
ReadFile(Vq(file, Rs($0)), (my $s = Vq(size)), my $a = Vq(address)); # Read file
$a->setReg(rax); # Address of file in memory
$s->setReg(rdi); # Length of file in memory
PrintOutMemory; # Print contents of memory to stdout
my $r = Assemble; # Assemble and execute
ok stringMd5Sum($r) eq fileMd5Sum($0); # Output contains this file
}
#latest:;
if (1) { #TCreateByteString #TByteString::clear #TByteString::out #TByteString::copy #TByteString::nl
my $a = CreateByteString; # Create a string
$a->q(\'aa\');
$a->out;
PrintOutNL;
is_deeply Assemble, <<END; # Assemble and execute
aa
END
}
if (1) { #TCreateByteString #TByteString::clear #TByteString::out #TByteString::copy #TByteString::nl
my $a = CreateByteString; # Create a string
my $b = CreateByteString; # Create a string
$a->q(\'aa\');
$b->q(\'bb\');
$a->out;
PrintOutNL;
$b->out;
PrintOutNL;
is_deeply Assemble, <<END; # Assemble and execute
aa
bb
END
}
if (1) { #TCreateByteString #TByteString::clear #TByteString::out #TByteString::copy #TByteString::nl
my $a = CreateByteString; # Create a string
my $b = CreateByteString; # Create a string
$a->q(\'aa\');
$a->q(\'AA\');
$a->out;
PrintOutNL;
is_deeply Assemble, <<END; # Assemble and execute
aaAA
END
}
if (1) { #TCreateByteString #TByteString::clear #TByteString::out #TByteString::copy #TByteString::nl
my $a = CreateByteString; # Create a string
my $b = CreateByteString; # Create a string
$a->q(\'aa\');
$b->q(\'bb\');
$a->q(\'AA\');
$b->q(\'BB\');
$a->q(\'aa\');
$b->q(\'bb\');
$a->out;
$b->out;
PrintOutNL;
is_deeply Assemble, <<END; # Assemble and execute
aaAAaabbBBbb
END
}
if (1) { #TCreateByteString #TByteString::clear #TByteString::out #TByteString::copy #TByteString::nl
my $a = CreateByteString; # Create a string
$a->q(\'ab\');
my $b = CreateByteString; # Create target byte string
$b->append(source=>$a->bs);
$b->append(source=>$a->bs);
$a->append(source=>$b->bs);
$b->append(source=>$a->bs);
$a->append(source=>$b->bs);
$b->append(source=>$a->bs);
$b->append(source=>$a->bs);
$b->append(source=>$a->bs);
$b->append(source=>$a->bs);
$a->out; PrintOutNL; # Print byte string
$b->out; PrintOutNL; # Print byte string
$a->length(my $sa = Vq(size)); $sa->outNL;
$b->length(my $sb = Vq(size)); $sb->outNL;
$a->clear;
$a->length(my $sA = Vq(size)); $sA->outNL;
$b->length(my $sB = Vq(size)); $sB->outNL;
is_deeply Assemble, <<END; # Assemble and execute
abababababababab
ababababababababababababababababababababababababababababababababababababab
size: 0000 0000 0000 0010
size: 0000 0000 0000 004A
size: 0000 0000 0000 0000
size: 0000 0000 0000 004A
END
}
if (1) { #TReorderSyscallRegisters #TUnReorderSyscallRegisters
Mov rax, 1; Mov rdi, 2; Mov rsi, 3; Mov rdx, 4;
Mov r8, 8; Mov r9, 9; Mov r10, 10; Mov r11, 11;
ReorderSyscallRegisters r8,r9; # Reorder the registers for syscall
PrintOutRegisterInHex rax;
PrintOutRegisterInHex rdi;
UnReorderSyscallRegisters r8,r9; # Unreorder the registers to recover their original values
PrintOutRegisterInHex rax;
PrintOutRegisterInHex rdi;
ok Assemble =~ m(rax:.*08.*rdi:.*9.*rax:.*1.*rdi:.*2.*)s;
}
if (1) { # Mask register instructions #TClearRegisters
Mov rax,1;
Kmovq k0, rax;
Kaddb k0, k0, k0;
Kaddb k0, k0, k0;
Kaddb k0, k0, k0;
Kmovq rax, k0;
PushR k0;
ClearRegisters k0;
Kmovq k1, k0;
PopR k0;
PrintOutRegisterInHex k0;
PrintOutRegisterInHex k1;
ok Assemble =~ m(k0: 0000 0000 0000 0008.*k1: 0000 0000 0000 0000)s;
}
if (1) { # Count leading zeros
Mov rax, 8; # Append a constant to the byte string
Lzcnt rax, rax; # New line
PrintOutRegisterInHex rax;
KeepFree rax;
Mov rax, 8; # Append a constant to the byte string
Tzcnt rax, rax; # New line
PrintOutRegisterInHex rax;
ok Assemble =~ m(rax: 0000 0000 0000 003C.*rax: 0000 0000 0000 0003)s;
}
if (1) { #TByteString::nl
my $s = CreateByteString;
$s->q("A");
$s->nl;
$s->q("B");
$s->out;
PrintOutNL;
is_deeply Assemble, <<END;
A
B
END
}
if (1) { # Print this file #TByteString::read #TByteString::z #TByteString::q
my $s = CreateByteString; # Create a string
$s->read(Vq(file, Rs($0)));
$s->out;
my $r = Assemble;
is_deeply stringMd5Sum($r), fileMd5Sum($0); # Output contains this file
}
if (1) { # Print rdi in hex into a byte string #TGetPidInHex
GetPidInHex;
PrintOutRegisterInHex rax;
ok Assemble =~ m(rax: 00);
}
if (1) { # Execute the content of a byte string #TexecuteFileViaBash #TByteString::write #TByteString::out #TunlinkFile #TByteString::ql
my $s = CreateByteString; # Create a string
$s->ql(<<END); # Write code to execute
#!/usr/bin/bash
whoami
ls -la
pwd
END
$s->write (my $f = Vq(\'file\', Rs("zzz.sh"))); # Write code to a file
executeFileViaBash($f); # Execute the file
unlinkFile ($f); # Delete the file
my $u = qx(whoami); chomp($u);
ok Assemble(emulator=>0) =~ m($u); # The Intel Software Development Emulator is way too slow on these operations.
}
if (1) { # Make a byte string readonly
my $s = CreateByteString; # Create a byte string
$s->q("Hello"); # Write code to byte string
$s->makeReadOnly; # Make byte string read only
$s->q(" World"); # Try to write to byte string
ok Assemble(debug=>2) =~ m(SDE ERROR: DEREFERENCING BAD MEMORY POINTER.*mov byte ptr .rax.rdx.1., r8b);
}
if (1) { # Make a read only byte string writable #TByteString::makeReadOnly #TByteString::makeWriteable
my $s = CreateByteString; # Create a byte string
$s->q("Hello"); # Write data to byte string
$s->makeReadOnly; # Make byte string read only - tested above
$s->makeWriteable; # Make byte string writable again
$s->q(" World"); # Try to write to byte string
$s->out;
ok Assemble =~ m(Hello World);
}
if (1) { # Allocate some space in byte string #TByteString::allocate
my $s = CreateByteString; # Create a byte string
$s->allocate(Vq(size, 0x20), my $o1 = Vq(offset)); # Allocate space wanted
$s->allocate(Vq(size, 0x30), my $o2 = Vq(offset));
$s->allocate(Vq(size, 0x10), my $o3 = Vq(offset));
$o1->outNL;
$o2->outNL;
$o3->outNL;
is_deeply Assemble, <<END;
offset: 0000 0000 0000 0018
offset: 0000 0000 0000 0038
offset: 0000 0000 0000 0068
END
}
# It is one of the happiest characteristics of this glorious country that official utterances are invariably regarded as unanswerable
if (1) { #TPrintOutZF #TSetZF #TClearZF
SetZF;
PrintOutZF;
ClearZF;
PrintOutZF;
SetZF;
PrintOutZF;
SetZF;
PrintOutZF;
ClearZF;
PrintOutZF;
ok Assemble =~ m(ZF=1.*ZF=0.*ZF=1.*ZF=1.*ZF=0)s;
}
if (1) { #TSetLabel #TRegisterSize #TSaveFirstFour #TSaveFirstSeven #TRestoreFirstFour #TRestoreFirstSeven #TRestoreFirstFourExceptRax #TRestoreFirstSevenExceptRax #TRestoreFirstFourExceptRaxAndRdi #TRestoreFirstSevenExceptRaxAndRdi #TReverseBytesInRax
Mov rax, 1;
Mov rdi, 1;
SaveFirstFour;
Mov rax, 2;
Mov rdi, 2;
SaveFirstSeven;
Mov rax, 3;
Mov rdi, 4;
PrintOutRegisterInHex rax, rdi;
RestoreFirstSeven;
PrintOutRegisterInHex rax, rdi;
RestoreFirstFour;
PrintOutRegisterInHex rax, rdi;
SaveFirstFour;
Mov rax, 2;
Mov rdi, 2;
SaveFirstSeven;
Mov rax, 3;
Mov rdi, 4;
PrintOutRegisterInHex rax, rdi;
RestoreFirstSevenExceptRax;
PrintOutRegisterInHex rax, rdi;
RestoreFirstFourExceptRax;
PrintOutRegisterInHex rax, rdi;
SaveFirstFour;
Mov rax, 2;
Mov rdi, 2;
SaveFirstSeven;
Mov rax, 3;
Mov rdi, 4;
PrintOutRegisterInHex rax, rdi;
RestoreFirstSevenExceptRaxAndRdi;
PrintOutRegisterInHex rax, rdi;
RestoreFirstFourExceptRaxAndRdi;
PrintOutRegisterInHex rax, rdi;
Bswap rax;
PrintOutRegisterInHex rax;
my $l = Label;
Jmp $l;
SetLabel $l;
is_deeply Assemble, <<END;
rax: 0000 0000 0000 0003
rdi: 0000 0000 0000 0004
rax: 0000 0000 0000 0002
rdi: 0000 0000 0000 0002
rax: 0000 0000 0000 0001
rdi: 0000 0000 0000 0001
rax: 0000 0000 0000 0003
rdi: 0000 0000 0000 0004
rax: 0000 0000 0000 0003
rdi: 0000 0000 0000 0002
rax: 0000 0000 0000 0003
rdi: 0000 0000 0000 0001
rax: 0000 0000 0000 0003
rdi: 0000 0000 0000 0004
rax: 0000 0000 0000 0003
rdi: 0000 0000 0000 0004
rax: 0000 0000 0000 0003
rdi: 0000 0000 0000 0004
rax: 0300 0000 0000 0000
END
ok 8 == RegisterSize rax;
}
if (1) { #TRb #TRd #TRq #TRw #TDb #TDd #TDq #TDw #TCopyMemory
my $s = Rb 0; Rb 1; Rw 2; Rd 3; Rq 4;
my $t = Db 0; Db 1; Dw 2; Dd 3; Dq 4;
Vmovdqu8 xmm0, "[$s]";
Vmovdqu8 xmm1, "[$t]";
PrintOutRegisterInHex xmm0;
PrintOutRegisterInHex xmm1;
Sub rsp, 16;
Mov rax, rsp; # Copy memory, the target is addressed by rax, the length is in rdi, the source is addressed by rsi
Mov rdi, 16;
Mov rsi, $s;
CopyMemory(Vq(source, rsi), Vq(target, rax), Vq(size, rdi));
PrintOutMemoryInHex;
my $r = Assemble;
ok $r =~ m(xmm0: 0000 0000 0000 0004 0000 0003 0002 0100);
ok $r =~ m(xmm1: 0000 0000 0000 0004 0000 0003 0002 0100);
ok $r =~ m(0001 0200 0300 00000400 0000 0000 0000);
}
#latest:;
if (1) { #TAllocateMemory #TPrintOutMemoryInHexNL #TCopyMemory
my $N = 256;
my $s = Rb 0..$N-1;
AllocateMemory(Cq(size, $N), my $a = Vq(address));
CopyMemory(Vq(source, $s), Vq(size, $N), target => $a);
AllocateMemory(Cq(size, $N), my $b = Vq(address));
CopyMemory(source => $a, target => $b, Cq(size, $N));
$b->setReg(rax);
Mov rdi, $N;
PrintOutMemoryInHexNL;
ok Assemble(debug=>0, eq => <<END);
0001 0203 0405 06070809 0A0B 0C0D 0E0F1011 1213 1415 16171819 1A1B 1C1D 1E1F2021 2223 2425 26272829 2A2B 2C2D 2E2F3031 3233 3435 36373839 3A3B 3C3D 3E3F4041 4243 4445 46474849 4A4B 4C4D 4E4F5051 5253 5455 56575859 5A5B 5C5D 5E5F6061 6263 6465 66676869 6A6B 6C6D 6E6F7071 7273 7475 76777879 7A7B 7C7D 7E7F8081 8283 8485 86878889 8A8B 8C8D 8E8F9091 9293 9495 96979899 9A9B 9C9D 9E9FA0A1 A2A3 A4A5 A6A7A8A9 AAAB ACAD AEAFB0B1 B2B3 B4B5 B6B7B8B9 BABB BCBD BEBFC0C1 C2C3 C4C5 C6C7C8C9 CACB CCCD CECFD0D1 D2D3 D4D5 D6D7D8D9 DADB DCDD DEDFE0E1 E2E3 E4E5 E6E7E8E9 EAEB ECED EEEFF0F1 F2F3 F4F5 F6F7F8F9 FAFB FCFD FEFF
END
}
if (1) { # Variable length shift
Mov rax, -1;
Mov cl, 30;
Shl rax, cl;
Kmovq k0, rax;
PrintOutRegisterInHex k0;
ok Assemble =~ m(k0: FFFF FFFF C000 0000)s;
}
if (1) { #
ClearRegisters rax;
Bts rax, 14;
Not rax;
PrintOutRegisterInHex rax;
Kmovq k1, rax;
PrintOutRegisterInHex k1;
KeepFree rax;
Mov rax, 1;
Vpbroadcastb zmm0, rax;
PrintOutRegisterInHex zmm0;
Vpexpandd "zmm1{k1}", zmm0;
PrintOutRegisterInHex zmm1;
is_deeply Assemble, <<END;
rax: FFFF FFFF FFFF BFFF
k1: FFFF FFFF FFFF BFFF
zmm0: 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101
zmm1: 0101 0101 0000 0000 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101
END
}
if (1) {
my $P = "2F"; # Value to test for
my $l = Rb 0; Rb $_ for 1..RegisterSize zmm0; # 0..63
Vmovdqu8 zmm0, "[$l]"; # Load data to test
PrintOutRegisterInHex zmm0;
Mov rax, "0x$P"; # Broadcast the value to be tested
Vpbroadcastb zmm1, rax;
PrintOutRegisterInHex zmm1;
for my $c(0..7) # Each possible test
{my $m = "k$c";
Vpcmpub $m, zmm1, zmm0, $c;
PrintOutRegisterInHex $m;
}
Kmovq rax, k0; # Count the number of trailing zeros in k0
Tzcnt rax, rax;
PrintOutRegisterInHex rax;
is_deeply [split //, Assemble], [split //, <<END]; # Assemble and test
zmm0: 3F3E 3D3C 3B3A 3938 3736 3534 3332 3130 2F2E 2D2C 2B2A 2928 2726 2524 2322 2120 1F1E 1D1C 1B1A 1918 1716 1514 1312 1110 0F0E 0D0C 0B0A 0908 0706 0504 0302 0100
zmm1: 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F 2F2F
k0: 0000 8000 0000 0000
k1: FFFF 0000 0000 0000
k2: FFFF 8000 0000 0000
k3: 0000 0000 0000 0000
k4: FFFF 7FFF FFFF FFFF
k5: 0000 FFFF FFFF FFFF
k6: 0000 7FFF FFFF FFFF
k7: FFFF FFFF FFFF FFFF
rax: 0000 0000 0000 00$P
END
# 0 eq 1 lt 2 le 4 ne 5 ge 6 gt comparisons
}
if (1) { #TCstrlen
my $s = Rs("abcd");
Mov rax, $s;
Cstrlen;
PrintOutRegisterInHex r15;
ok Assemble =~ m(r15: 0000 0000 0000 0004);
}
if (1) { # Hash a string #THash
Mov rax, "[rbp+24]";
Cstrlen; # Length of string to hash
Mov rdi, r15;
Hash(); # Hash string
PrintOutRegisterInHex r15;
my $e = Assemble keep=>\'hash\'; # Assemble to the specified file name
ok qx($e "") =~ m(r15: 0000 3F80 0000 3F80); # Test well known hashes
ok qx($e "a") =~ m(r15: 0000 3F80 C000 45B2);
if (0 and $develop) # Hash various strings
{my %r; my %f; my $count = 0;
my $N = RegisterSize zmm0;
if (1) # Fixed blocks
{for my $l(qw(a ab abc abcd), \'a a\', \'a a\')
{for my $i(1..$N)
{my $t = $l x $i;
last if $N < length $t;
my $s = substr($t.(\' \' x $N), 0, $N);
next if $f{$s}++;
my $r = qx($e "$s");
say STDERR "$count $r";
if ($r =~ m(^.*r15:\\s*(.*)$)m)
{push $r{$1}->@*, $s;
++$count;
}
}
}
}
if (1) # Variable blocks
{for my $l(qw(a ab abc abcd), \'\', \'a a\', \'a a\')
{for my $i(1..$N)
{my $t = $l x $i;
next if $f{$t}++;
my $r = qx($e "$t");
say STDERR "$count $r";
if ($r =~ m(^.*r15:\\s*(.*)$)m)
{push $r{$1}->@*, $t;
++$count;
}
}
}
}
for my $r(keys %r)
{delete $r{$r} if $r{$r}->@* < 2;
}
say STDERR dump(\\%r);
say STDERR "Keys hashed: ", $count;
confess "Duplicates : ", scalar keys(%r);
}
}
if (1) { #TLoadShortStringFromMemoryToZmm
my $s = Rb(3, 0x01, 0x02, 0x03);
my $t = Rb(7, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a);
LoadShortStringFromMemoryToZmm 0, $s;
LoadShortStringFromMemoryToZmm 1, $t;
ConcatenateShortStrings(0, 1);
PrintOutRegisterInHex xmm0;
PrintOutRegisterInHex xmm1;
my $r = Assemble;
ok $r =~ m(xmm0: 0000 0000 000A 0908 0706 0504 0302 010A);
ok $r =~ m(xmm1: 0000 0000 0000 0000 0A09 0807 0605 0407);
}
if (1) { # Concatenate empty string to itself 4 times
my $s = Rb(0);
LoadShortStringFromMemoryToZmm 0, $s;
ConcatenateShortStrings(0, 0);
ConcatenateShortStrings(0, 0);
ConcatenateShortStrings(0, 0);
ConcatenateShortStrings(0, 0);
PrintOutRegisterInHex xmm0;
ok Assemble =~ m(xmm0: 0000 0000 0000 0000 0000 0000 0000 0000);
}
if (1) { #Tif #TifEq #TifNe #TifLe #TifLt #TifGe #TifGt
my $cmp = sub
{my ($a, $b) = @_;
for my $op(qw(eq ne lt le gt ge))
{Mov rax, $a;
Cmp rax, $b;
KeepFree rax;
my $Op = ucfirst $op;
eval qq(If$Op {PrintOutStringNL("$a $op $b")} sub {PrintOutStringNL("$a NOT $op $b")});
$@ and confess $@;
}
};
&$cmp(1,1);
&$cmp(1,2);
&$cmp(3,2);
Assemble(debug => 0, eq => <<END);
1 eq 1
1 NOT ne 1
1 NOT lt 1
1 le 1
1 NOT gt 1
1 ge 1
1 NOT eq 2
1 ne 2
1 lt 2
1 le 2
1 NOT gt 2
1 NOT ge 2
3 NOT eq 2
3 ne 2
3 NOT lt 2
3 NOT le 2
3 gt 2
3 ge 2
END
}
if (1) { #TSetMaskRegister
Mov rax, 8;
Mov rsi, -1;
Inc rsi; SetMaskRegister(k0, rax, rsi); PrintOutRegisterInHex k0;
Inc rsi; SetMaskRegister(k1, rax, rsi); PrintOutRegisterInHex k1;
Inc rsi; SetMaskRegister(k2, rax, rsi); PrintOutRegisterInHex k2;
Inc rsi; SetMaskRegister(k3, rax, rsi); PrintOutRegisterInHex k3;
Inc rsi; SetMaskRegister(k4, rax, rsi); PrintOutRegisterInHex k4;
Inc rsi; SetMaskRegister(k5, rax, rsi); PrintOutRegisterInHex k5;
Inc rsi; SetMaskRegister(k6, rax, rsi); PrintOutRegisterInHex k6;
Inc rsi; SetMaskRegister(k7, rax, rsi); PrintOutRegisterInHex k7;
is_deeply Assemble, <<END;
k0: 0000 0000 0000 0000
k1: 0000 0000 0000 0100
k2: 0000 0000 0000 0300
k3: 0000 0000 0000 0700
k4: 0000 0000 0000 0F00
k5: 0000 0000 0000 1F00
k6: 0000 0000 0000 3F00
k7: 0000 0000 0000 7F00
END
}
if (1) #TScope #TScopeEnd #TScope::contains #TScope::currentlyVisible
{my $start = Scope(start);
my $s1 = Scope(s1);
my $s2 = Scope(s2);
is_deeply $s2->depth, 2;
is_deeply $s2->name, q(s2);
ScopeEnd;
my $t1 = Scope(t1);
my $t2 = Scope(t2);
is_deeply $t1->depth, 2;
is_deeply $t1->name, q(t1);
is_deeply $t2->depth, 3;
is_deeply $t2->name, q(t2);
ok $s1->currentlyVisible;
ok !$s2->currentlyVisible;
ok $s1->contains($t2);
ok !$s2->contains($t2);
ScopeEnd;
is_deeply $s1->depth, 1;
is_deeply $s1->name, q(s1);
ScopeEnd;
}
#latest:;
if (1) { #TNasm::X86::Variable::dump #TNasm::X86::Variable::print
my $a = Vq(a, 3); $a->outNL;
my $b = Vq(b, 2); $b->outNL;
my $c = $a + $b; $c->outNL;
my $d = $c - $a; $d->outNL;
my $e = $d == $b; $e->outNL;
my $f = $d != $b; $f->outNL;
my $g = $a * $b; $g->outNL;
my $h = $g / $b; $h->outNL;
my $i = $a % $b; $i->outNL;
If ($a == 3, sub{PrintOutStringNL "a == 3"});
++$a; $a->outNL;
--$a; $a->outNL;
ok Assemble(debug => 0, eq => <<END);
a: 0000 0000 0000 0003
b: 0000 0000 0000 0002
(a add b): 0000 0000 0000 0005
((a add b) sub a): 0000 0000 0000 0002
(((a add b) sub a) eq b): 0000 0000 0000 0001
(((a add b) sub a) ne b): 0000 0000 0000 0000
(a times b): 0000 0000 0000 0006
((a times b) / b): 0000 0000 0000 0003
(a % b): 0000 0000 0000 0001
a == 3
a: 0000 0000 0000 0004
a: 0000 0000 0000 0003
END
}
#latest:;
if (1) { #TNasm::X86::Variable::for
Vq(limit,10)->for(sub
{my ($i, $start, $next, $end) = @_;
$i->outNL;
});
is_deeply Assemble, <<END;
index: 0000 0000 0000 0000
index: 0000 0000 0000 0001
index: 0000 0000 0000 0002
index: 0000 0000 0000 0003
index: 0000 0000 0000 0004
index: 0000 0000 0000 0005
index: 0000 0000 0000 0006
index: 0000 0000 0000 0007
index: 0000 0000 0000 0008
index: 0000 0000 0000 0009
END
}
if (1) { #T
Mov rax, 2;
PrintOutRegisterInHex rax;
ok Assemble =~ m(rax: 0000 0000 0000 0002);
}
if (1) { #TNasm::X86::Variable::min #TNasm::X86::Variable::max
my $a = Vq("a", 1);
my $b = Vq("b", 2);
my $c = $a->min($b);
my $d = $a->max($b);
$a->outNL;
$b->outNL;
$c->outNL;
$d->outNL;
is_deeply Assemble,<<END;
a: 0000 0000 0000 0001
b: 0000 0000 0000 0002
Minimum(a, b): 0000 0000 0000 0001
Maximum(a, b): 0000 0000 0000 0002
END
}
if (1) { #TNasm::X86::Variable::setMask
my $start = Vq("Start", 7);
my $length = Vq("Length", 3);
$start->setMask($length, k7);
PrintOutRegisterInHex k7;
is_deeply Assemble, <<END;
k7: 0000 0000 0000 0380
END
}
if (1) { #TNasm::X86::Variable::setZmm
my $s = Rb(0..128);
my $source = Vq(Source, $s);
if (1) # First block
{my $offset = Vq(Offset, 7);
my $length = Vq(Length, 3);
$source->setZmm(0, $offset, $length);
}
if (1) # Second block
{my $offset = Vq(Offset, 33);
my $length = Vq(Length, 12);
$source->setZmm(0, $offset, $length);
}
PrintOutRegisterInHex zmm0;
is_deeply Assemble, <<END;
zmm0: 0000 0000 0000 0000 0000 0000 0000 0000 0000 000B 0A09 0807 0605 0403 0201 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0201 0000 0000 0000 0000
END
}
if (1) { #TNasm::X86::Variable::getZmm #TNasm::X86::Variable::setZmm
my $a = Vz a, Rb((map {"0x${_}0"} 0..9, \'a\'..\'f\')x4);
my $b = Vz b, Rb((map {"0x0${_}"} 0..9, \'a\'..\'f\')x4);
$a ->loadZmm(0); # Show variable in zmm0
$b ->loadZmm(1); # Show variable in zmm1
($a + $b)->loadZmm(2); # Add bytes and show in zmm2
($a - $b)->loadZmm(3); # Subtract bytes and show in zmm3
PrintOutRegisterInHex "zmm$_" for 0..3;
is_deeply Assemble, <<END;
zmm0: F0E0 D0C0 B0A0 9080 7060 5040 3020 1000 F0E0 D0C0 B0A0 9080 7060 5040 3020 1000 F0E0 D0C0 B0A0 9080 7060 5040 3020 1000 F0E0 D0C0 B0A0 9080 7060 5040 3020 1000
zmm1: 0F0E 0D0C 0B0A 0908 0706 0504 0302 0100 0F0E 0D0C 0B0A 0908 0706 0504 0302 0100 0F0E 0D0C 0B0A 0908 0706 0504 0302 0100 0F0E 0D0C 0B0A 0908 0706 0504 0302 0100
zmm2: FFEE DDCC BBAA 9988 7766 5544 3322 1100 FFEE DDCC BBAA 9988 7766 5544 3322 1100 FFEE DDCC BBAA 9988 7766 5544 3322 1100 FFEE DDCC BBAA 9988 7766 5544 3322 1100
zmm3: E1D2 C3B4 A596 8778 695A 4B3C 2D1E 0F00 E1D2 C3B4 A596 8778 695A 4B3C 2D1E 0F00 E1D2 C3B4 A596 8778 695A 4B3C 2D1E 0F00 E1D2 C3B4 A596 8778 695A 4B3C 2D1E 0F00
END
}
if (1) { #TgetDFromZmm #TNasm::X86::Variable::putDIntoZmm
my $s = Rb(0..8);
my $c = Vq("Content", "[$s]");
$c->putBIntoZmm(0, 4);
$c->putWIntoZmm(0, 6);
$c->putDIntoZmm(0, 10);
$c->putQIntoZmm(0, 16);
PrintOutRegisterInHex zmm0;
getBFromZmm(0, 12)->outNL;
getWFromZmm(0, 12)->outNL;
getDFromZmm(0, 12)->outNL;
getQFromZmm(0, 12)->outNL;
is_deeply Assemble, <<END;
zmm0: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0706 0504 0302 0100 0000 0302 0100 0000 0100 0000 0000 0000
b at offset 12 in zmm0: 0000 0000 0000 0002
w at offset 12 in zmm0: 0000 0000 0000 0302
d at offset 12 in zmm0: 0000 0000 0000 0302
q at offset 12 in zmm0: 0302 0100 0000 0302
END
}
#latest:;
if (1) { #TCreateBlockString
my $s = Rb(0..255);
my $B = CreateByteString;
my $b = $B->CreateBlockString;
$b->append(Vq(source, $s), Vq(size, 3)); $b->dump;
$b->append(Vq(source, $s), Vq(size, 4)); $b->dump;
$b->append(Vq(source, $s), Vq(size, 5)); $b->dump;
ok Assemble(debug => 0, eq => <<END);
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0003
zmm31: 0000 0018 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0201 0003
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0007
zmm31: 0000 0018 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0302 0100 0201 0007
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 000C
zmm31: 0000 0018 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0004 0302 0100 0302 0100 0201 000C
END
}
if (1) { #TCreateBlockString
my $s = Rb(0..255);
my $B = CreateByteString;
my $b = $B->CreateBlockString;
$b->append(Vq(source, $s), Vq(size, 165)); $b->dump;
$b->append(Vq(source, $s), Vq(size, 2)); $b->dump;
ok Assemble(debug => 0, eq => <<END);
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0037
zmm31: 0000 0058 0000 0098 3635 3433 3231 302F 2E2D 2C2B 2A29 2827 2625 2423 2221 201F 1E1D 1C1B 1A19 1817 1615 1413 1211 100F 0E0D 0C0B 0A09 0807 0605 0403 0201 0037
Offset: 0000 0000 0000 0058 Length: 0000 0000 0000 0037
zmm31: 0000 0098 0000 0018 6D6C 6B6A 6968 6766 6564 6362 6160 5F5E 5D5C 5B5A 5958 5756 5554 5352 5150 4F4E 4D4C 4B4A 4948 4746 4544 4342 4140 3F3E 3D3C 3B3A 3938 3737
Offset: 0000 0000 0000 0098 Length: 0000 0000 0000 0037
zmm31: 0000 0018 0000 0058 A4A3 A2A1 A09F 9E9D 9C9B 9A99 9897 9695 9493 9291 908F 8E8D 8C8B 8A89 8887 8685 8483 8281 807F 7E7D 7C7B 7A79 7877 7675 7473 7271 706F 6E37
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0037
zmm31: 0000 0058 0000 00D8 3635 3433 3231 302F 2E2D 2C2B 2A29 2827 2625 2423 2221 201F 1E1D 1C1B 1A19 1817 1615 1413 1211 100F 0E0D 0C0B 0A09 0807 0605 0403 0201 0037
Offset: 0000 0000 0000 0058 Length: 0000 0000 0000 0037
zmm31: 0000 0098 0000 0018 6D6C 6B6A 6968 6766 6564 6362 6160 5F5E 5D5C 5B5A 5958 5756 5554 5352 5150 4F4E 4D4C 4B4A 4948 4746 4544 4342 4140 3F3E 3D3C 3B3A 3938 3737
Offset: 0000 0000 0000 0098 Length: 0000 0000 0000 0037
zmm31: 0000 00D8 0000 0058 A4A3 A2A1 A09F 9E9D 9C9B 9A99 9897 9695 9493 9291 908F 8E8D 8C8B 8A89 8887 8685 8483 8281 807F 7E7D 7C7B 7A79 7877 7675 7473 7271 706F 6E37
Offset: 0000 0000 0000 00D8 Length: 0000 0000 0000 0002
zmm31: 0000 0018 0000 0098 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0001 0002
END
}
if (1) { #TCreateBlockString
my $s = Rb(0..255);
my $B = CreateByteString;
my $b = $B->CreateBlockString;
$b->append(Vq(source, $s), Vq(size, 56)); $b->dump;
$b->append(Vq(source, $s), Vq(size, 4)); $b->dump;
$b->append(Vq(source, $s), Vq(size, 5)); $b->dump;
$b->append(Vq(source, $s), Vq(size, 0)); $b->dump;
$b->append(Vq(source, $s), Vq(size, 256)); $b->dump;
ok Assemble(debug => 0, eq => <<END);
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0037
zmm31: 0000 0058 0000 0058 3635 3433 3231 302F 2E2D 2C2B 2A29 2827 2625 2423 2221 201F 1E1D 1C1B 1A19 1817 1615 1413 1211 100F 0E0D 0C0B 0A09 0807 0605 0403 0201 0037
Offset: 0000 0000 0000 0058 Length: 0000 0000 0000 0001
zmm31: 0000 0018 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 3701
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0037
zmm31: 0000 0058 0000 0058 3635 3433 3231 302F 2E2D 2C2B 2A29 2827 2625 2423 2221 201F 1E1D 1C1B 1A19 1817 1615 1413 1211 100F 0E0D 0C0B 0A09 0807 0605 0403 0201 0037
Offset: 0000 0000 0000 0058 Length: 0000 0000 0000 0005
zmm31: 0000 0018 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0302 0100 3705
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0037
zmm31: 0000 0058 0000 0058 3635 3433 3231 302F 2E2D 2C2B 2A29 2827 2625 2423 2221 201F 1E1D 1C1B 1A19 1817 1615 1413 1211 100F 0E0D 0C0B 0A09 0807 0605 0403 0201 0037
Offset: 0000 0000 0000 0058 Length: 0000 0000 0000 000A
zmm31: 0000 0018 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0004 0302 0100 0302 0100 370A
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0037
zmm31: 0000 0058 0000 0058 3635 3433 3231 302F 2E2D 2C2B 2A29 2827 2625 2423 2221 201F 1E1D 1C1B 1A19 1817 1615 1413 1211 100F 0E0D 0C0B 0A09 0807 0605 0403 0201 0037
Offset: 0000 0000 0000 0058 Length: 0000 0000 0000 000A
zmm31: 0000 0018 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0004 0302 0100 0302 0100 370A
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0037
zmm31: 0000 0058 0000 0158 3635 3433 3231 302F 2E2D 2C2B 2A29 2827 2625 2423 2221 201F 1E1D 1C1B 1A19 1817 1615 1413 1211 100F 0E0D 0C0B 0A09 0807 0605 0403 0201 0037
Offset: 0000 0000 0000 0058 Length: 0000 0000 0000 0037
zmm31: 0000 0098 0000 0018 2C2B 2A29 2827 2625 2423 2221 201F 1E1D 1C1B 1A19 1817 1615 1413 1211 100F 0E0D 0C0B 0A09 0807 0605 0403 0201 0004 0302 0100 0302 0100 3737
Offset: 0000 0000 0000 0098 Length: 0000 0000 0000 0037
zmm31: 0000 00D8 0000 0058 6362 6160 5F5E 5D5C 5B5A 5958 5756 5554 5352 5150 4F4E 4D4C 4B4A 4948 4746 4544 4342 4140 3F3E 3D3C 3B3A 3938 3736 3534 3332 3130 2F2E 2D37
Offset: 0000 0000 0000 00D8 Length: 0000 0000 0000 0037
zmm31: 0000 0118 0000 0098 9A99 9897 9695 9493 9291 908F 8E8D 8C8B 8A89 8887 8685 8483 8281 807F 7E7D 7C7B 7A79 7877 7675 7473 7271 706F 6E6D 6C6B 6A69 6867 6665 6437
Offset: 0000 0000 0000 0118 Length: 0000 0000 0000 0037
zmm31: 0000 0158 0000 00D8 D1D0 CFCE CDCC CBCA C9C8 C7C6 C5C4 C3C2 C1C0 BFBE BDBC BBBA B9B8 B7B6 B5B4 B3B2 B1B0 AFAE ADAC ABAA A9A8 A7A6 A5A4 A3A2 A1A0 9F9E 9D9C 9B37
Offset: 0000 0000 0000 0158 Length: 0000 0000 0000 002E
zmm31: 0000 0018 0000 0118 0000 0000 0000 0000 00FF FEFD FCFB FAF9 F8F7 F6F5 F4F3 F2F1 F0EF EEED ECEB EAE9 E8E7 E6E5 E4E3 E2E1 E0DF DEDD DCDB DAD9 D8D7 D6D5 D4D3 D22E
END
}
if (1) {
my $s = Rb(0..255);
my $B = CreateByteString;
my $b = $B->CreateBlockString;
$b->append(source=>Vq(source, $s), Vq(size, 256));
$b->len(my $size = Vq(size));
$size->outNL;
$b->clear;
$b->append(Vq(source, $s), size => Vq(size, 16)); $b->dump;
$b->len(my $size2 = Vq(size));
$size2->outNL;
is_deeply Assemble, <<END;
size: 0000 0000 0000 0100
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0010
zmm31: 0000 0018 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 000F 0E0D 0C0B 0A09 0807 0605 0403 0201 0010
size: 0000 0000 0000 0010
END
}
#latest:;
if (1) {
my $c = Rb(0..255);
my $S = CreateByteString; my $s = $S->CreateBlockString;
my $T = CreateByteString; my $t = $T->CreateBlockString;
$s->append(source=>Vq(source, $c), Vq(size, 256));
$t->concatenate($s);
$t->dump;
ok Assemble(debug => 0, eq => <<END);
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0000
zmm31: 0000 0058 0000 0158 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
Offset: 0000 0000 0000 0058 Length: 0000 0000 0000 0037
zmm31: 0000 0098 0000 0018 3635 3433 3231 302F 2E2D 2C2B 2A29 2827 2625 2423 2221 201F 1E1D 1C1B 1A19 1817 1615 1413 1211 100F 0E0D 0C0B 0A09 0807 0605 0403 0201 0037
Offset: 0000 0000 0000 0098 Length: 0000 0000 0000 0037
zmm31: 0000 00D8 0000 0058 6D6C 6B6A 6968 6766 6564 6362 6160 5F5E 5D5C 5B5A 5958 5756 5554 5352 5150 4F4E 4D4C 4B4A 4948 4746 4544 4342 4140 3F3E 3D3C 3B3A 3938 3737
Offset: 0000 0000 0000 00D8 Length: 0000 0000 0000 0037
zmm31: 0000 0118 0000 0098 A4A3 A2A1 A09F 9E9D 9C9B 9A99 9897 9695 9493 9291 908F 8E8D 8C8B 8A89 8887 8685 8483 8281 807F 7E7D 7C7B 7A79 7877 7675 7473 7271 706F 6E37
Offset: 0000 0000 0000 0118 Length: 0000 0000 0000 0037
zmm31: 0000 0158 0000 00D8 DBDA D9D8 D7D6 D5D4 D3D2 D1D0 CFCE CDCC CBCA C9C8 C7C6 C5C4 C3C2 C1C0 BFBE BDBC BBBA B9B8 B7B6 B5B4 B3B2 B1B0 AFAE ADAC ABAA A9A8 A7A6 A537
Offset: 0000 0000 0000 0158 Length: 0000 0000 0000 0024
zmm31: 0000 0018 0000 0118 0000 0000 0000 0000 0000 0000 0000 0000 0000 00FF FEFD FCFB FAF9 F8F7 F6F5 F4F3 F2F1 F0EF EEED ECEB EAE9 E8E7 E6E5 E4E3 E2E1 E0DF DEDD DC24
END
}
#latest:;
if (1) { # Insert char in a one block string
my $c = Rb(0..255);
my $S = CreateByteString; my $s = $S->CreateBlockString;
$s->append(source=>Vq(source, $c), Vq(size, 3));
$s->dump;
$s->insertChar(character=>Vq(source, 0x44), position => Vq(size, 2));
$s->dump;
$s->insertChar(character=>Vq(source, 0x88), position => Vq(size, 2));
$s->dump;
ok Assemble(debug => 0, eq => <<END);
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0003
zmm31: 0000 0018 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0201 0003
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0004
zmm31: 0000 0018 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0002 4401 0004
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0005
zmm31: 0000 0018 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0244 8801 0005
END
}
#latest:;
if (1) { # Insert char in a multi block string at position 22
my $c = Rb(0..255);
my $S = CreateByteString; my $s = $S->CreateBlockString;
$s->append(source=>Vq(source, $c), Vq(size, 58));
$s->dump;
$s->insertChar(Vq(character, 0x44), Vq(position, 22));
$s->dump;
$s->insertChar(Vq(character, 0x88), Vq(position, 22));
$s->dump;
ok Assemble(debug => 0, eq => <<END);
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0037
zmm31: 0000 0058 0000 0058 3635 3433 3231 302F 2E2D 2C2B 2A29 2827 2625 2423 2221 201F 1E1D 1C1B 1A19 1817 1615 1413 1211 100F 0E0D 0C0B 0A09 0807 0605 0403 0201 0037
Offset: 0000 0000 0000 0058 Length: 0000 0000 0000 0003
zmm31: 0000 0018 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 3938 3703
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0016
zmm31: 0000 0098 0000 0098 3635 3433 3231 302F 2E2D 2C2B 2A29 2827 2625 2423 2221 201F 1E1D 1C1B 1A19 1817 1615 1413 1211 100F 0E0D 0C0B 0A09 0807 0605 0403 0201 0016
Offset: 0000 0000 0000 0098 Length: 0000 0000 0000 0022
zmm31: 0000 0058 0000 0058 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 5836 3534 3332 3130 2F2E 2D2C 2B2A 2928 2726 2524 2322 2120 1F1E 1D1C 1B1A 1918 1716 4422
Offset: 0000 0000 0000 0058 Length: 0000 0000 0000 0003
zmm31: 0000 0018 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 3938 3703
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0017
zmm31: 0000 0098 0000 0098 3635 3433 3231 302F 2E2D 2C2B 2A29 2827 2625 2423 2221 201F 1E1D 1C1B 1A19 1817 8815 1413 1211 100F 0E0D 0C0B 0A09 0807 0605 0403 0201 0017
Offset: 0000 0000 0000 0098 Length: 0000 0000 0000 0022
zmm31: 0000 0058 0000 0058 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 5836 3534 3332 3130 2F2E 2D2C 2B2A 2928 2726 2524 2322 2120 1F1E 1D1C 1B1A 1918 1716 4422
Offset: 0000 0000 0000 0058 Length: 0000 0000 0000 0003
zmm31: 0000 0018 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 3938 3703
END
}
if (1) { #BlockString::insertChar
my $c = Rb(0..255);
my $S = CreateByteString; my $s = $S->CreateBlockString;
$s->append(source=>Vq(source, $c), Vq(size, 166));
$s->dump;
$s->insertChar(Vq(character, 0x44), Vq(position, 64));
$s->dump;
$s->insertChar(Vq(character, 0x88), Vq(position, 64));
$s->dump;
ok Assemble(debug => 0, eq => <<END);
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0037
zmm31: 0000 0058 0000 00D8 3635 3433 3231 302F 2E2D 2C2B 2A29 2827 2625 2423 2221 201F 1E1D 1C1B 1A19 1817 1615 1413 1211 100F 0E0D 0C0B 0A09 0807 0605 0403 0201 0037
Offset: 0000 0000 0000 0058 Length: 0000 0000 0000 0037
zmm31: 0000 0098 0000 0018 6D6C 6B6A 6968 6766 6564 6362 6160 5F5E 5D5C 5B5A 5958 5756 5554 5352 5150 4F4E 4D4C 4B4A 4948 4746 4544 4342 4140 3F3E 3D3C 3B3A 3938 3737
Offset: 0000 0000 0000 0098 Length: 0000 0000 0000 0037
zmm31: 0000 00D8 0000 0058 A4A3 A2A1 A09F 9E9D 9C9B 9A99 9897 9695 9493 9291 908F 8E8D 8C8B 8A89 8887 8685 8483 8281 807F 7E7D 7C7B 7A79 7877 7675 7473 7271 706F 6E37
Offset: 0000 0000 0000 00D8 Length: 0000 0000 0000 0001
zmm31: 0000 0018 0000 0098 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 A501
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0037
zmm31: 0000 0058 0000 00D8 3635 3433 3231 302F 2E2D 2C2B 2A29 2827 2625 2423 2221 201F 1E1D 1C1B 1A19 1817 1615 1413 1211 100F 0E0D 0C0B 0A09 0807 0605 0403 0201 0037
Offset: 0000 0000 0000 0058 Length: 0000 0000 0000 0009
zmm31: 0000 0118 0000 0018 6D6C 6B6A 6968 6766 6564 6362 6160 5F5E 5D5C 5B5A 5958 5756 5554 5352 5150 4F4E 4D4C 4B4A 4948 4746 4544 4342 4140 3F3E 3D3C 3B3A 3938 3709
Offset: 0000 0000 0000 0118 Length: 0000 0000 0000 002F
zmm31: 0000 0098 0000 0058 0000 0000 0000 0018 6D6C 6B6A 6968 6766 6564 6362 6160 5F5E 5D5C 5B5A 5958 5756 5554 5352 5150 4F4E 4D4C 4B4A 4948 4746 4544 4342 4140 442F
Offset: 0000 0000 0000 0098 Length: 0000 0000 0000 0037
zmm31: 0000 00D8 0000 0058 A4A3 A2A1 A09F 9E9D 9C9B 9A99 9897 9695 9493 9291 908F 8E8D 8C8B 8A89 8887 8685 8483 8281 807F 7E7D 7C7B 7A79 7877 7675 7473 7271 706F 6E37
Offset: 0000 0000 0000 00D8 Length: 0000 0000 0000 0001
zmm31: 0000 0018 0000 0098 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 A501
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0037
zmm31: 0000 0058 0000 00D8 3635 3433 3231 302F 2E2D 2C2B 2A29 2827 2625 2423 2221 201F 1E1D 1C1B 1A19 1817 1615 1413 1211 100F 0E0D 0C0B 0A09 0807 0605 0403 0201 0037
Offset: 0000 0000 0000 0058 Length: 0000 0000 0000 0037
zmm31: 0000 0158 0000 0018 6D6C 6B6A 6968 6766 6564 6362 6160 5F5E 5D5C 5B5A 5958 5756 5554 5352 5150 4F4E 4D4C 4B4A 4948 4746 4544 4342 4140 3F3E 3D3C 3B3A 3938 3737
Offset: 0000 0000 0000 0158 Length: 0000 0000 0000 0001
zmm31: 0000 0118 0000 0058 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0018 8801
Offset: 0000 0000 0000 0118 Length: 0000 0000 0000 002F
zmm31: 0000 0098 0000 0058 0000 0000 0000 0018 6D6C 6B6A 6968 6766 6564 6362 6160 5F5E 5D5C 5B5A 5958 5756 5554 5352 5150 4F4E 4D4C 4B4A 4948 4746 4544 4342 4140 442F
Offset: 0000 0000 0000 0098 Length: 0000 0000 0000 0037
zmm31: 0000 00D8 0000 0058 A4A3 A2A1 A09F 9E9D 9C9B 9A99 9897 9695 9493 9291 908F 8E8D 8C8B 8A89 8887 8685 8483 8281 807F 7E7D 7C7B 7A79 7877 7675 7473 7271 706F 6E37
Offset: 0000 0000 0000 00D8 Length: 0000 0000 0000 0001
zmm31: 0000 0018 0000 0098 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 A501
END
}
if (1) { # Append a char
my $c = Rb(0..255);
my $S = CreateByteString; my $s = $S->CreateBlockString;
$s->append(source=>Vq(source, $c), Vq(size, 3)); $s->dump;
$s->insertChar(Vq(character, 0x44), Vq(position, 64)); $s->dump;
$s->len(my $size = Vq(size)); $size->outNL;
ok Assemble(debug => 0, eq => <<END);
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0003
zmm31: 0000 0018 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0201 0003
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0004
zmm31: 0000 0018 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0044 0201 0004
size: 0000 0000 0000 0004
END
}
if (1) { #TBlockString::deleteChar #TBlockString::len
my $c = Rb(0..255);
my $S = CreateByteString; my $s = $S->CreateBlockString;
$s->append(source=>Vq(source, $c), Vq(size, 165)); $s->dump;
$s->deleteChar(Vq(position, 0x44)); $s->dump;
$s->len(my $size = Vq(size)); $size->outNL;
ok Assemble(debug => 0, eq => <<END);
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0037
zmm31: 0000 0058 0000 0098 3635 3433 3231 302F 2E2D 2C2B 2A29 2827 2625 2423 2221 201F 1E1D 1C1B 1A19 1817 1615 1413 1211 100F 0E0D 0C0B 0A09 0807 0605 0403 0201 0037
Offset: 0000 0000 0000 0058 Length: 0000 0000 0000 0037
zmm31: 0000 0098 0000 0018 6D6C 6B6A 6968 6766 6564 6362 6160 5F5E 5D5C 5B5A 5958 5756 5554 5352 5150 4F4E 4D4C 4B4A 4948 4746 4544 4342 4140 3F3E 3D3C 3B3A 3938 3737
Offset: 0000 0000 0000 0098 Length: 0000 0000 0000 0037
zmm31: 0000 0018 0000 0058 A4A3 A2A1 A09F 9E9D 9C9B 9A99 9897 9695 9493 9291 908F 8E8D 8C8B 8A89 8887 8685 8483 8281 807F 7E7D 7C7B 7A79 7877 7675 7473 7271 706F 6E37
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0037
zmm31: 0000 0058 0000 0098 3635 3433 3231 302F 2E2D 2C2B 2A29 2827 2625 2423 2221 201F 1E1D 1C1B 1A19 1817 1615 1413 1211 100F 0E0D 0C0B 0A09 0807 0605 0403 0201 0037
Offset: 0000 0000 0000 0058 Length: 0000 0000 0000 0036
zmm31: 0000 0098 0000 0018 186D 6C6B 6A69 6867 6665 6463 6261 605F 5E5D 5C5B 5A59 5857 5655 5453 5251 504F 4E4D 4C4B 4A49 4847 4645 4342 4140 3F3E 3D3C 3B3A 3938 3736
Offset: 0000 0000 0000 0098 Length: 0000 0000 0000 0037
zmm31: 0000 0018 0000 0058 A4A3 A2A1 A09F 9E9D 9C9B 9A99 9897 9695 9493 9291 908F 8E8D 8C8B 8A89 8887 8685 8483 8281 807F 7E7D 7C7B 7A79 7877 7675 7473 7271 706F 6E37
size: 0000 0000 0000 00A4
END
}
#latest:;
if (1) { #TBlockString::getChar
my $c = Rb(0..255);
my $S = CreateByteString; my $s = $S->CreateBlockString;
$s->append(source=>Vq(source, $c), Vq(size, 110)); $s->dump;
$s->getCharacter(Vq(position, 0x44), my $out = Vq(out)); $out->outNL;
ok Assemble(debug => 0, eq => <<END);
Block String Dump
Offset: 0000 0000 0000 0018 Length: 0000 0000 0000 0037
zmm31: 0000 0058 0000 0058 3635 3433 3231 302F 2E2D 2C2B 2A29 2827 2625 2423 2221 201F 1E1D 1C1B 1A19 1817 1615 1413 1211 100F 0E0D 0C0B 0A09 0807 0605 0403 0201 0037
Offset: 0000 0000 0000 0058 Length: 0000 0000 0000 0037
zmm31: 0000 0018 0000 0018 6D6C 6B6A 6968 6766 6564 6362 6160 5F5E 5D5C 5B5A 5958 5756 5554 5352 5150 4F4E 4D4C 4B4A 4948 4746 4544 4342 4140 3F3E 3D3C 3B3A 3938 3737
out: 0000 0000 0000 0044
END
}
#latest:;
if (1) { #TNasm::X86::Variable::setMask
my $z = Vq(\'zero\', 0);
my $o = Vq(\'one\', 1);
my $t = Vq(\'two\', 2);
$z->setMask($o, k7); PrintOutRegisterInHex k7;
$z->setMask($t, k6); PrintOutRegisterInHex k6;
$z->setMask($o+$t, k5); PrintOutRegisterInHex k5;
$o->setMask($o, k4); PrintOutRegisterInHex k4;
$o->setMask($t, k3); PrintOutRegisterInHex k3;
$o->setMask($o+$t, k2); PrintOutRegisterInHex k2;
$t->setMask($o, k1); PrintOutRegisterInHex k1;
$t->setMask($t, k0); PrintOutRegisterInHex k0;
ok Assemble(debug => 0, eq => <<END);
k7: 0000 0000 0000 0001
k6: 0000 0000 0000 0003
k5: 0000 0000 0000 0007
k4: 0000 0000 0000 0002
k3: 0000 0000 0000 0006
k2: 0000 0000 0000 000E
k1: 0000 0000 0000 0004
k0: 0000 0000 0000 000C
END
}
#latest:;
if (1) { #TCreateBlockArray #TBlockArray::push
my $c = Rb(0..255);
my $A = CreateByteString; my $a = $A->CreateBlockArray;
$a->push(element => Vq($_, $_)) for 1..15; $A->dump;
$a->push(element => Vq($_, $_)) for 0xff; $A->dump;
$a->push(element => Vq($_, $_)) for 17..31; $A->dump;
$a->push(element => Vq($_, $_)) for 0xee; $A->dump;
$a->push(element => Vq($_, $_)) for 33..36; $A->dump;
ok Assemble(debug => 0, eq => <<END);
Byte String
Size: 0000 0000 0000 1000
Used: 0000 0000 0000 0058
0000: 0010 0000 0000 00005800 0000 0000 00000000 0000 0000 00000F00 0000 0100 00000200 0000 0300 00000400 0000 0500 00000600 0000 0700 00000800 0000 0900 0000
0040: 0A00 0000 0B00 00000C00 0000 0D00 00000E00 0000 0F00 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
0080: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
00C0: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
Byte String
Size: 0000 0000 0000 1000
Used: 0000 0000 0000 0098
0000: 0010 0000 0000 00009800 0000 0000 00000000 0000 0000 00001000 0000 5800 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
0040: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000100 0000 0200 00000300 0000 0400 00000500 0000 0600 00000700 0000 0800 00000900 0000 0A00 0000
0080: 0B00 0000 0C00 00000D00 0000 0E00 00000F00 0000 FF00 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
00C0: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
Byte String
Size: 0000 0000 0000 1000
Used: 0000 0000 0000 00D8
0000: 0010 0000 0000 0000D800 0000 0000 00000000 0000 0000 00001F00 0000 5800 00009800 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
0040: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000100 0000 0200 00000300 0000 0400 00000500 0000 0600 00000700 0000 0800 00000900 0000 0A00 0000
0080: 0B00 0000 0C00 00000D00 0000 0E00 00000F00 0000 FF00 00001100 0000 1200 00001300 0000 1400 00001500 0000 1600 00001700 0000 1800 00001900 0000 1A00 0000
00C0: 1B00 0000 1C00 00001D00 0000 1E00 00001F00 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
Byte String
Size: 0000 0000 0000 1000
Used: 0000 0000 0000 00D8
0000: 0010 0000 0000 0000D800 0000 0000 00000000 0000 0000 00002000 0000 5800 00009800 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
0040: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000100 0000 0200 00000300 0000 0400 00000500 0000 0600 00000700 0000 0800 00000900 0000 0A00 0000
0080: 0B00 0000 0C00 00000D00 0000 0E00 00000F00 0000 FF00 00001100 0000 1200 00001300 0000 1400 00001500 0000 1600 00001700 0000 1800 00001900 0000 1A00 0000
00C0: 1B00 0000 1C00 00001D00 0000 1E00 00001F00 0000 EE00 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
Byte String
Size: 0000 0000 0000 1000
Used: 0000 0000 0000 0118
0000: 0010 0000 0000 00001801 0000 0000 00000000 0000 0000 00002400 0000 5800 00009800 0000 D800 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
0040: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000100 0000 0200 00000300 0000 0400 00000500 0000 0600 00000700 0000 0800 00000900 0000 0A00 0000
0080: 0B00 0000 0C00 00000D00 0000 0E00 00000F00 0000 FF00 00001100 0000 1200 00001300 0000 1400 00001500 0000 1600 00001700 0000 1800 00001900 0000 1A00 0000
00C0: 1B00 0000 1C00 00001D00 0000 1E00 00001F00 0000 EE00 00002100 0000 2200 00002300 0000 2400 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
END
}
#latest:;
if (1) { #TCreateBlockArray #TBlockArray::push #TBlockArray::pop #TBlockArray::put #TBlockArray::get
my $c = Rb(0..255);
my $A = CreateByteString; my $a = $A->CreateBlockArray;
my $l = Vq(limit, 15);
my $L = $l + 5;
my sub put # Put a constant or a variable
{my ($e) = @_;
$a->push(element => (ref($e) ? $e : Vq($e, $e)));
};
my sub get # Get a constant or a variable
{my ($i) = @_;
$a->get(index=>(my $v = ref($i) ? $i : Vq(\'index\', $i)), my $e = Vq(element));
$v->out("index: ", " "); $e->outNL;
};
$l->for(sub # Loop to the limit pushing
{my ($index, $start, $next, $end) = @_;
put($index+1);
});
$l->for(sub # Loop to the limit getting
{my ($index, $start, $next, $end) = @_;
get($index);
});
put(16);
get(15);
$L->for(sub
{my ($index, $start, $next, $end) = @_;
put($index+$l+2);
});
$L->for(sub
{my ($index, $start, $next, $end) = @_;
get($index + $l + 1);
});
if (1)
{$a->put(my $i = Vq(\'index\', 9), my $e = Vq(element, 0xFFF9));
get(9);
}
if (1)
{$a->put(my $i = Vq(\'index\', 19), my $e = Vq(element, 0xEEE9));
get(19);
}
$a->dump;
($l+$L+1)->for(sub
{my ($i, $start, $next, $end) = @_;
$a->pop(my $e = Vq(element));
$e->outNL;
If (($e == 33)|($e == 32)|($e == 17)|($e == 16)|($e == 15)|($e == 14)|($e == 1)|($e == 0), sub
{$a->dump;
});
});
Vq(limit, 38)->for(sub # Push using a loop and reusing the freed space
{my ($index, $start, $next, $end) = @_;
$a->push(element=>$index*2);
});
$a->dump;
Vq(limit, 38)->for(sub # Push using a loop and reusing the freed space
{my ($index, $start, $next, $end) = @_;
$a->pop(my $e = Vq(element));
$e->outNL;
});
$a->dump;
ok Assemble(debug => 0, eq => <<END);
index: 0000 0000 0000 0000 element: 0000 0000 0000 0001
index: 0000 0000 0000 0001 element: 0000 0000 0000 0002
index: 0000 0000 0000 0002 element: 0000 0000 0000 0003
index: 0000 0000 0000 0003 element: 0000 0000 0000 0004
index: 0000 0000 0000 0004 element: 0000 0000 0000 0005
index: 0000 0000 0000 0005 element: 0000 0000 0000 0006
index: 0000 0000 0000 0006 element: 0000 0000 0000 0007
index: 0000 0000 0000 0007 element: 0000 0000 0000 0008
index: 0000 0000 0000 0008 element: 0000 0000 0000 0009
index: 0000 0000 0000 0009 element: 0000 0000 0000 000A
index: 0000 0000 0000 000A element: 0000 0000 0000 000B
index: 0000 0000 0000 000B element: 0000 0000 0000 000C
index: 0000 0000 0000 000C element: 0000 0000 0000 000D
index: 0000 0000 0000 000D element: 0000 0000 0000 000E
index: 0000 0000 0000 000E element: 0000 0000 0000 000F
index: 0000 0000 0000 000F element: 0000 0000 0000 0010
index: 0000 0000 0000 0010 element: 0000 0000 0000 0011
index: 0000 0000 0000 0011 element: 0000 0000 0000 0012
index: 0000 0000 0000 0012 element: 0000 0000 0000 0013
index: 0000 0000 0000 0013 element: 0000 0000 0000 0014
index: 0000 0000 0000 0014 element: 0000 0000 0000 0015
index: 0000 0000 0000 0015 element: 0000 0000 0000 0016
index: 0000 0000 0000 0016 element: 0000 0000 0000 0017
index: 0000 0000 0000 0017 element: 0000 0000 0000 0018
index: 0000 0000 0000 0018 element: 0000 0000 0000 0019
index: 0000 0000 0000 0019 element: 0000 0000 0000 001A
index: 0000 0000 0000 001A element: 0000 0000 0000 001B
index: 0000 0000 0000 001B element: 0000 0000 0000 001C
index: 0000 0000 0000 001C element: 0000 0000 0000 001D
index: 0000 0000 0000 001D element: 0000 0000 0000 001E
index: 0000 0000 0000 001E element: 0000 0000 0000 001F
index: 0000 0000 0000 001F element: 0000 0000 0000 0020
index: 0000 0000 0000 0020 element: 0000 0000 0000 0021
index: 0000 0000 0000 0021 element: 0000 0000 0000 0022
index: 0000 0000 0000 0022 element: 0000 0000 0000 0023
index: 0000 0000 0000 0023 element: 0000 0000 0000 0024
index: 0000 0000 0000 0009 element: 0000 0000 0000 FFF9
index: 0000 0000 0000 0013 element: 0000 0000 0000 EEE9
Block Array
Size: 0000 0000 0000 0024 zmm31: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 00D8 0000 0098 0000 0058 0000 0024
Full: 0000 0000 0000 0058 zmm30: 0000 0010 0000 000F 0000 000E 0000 000D 0000 000C 0000 000B 0000 FFF9 0000 0009 0000 0008 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0001
Full: 0000 0000 0000 0098 zmm30: 0000 0020 0000 001F 0000 001E 0000 001D 0000 001C 0000 001B 0000 001A 0000 0019 0000 0018 0000 0017 0000 0016 0000 0015 0000 EEE9 0000 0013 0000 0012 0000 0011
Last: 0000 0000 0000 00D8 zmm30: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0024 0000 0023 0000 0022 0000 0021
element: 0000 0000 0000 0024
element: 0000 0000 0000 0023
element: 0000 0000 0000 0022
element: 0000 0000 0000 0021
Block Array
Size: 0000 0000 0000 0020 zmm31: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0098 0000 0058 0000 0020
Full: 0000 0000 0000 0058 zmm30: 0000 0010 0000 000F 0000 000E 0000 000D 0000 000C 0000 000B 0000 FFF9 0000 0009 0000 0008 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0001
Full: 0000 0000 0000 0098 zmm30: 0000 0020 0000 001F 0000 001E 0000 001D 0000 001C 0000 001B 0000 001A 0000 0019 0000 0018 0000 0017 0000 0016 0000 0015 0000 EEE9 0000 0013 0000 0012 0000 0011
element: 0000 0000 0000 0020
Block Array
Size: 0000 0000 0000 001F zmm31: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0098 0000 0058 0000 001F
Full: 0000 0000 0000 0058 zmm30: 0000 0010 0000 000F 0000 000E 0000 000D 0000 000C 0000 000B 0000 FFF9 0000 0009 0000 0008 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0001
Last: 0000 0000 0000 0098 zmm30: 0000 0020 0000 001F 0000 001E 0000 001D 0000 001C 0000 001B 0000 001A 0000 0019 0000 0018 0000 0017 0000 0016 0000 0015 0000 EEE9 0000 0013 0000 0012 0000 0011
element: 0000 0000 0000 001F
element: 0000 0000 0000 001E
element: 0000 0000 0000 001D
element: 0000 0000 0000 001C
element: 0000 0000 0000 001B
element: 0000 0000 0000 001A
element: 0000 0000 0000 0019
element: 0000 0000 0000 0018
element: 0000 0000 0000 0017
element: 0000 0000 0000 0016
element: 0000 0000 0000 0015
element: 0000 0000 0000 EEE9
element: 0000 0000 0000 0013
element: 0000 0000 0000 0012
element: 0000 0000 0000 0011
Block Array
Size: 0000 0000 0000 0010 zmm31: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0058 0000 0010
Full: 0000 0000 0000 0058 zmm30: 0000 0010 0000 000F 0000 000E 0000 000D 0000 000C 0000 000B 0000 FFF9 0000 0009 0000 0008 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0001
element: 0000 0000 0000 0010
Block Array
Size: 0000 0000 0000 000F zmm31: 0000 000F 0000 000E 0000 000D 0000 000C 0000 000B 0000 FFF9 0000 0009 0000 0008 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0001 0000 000F
element: 0000 0000 0000 000F
Block Array
Size: 0000 0000 0000 000E zmm31: 0000 000F 0000 000E 0000 000D 0000 000C 0000 000B 0000 FFF9 0000 0009 0000 0008 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0001 0000 000E
element: 0000 0000 0000 000E
Block Array
Size: 0000 0000 0000 000D zmm31: 0000 000F 0000 000E 0000 000D 0000 000C 0000 000B 0000 FFF9 0000 0009 0000 0008 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0001 0000 000D
element: 0000 0000 0000 000D
element: 0000 0000 0000 000C
element: 0000 0000 0000 000B
element: 0000 0000 0000 FFF9
element: 0000 0000 0000 0009
element: 0000 0000 0000 0008
element: 0000 0000 0000 0007
element: 0000 0000 0000 0006
element: 0000 0000 0000 0005
element: 0000 0000 0000 0004
element: 0000 0000 0000 0003
element: 0000 0000 0000 0002
element: 0000 0000 0000 0001
Block Array
Size: 0000 0000 0000 0000 zmm31: 0000 000F 0000 000E 0000 000D 0000 000C 0000 000B 0000 FFF9 0000 0009 0000 0008 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0001 0000 0000
Block Array
Size: 0000 0000 0000 0026 zmm31: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 00D8 0000 0098 0000 0058 0000 0026
Full: 0000 0000 0000 0058 zmm30: 0000 001E 0000 001C 0000 001A 0000 0018 0000 0016 0000 0014 0000 0012 0000 0010 0000 000E 0000 000C 0000 000A 0000 0008 0000 0006 0000 0004 0000 0002 0000 0000
Full: 0000 0000 0000 0098 zmm30: 0000 003E 0000 003C 0000 003A 0000 0038 0000 0036 0000 0034 0000 0032 0000 0030 0000 002E 0000 002C 0000 002A 0000 0028 0000 0026 0000 0024 0000 0022 0000 0020
Last: 0000 0000 0000 00D8 zmm30: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 004A 0000 0048 0000 0046 0000 0044 0000 0042 0000 0040
element: 0000 0000 0000 004A
element: 0000 0000 0000 0048
element: 0000 0000 0000 0046
element: 0000 0000 0000 0044
element: 0000 0000 0000 0042
element: 0000 0000 0000 0040
element: 0000 0000 0000 003E
element: 0000 0000 0000 003C
element: 0000 0000 0000 003A
element: 0000 0000 0000 0038
element: 0000 0000 0000 0036
element: 0000 0000 0000 0034
element: 0000 0000 0000 0032
element: 0000 0000 0000 0030
element: 0000 0000 0000 002E
element: 0000 0000 0000 002C
element: 0000 0000 0000 002A
element: 0000 0000 0000 0028
element: 0000 0000 0000 0026
element: 0000 0000 0000 0024
element: 0000 0000 0000 0022
element: 0000 0000 0000 0020
element: 0000 0000 0000 001E
element: 0000 0000 0000 001C
element: 0000 0000 0000 001A
element: 0000 0000 0000 0018
element: 0000 0000 0000 0016
element: 0000 0000 0000 0014
element: 0000 0000 0000 0012
element: 0000 0000 0000 0010
element: 0000 0000 0000 000E
element: 0000 0000 0000 000C
element: 0000 0000 0000 000A
element: 0000 0000 0000 0008
element: 0000 0000 0000 0006
element: 0000 0000 0000 0004
element: 0000 0000 0000 0002
element: 0000 0000 0000 0000
Block Array
Size: 0000 0000 0000 0000 zmm31: 0000 001C 0000 001A 0000 0018 0000 0016 0000 0014 0000 0012 0000 0010 0000 000E 0000 000C 0000 000A 0000 0008 0000 0006 0000 0004 0000 0002 0000 0000 0000 0000
END
}
#exit if $develop;
#latest:;
if (1) { #TNasm::X86::ByteString::allocBlock #TNasm::X86::ByteString::freeBlock
my $a = CreateByteString; $a->dump;
my $b1 = $a->allocBlock; $a->dump;
my $b2 = $a->allocBlock; $a->dump;
$a->freeBlock($b2); $a->dump;
$a->freeBlock($b1); $a->dump;
ok Assemble(debug => 0, eq => <<END);
Byte String
Size: 0000 0000 0000 1000
Used: 0000 0000 0000 0018
0000: 0010 0000 0000 00001800 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
0040: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
0080: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
00C0: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
Byte String
Size: 0000 0000 0000 1000
Used: 0000 0000 0000 0058
0000: 0010 0000 0000 00005800 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
0040: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
0080: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
00C0: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
Byte String
Size: 0000 0000 0000 1000
Used: 0000 0000 0000 0098
0000: 0010 0000 0000 00009800 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
0040: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
0080: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
00C0: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
Byte String
Size: 0000 0000 0000 1000
Used: 0000 0000 0000 0098
0000: 0010 0000 0000 00009800 0000 0000 00005800 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
0040: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
0080: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
00C0: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
Byte String
Size: 0000 0000 0000 1000
Used: 0000 0000 0000 0098
0000: 0010 0000 0000 00009800 0000 0000 00001800 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
0040: 0000 0000 0000 00000000 0000 0000 00000000 0000 5800 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
0080: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
00C0: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
END
}
#latest:;
if (1) { #TCreateBlockArray #TBlockArray::push
my $c = Rb(0..255);
my $A = CreateByteString; my $a = $A->CreateBlockArray;
my sub put
{my ($e) = @_;
$a->push(element => Vq($e, $e));
};
my sub get
{my ($i) = @_; # Parameters
$a->get(my $v = Vq(\'index\', $i), my $e = Vq(element));
$v->out; PrintOutString " "; $e->outNL;
};
put($_) for 1..15; get(15);
ok Assemble(debug => 2, eq => <<END);
Index out of bounds on get from array, Index: 0000 0000 0000 000F Size: 0000 0000 0000 000F
END
}
#latest:
if (1) { #TExtern #TLink #TCallC
my $format = Rs "Hello %s\\n";
my $data = Rs "World";
Extern qw(printf exit malloc strcpy); Link \'c\';
CallC \'malloc\', length($format)+1;
Mov r15, rax;
CallC \'strcpy\', r15, $format;
CallC \'printf\', r15, $data;
CallC \'exit\', 0;
ok Assemble(eq => <<END);
Hello World
END
}
#latest:
if (1) {
my $a = Rb((reverse 0..16)x16);
my $b = Rb(( 0..16)x16);
KeepFree rax; Mov rax, $a; Vmovdqu8 zmm0, "[rax]";
KeepFree rax; Mov rax, $b; Vmovdqu8 zmm1, "[rax]";
Vpcmpeqb k0, zmm0, zmm1;
KeepFree rax; Kmovq rax, k0; Popcnt rax, rax;
PrintOutRegisterInHex zmm0, zmm1, k0, rax;
ok Assemble(eq => <<END);
zmm0: 0405 0607 0809 0A0B 0C0D 0E0F 1000 0102 0304 0506 0708 090A 0B0C 0D0E 0F10 0001 0203 0405 0607 0809 0A0B 0C0D 0E0F 1000 0102 0304 0506 0708 090A 0B0C 0D0E 0F10
zmm1: 0C0B 0A09 0807 0605 0403 0201 0010 0F0E 0D0C 0B0A 0908 0706 0504 0302 0100 100F 0E0D 0C0B 0A09 0807 0605 0403 0201 0010 0F0E 0D0C 0B0A 0908 0706 0504 0302 0100
k0: 0800 0400 0200 0100
rax: 0000 0000 0000 0004
END
}
#latest:
if (1) { # Insert key for BlockMultiWayTree
# 0000000001111111 A Length = k7
# .........1111000 B Greater = k6
# 0000000001111000 C = A&B = k5
# 0000000000000111 D = !C&A = k4
# 0000000011110000 E Shift left 1 C = K5
# 0000000011110111 F Want expand mask = E&D = k5&K4 ->k5
# 0000000000001000 G Want broadcast mask !F&A = K5!&k7->k6
Mov eax, 0x007f; Kmovw k7, eax;
Mov esi, 0x0F78; Kmovw k6, esi;
Kandw k5, k6, k7;
Kandnw k4, k5, k7;
Kshiftlw k5, k5, 1;
Korw k5, k4, k5;
Kandnw k6, k5, k7;
PrintOutRegisterInHex k7, k5, k6;
ok Assemble(eq => <<END);
k7: 0000 0000 0000 007F
k5: 0000 0000 0000 00F7
k6: 0000 0000 0000 0008
END
}
#latest:
if (1) { #TNasm::X86::ByteString::chain
my $format = Rd(map{4*$_+24} 0..64);
my $b = CreateByteString;
my $a = $b->allocBlock;
Vmovdqu8 zmm31, "[$format]";
$b->putBlock($b->bs, $a, 31);
my $r = $b->chain($b->bs, Vq(start, 0x18), 4); $r->outNL("chain1: ");
my $s = $b->chain($b->bs, $r, 4); $s->outNL("chain2: ");
my $t = $b->chain($b->bs, $s, 4); $t->outNL("chain3: ");
my $A = $b->chain($b->bs, Vq(start, 0x18), 4, 4, 4); $A->outNL("chain4: "); # Get a long chain
$b->putChain($b->bs, Vq(start, 0x18), Vq(end, 0xff), 4, 4, 4); # Put at the end of a long chain
$b->dump;
my $sub = Subroutine
{my ($p) = @_; # Parameters
If ($$p{c} == -1,
sub {PrintOutStringNL "C is minus one"},
sub {PrintOutStringNL "C is NOT minus one"},
);
If ($$p{d} == -1,
sub {PrintOutStringNL "D is minus one"},
sub {PrintOutStringNL "D is NOT minus one"},
);
my $C = $$p{c}->clone;
$C->outNL;
$$p{e} += 1;
$$p{e}->outNL(\'E: \');
$$p{f}->outNL(\'F1: \');
$$p{f}++;
$$p{f}->outNL(\'F2: \');
} name=> \'aaa\', in => {c => 3}, io => {d => 3, e => 3, f => 3};
my $c = Cq(c, -1);
my $d = Cq(d, -1);
my $e = Vq(e, 1);
my $f = Vq(f, 2);
$sub->call($c, $d, $e, $f);
$f->outNL(\'F3: \');
ok Assemble(debug => 0, eq => <<END);
chain1: 0000 0000 0000 001C
chain2: 0000 0000 0000 0020
chain3: 0000 0000 0000 0024
chain4: 0000 0000 0000 0024
Byte String
Size: 0000 0000 0000 1000
Used: 0000 0000 0000 0058
0000: 0010 0000 0000 00005800 0000 0000 00000000 0000 0000 00001800 0000 1C00 00002000 0000 FF00 00002800 0000 2C00 00003000 0000 3400 00003800 0000 3C00 0000
0040: 4000 0000 4400 00004800 0000 4C00 00005000 0000 5400 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
0080: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
00C0: 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
C is minus one
D is minus one
Clone of c: FFFF FFFF FFFF FFFF
E: 0000 0000 0000 0002
F1: 0000 0000 0000 0002
F2: 0000 0000 0000 0003
F3: 0000 0000 0000 0003
END
}
#latest:
if (1) { #TNasm::X86::ByteString::CreateBlockMultiWayTree #TLoadConstantIntoMaskRegister #TPopEax
Mov r14, 0;
Kmovq k0, r14;
KeepFree r14;
Ktestq k0, k0;
IfZ {PrintOutStringNL "0 & 0 == 0"};
PrintOutZF;
LoadConstantIntoMaskRegister k1, 1;
Ktestq k1, k1;
IfNz {PrintOutStringNL "1 & 1 != 0"};
PrintOutZF;
LoadConstantIntoMaskRegister k2, eval "0b".((\'1\'x4).(\'0\'x4))x2;
PrintOutRegisterInHex k0, k1, k2;
Mov r15, 0x89abcdef;
Mov r14, 0x01234567;
Shl r14, 32;
Or r15, r14;
Push r15;
Push r15;
KeepFree r15;
PopEax; PrintRaxInHex($stdout, 3); PrintOutNL; KeepFree rax;
my $a = Vq(\'aaaa\');
$a->pop;
$a->push;
$a->outNL;
PopEax; PrintRaxInHex($stdout, 3); PrintOutNL; KeepFree rax;
ok Assemble(debug => 0, eq => <<END);
0 & 0 == 0
ZF=1
1 & 1 != 0
ZF=0
k0: 0000 0000 0000 0000
k1: 0000 0000 0000 0001
k2: 0000 0000 0000 F0F0
89AB CDEF
aaaa: 89AB CDEF 0123 4567
0123 4567
END
}
#latest:
if (1) { #TNasm::X86::BlockMultiWayTree::splitFullLeftNode
my $Sk = Rd(17..28, 0, 0, 12, 0xFF);
my $Sd = Rd(17..28, 0, 0, 0xDD, 0xEE);
my $Sn = Rd(1..13, 0, 0, 0xCC);
my $sk = Rd(1..14, 14, 0xA1);
my $sd = Rd(1..14, 0xCC, 0xA2);
my $sn = Rd(1..15, 0xA3);
my $rk = Rd((0)x14, 14, 0xB1);
my $rd = Rd((0)x14, 0xCC, 0xB2);
my $rn = Rd((0)x15, 0xB3);
my $b = CreateByteString;
my $t = $b->CreateBlockMultiWayTree;
Vmovdqu8 zmm31, "[$Sk]";
Vmovdqu8 zmm30, "[$Sd]";
Vmovdqu8 zmm29, "[$Sn]";
Vmovdqu8 zmm28, "[$sk]";
Vmovdqu8 zmm27, "[$sd]";
Vmovdqu8 zmm26, "[$sn]";
Vmovdqu8 zmm25, "[$rk]";
Vmovdqu8 zmm24, "[$rd]";
Vmovdqu8 zmm23, "[$rn]";
$t->splitFullLeftNode($b->bs);
PrintOutRegisterInHex reverse zmm(23..31);
ok Assemble(debug => 0, eq => <<END);
zmm31: 0000 00FF 0000 000D 0000 0000 0000 0000 0000 001C 0000 001B 0000 001A 0000 0019 0000 0018 0000 0017 0000 0016 0000 0015 0000 0014 0000 0013 0000 0012 0000 0011
zmm30: 0000 00EE 0000 00DD 0000 0000 0000 0000 0000 001C 0000 001B 0000 001A 0000 0019 0000 0018 0000 0017 0000 0016 0000 0015 0000 0014 0000 0013 0000 0012 0000 0011
zmm29: 0000 00CC 0000 0000 0000 0000 0000 000D 0000 000C 0000 000B 0000 000A 0000 0009 0000 0008 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0001
zmm28: 0000 00A1 0000 0007 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0001
zmm27: 0000 00A2 0000 00CC 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0001
zmm26: 0000 00A3 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0001
zmm25: 0000 00B1 0000 0006 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 000E 0000 000D 0000 000C 0000 000B 0000 000A 0000 0009
zmm24: 0000 00B2 0000 00CC 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 000E 0000 000D 0000 000C 0000 000B 0000 000A 0000 0009
zmm23: 0000 00B3 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 000E 0000 000D 0000 000C 0000 000B 0000 000A 0000 0009
END
}
#latest:
if (1) { # Concatenate at end rather than insert in middle
my $tk = Rd(1, (0) x 13, 1, 0xC1);
my $td = Rd(1, (0) x 14, 0xC2);
my $tn = Rd(1, 0xAA, (0) x 13, 0xCC);
my $lk = Rd(1..14, 14, 0xA1);
my $ld = Rd(1..14, 0xCC, 0xA2);
my $ln = Rd(1..15, 0xAA);
my $rk = Rd((0)x14, 14, 0xB1);
my $rd = Rd((0)x14, 0xCC, 0xB2);
my $rn = Rd((0)x15, 0xBB);
my $b = CreateByteString;
my $t = $b->CreateBlockMultiWayTree;
Vmovdqu8 zmm31, "[$tk]";
Vmovdqu8 zmm30, "[$td]";
Vmovdqu8 zmm29, "[$tn]";
Vmovdqu8 zmm28, "[$lk]";
Vmovdqu8 zmm27, "[$ld]";
Vmovdqu8 zmm26, "[$ln]";
Vmovdqu8 zmm25, "[$rk]";
Vmovdqu8 zmm24, "[$rd]";
Vmovdqu8 zmm23, "[$rn]";
$t->splitFullLeftNode($b->bs);
PrintOutRegisterInHex reverse zmm(23..31);
ok Assemble(debug => 0, eq => <<END);
zmm31: 0000 00C1 0000 0002 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0008 0000 0001
zmm30: 0000 00C2 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0008 0000 0001
zmm29: 0000 00CC 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 00BB 0000 00AA 0000 0001
zmm28: 0000 00A1 0000 0007 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0001
zmm27: 0000 00A2 0000 00CC 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0001
zmm26: 0000 00AA 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0001
zmm25: 0000 00B1 0000 0006 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 000E 0000 000D 0000 000C 0000 000B 0000 000A 0000 0009
zmm24: 0000 00B2 0000 00CC 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 000E 0000 000D 0000 000C 0000 000B 0000 000A 0000 0009
zmm23: 0000 00BB 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 000E 0000 000D 0000 000C 0000 000B 0000 000A 0000 0009
END
}
#latest:
if (1) { #TNasm::X86::BlockMultiWayTree::splitFullRightNode
my $tk = Rd(1..12, 0, 0, 12, 0xC1);
my $td = Rd(1..12, 0, 0, 0, 0xC2);
my $tn = Rd(1, 0xBB, 3..13, 0, 0, 0xCC);
my $lk = Rd(17..30, 14, 0xA1);
my $ld = Rd(17..30, 0xCC, 0xA2);
my $ln = Rd(17..31, 0xAA);
my $rk = Rd(17..30, 14, 0xB1);
my $rd = Rd(17..30, 0xCC, 0xB2);
my $rn = Rd(17..31, 0xBB);
my $b = CreateByteString;
my $t = $b->CreateBlockMultiWayTree;
Vmovdqu8 zmm31, "[$tk]";
Vmovdqu8 zmm30, "[$td]";
Vmovdqu8 zmm29, "[$tn]";
Vmovdqu8 zmm28, "[$lk]";
Vmovdqu8 zmm27, "[$ld]";
Vmovdqu8 zmm26, "[$ln]";
Vmovdqu8 zmm25, "[$rk]";
Vmovdqu8 zmm24, "[$rd]";
Vmovdqu8 zmm23, "[$rn]";
$t->splitFullRightNode($b->bs);
PrintOutRegisterInHex reverse zmm(23..31);
ok Assemble(debug => 0, eq => <<END);
zmm31: 0000 00C1 0000 000D 0000 0000 0000 000C 0000 000B 0000 000A 0000 0009 0000 0008 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0018 0000 0001
zmm30: 0000 00C2 0000 0000 0000 0000 0000 000C 0000 000B 0000 000A 0000 0009 0000 0008 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0018 0000 0001
zmm29: 0000 00CC 0000 0000 0000 000D 0000 000C 0000 000B 0000 000A 0000 0009 0000 0008 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 00BB 0000 00AA 0000 0001
zmm28: 0000 00A1 0000 0007 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0017 0000 0016 0000 0015 0000 0014 0000 0013 0000 0012 0000 0011
zmm27: 0000 00A2 0000 00CC 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0017 0000 0016 0000 0015 0000 0014 0000 0013 0000 0012 0000 0011
zmm26: 0000 00AA 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0017 0000 0016 0000 0015 0000 0014 0000 0013 0000 0012 0000 0011
zmm25: 0000 00B1 0000 0006 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 001E 0000 001D 0000 001C 0000 001B 0000 001A 0000 0019
zmm24: 0000 00B2 0000 00CC 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 001E 0000 001D 0000 001C 0000 001B 0000 001A 0000 0019
zmm23: 0000 00BB 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 001E 0000 001D 0000 001C 0000 001B 0000 001A 0000 0019
END
}
#latest:
if (1) { # Insert at start rather than insert in middle
my $tk = Rd(1..12, 0, 0, 12, 0xC1);
my $td = Rd(1..12, 0, 0, 0, 0xC2);
my $tn = Rd(0xBB, 2, 3..13, 0, 0, 0xCC);
my $lk = Rd(17..30, 14, 0xA1);
my $ld = Rd(17..30, 0xCC, 0xA2);
my $ln = Rd(17..31, 0xAA);
my $rk = Rd(17..30, 14, 0xB1);
my $rd = Rd(17..30, 0xCC, 0xB2);
my $rn = Rd(17..31, 0xBB);
my $b = CreateByteString;
my $t = $b->CreateBlockMultiWayTree;
Vmovdqu8 zmm31, "[$tk]";
Vmovdqu8 zmm30, "[$td]";
Vmovdqu8 zmm29, "[$tn]";
Vmovdqu8 zmm28, "[$lk]";
Vmovdqu8 zmm27, "[$ld]";
Vmovdqu8 zmm26, "[$ln]";
Vmovdqu8 zmm25, "[$rk]";
Vmovdqu8 zmm24, "[$rd]";
Vmovdqu8 zmm23, "[$rn]";
$t->splitFullRightNode($b->bs);
PrintOutRegisterInHex reverse zmm(23..31);
ok Assemble(debug => 0, eq => <<END);
zmm31: 0000 00C1 0000 000D 0000 0000 0000 000C 0000 000B 0000 000A 0000 0009 0000 0008 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0001 0000 0018
zmm30: 0000 00C2 0000 0000 0000 0000 0000 000C 0000 000B 0000 000A 0000 0009 0000 0008 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0001 0000 0018
zmm29: 0000 00CC 0000 0000 0000 000D 0000 000C 0000 000B 0000 000A 0000 0009 0000 0008 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 00BB 0000 00AA
zmm28: 0000 00A1 0000 0007 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0017 0000 0016 0000 0015 0000 0014 0000 0013 0000 0012 0000 0011
zmm27: 0000 00A2 0000 00CC 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0017 0000 0016 0000 0015 0000 0014 0000 0013 0000 0012 0000 0011
zmm26: 0000 00AA 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0017 0000 0016 0000 0015 0000 0014 0000 0013 0000 0012 0000 0011
zmm25: 0000 00B1 0000 0006 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 001E 0000 001D 0000 001C 0000 001B 0000 001A 0000 0019
zmm24: 0000 00B2 0000 00CC 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 001E 0000 001D 0000 001C 0000 001B 0000 001A 0000 0019
zmm23: 0000 00BB 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 001E 0000 001D 0000 001C 0000 001B 0000 001A 0000 0019
END
}
#latest:
if (1) {
my $b = CreateByteString;
my $t = $b->CreateBlockMultiWayTree;
my $d = Vq(data);
my $f = Vq(found);
Vq(count, 24)->for(sub # 24
{my ($index, $start, $next, $end) = @_;
my $k = $index + 1; my $d = $k + 0x100;
$t->insert(key => $k, data => $d);
});
$t->getKeysDataNode($t->first, 31, 30, 29);
PrintOutStringNL "Root"; $t->first->outNL(\'First: \');
PrintOutRegisterInHex zmm31, zmm30, zmm29;
KeepFree zmm 26;
$t->getKeysDataNode(Vq(offset, 0xd8), 28,27,26);
PrintOutStringNL "Left";
PrintOutRegisterInHex zmm28, zmm27, zmm26;
KeepFree zmm 26;
$t->getKeysDataNode(Vq(offset, 0x258), 28,27,26);
PrintOutStringNL "Left";
PrintOutRegisterInHex zmm28, zmm27, zmm26;
KeepFree zmm 26;
$t->getKeysDataNode(Vq(offset, 0x198), 28,27,26);
PrintOutStringNL "Left";
PrintOutRegisterInHex zmm28, zmm27, zmm26;
$t->by(sub
{my ($iter, $end) = @_;
$iter->key ->out(\'key: \');
$iter->data->out(\' data: \');
$iter->tree->depth($iter->node, my $D = Vq(depth));
$t->find(key => $iter->key, $d, $f);
$f->out(\' found: \'); $d->out(\' data: \'); $D->outNL(\' depth: \');
});
$t->find(key => Vq(key, 0xffff), $d, $f); $f->outNL(\'Found: \');
$t->find(key => Vq(key, 0xd), $d, $f); $f->outNL(\'Found: \');
ok Assemble(debug => 0, eq => <<END);
Root
First: 0000 0000 0000 0018
zmm31: 0000 0058 0000 0002 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0010 0000 0008
zmm30: 0000 0098 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0110 0000 0108
zmm29: 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0198 0000 0258 0000 00D8
Left
zmm28: 0000 0118 0000 0007 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0001
zmm27: 0000 0158 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0107 0000 0106 0000 0105 0000 0104 0000 0103 0000 0102 0000 0101
zmm26: 0000 00D8 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
Left
zmm28: 0000 0298 0000 0007 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 000F 0000 000E 0000 000D 0000 000C 0000 000B 0000 000A 0000 0009
zmm27: 0000 02D8 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 010F 0000 010E 0000 010D 0000 010C 0000 010B 0000 010A 0000 0109
zmm26: 0000 0258 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
Left
zmm28: 0000 01D8 0000 0008 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0018 0000 0017 0000 0016 0000 0015 0000 0014 0000 0013 0000 0012 0000 0011
zmm27: 0000 0218 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0118 0000 0117 0000 0116 0000 0115 0000 0114 0000 0113 0000 0112 0000 0111
zmm26: 0000 0198 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
key: 0000 0000 0000 0001 data: 0000 0000 0000 0101 found: 0000 0000 0000 0001 data: 0000 0000 0000 0101 depth: 0000 0000 0000 0002
key: 0000 0000 0000 0002 data: 0000 0000 0000 0102 found: 0000 0000 0000 0001 data: 0000 0000 0000 0102 depth: 0000 0000 0000 0002
key: 0000 0000 0000 0003 data: 0000 0000 0000 0103 found: 0000 0000 0000 0001 data: 0000 0000 0000 0103 depth: 0000 0000 0000 0002
key: 0000 0000 0000 0004 data: 0000 0000 0000 0104 found: 0000 0000 0000 0001 data: 0000 0000 0000 0104 depth: 0000 0000 0000 0002
key: 0000 0000 0000 0005 data: 0000 0000 0000 0105 found: 0000 0000 0000 0001 data: 0000 0000 0000 0105 depth: 0000 0000 0000 0002
key: 0000 0000 0000 0006 data: 0000 0000 0000 0106 found: 0000 0000 0000 0001 data: 0000 0000 0000 0106 depth: 0000 0000 0000 0002
key: 0000 0000 0000 0007 data: 0000 0000 0000 0107 found: 0000 0000 0000 0001 data: 0000 0000 0000 0107 depth: 0000 0000 0000 0002
key: 0000 0000 0000 0008 data: 0000 0000 0000 0108 found: 0000 0000 0000 0001 data: 0000 0000 0000 0108 depth: 0000 0000 0000 0001
key: 0000 0000 0000 0009 data: 0000 0000 0000 0109 found: 0000 0000 0000 0001 data: 0000 0000 0000 0109 depth: 0000 0000 0000 0002
key: 0000 0000 0000 000A data: 0000 0000 0000 010A found: 0000 0000 0000 0001 data: 0000 0000 0000 010A depth: 0000 0000 0000 0002
key: 0000 0000 0000 000B data: 0000 0000 0000 010B found: 0000 0000 0000 0001 data: 0000 0000 0000 010B depth: 0000 0000 0000 0002
key: 0000 0000 0000 000C data: 0000 0000 0000 010C found: 0000 0000 0000 0001 data: 0000 0000 0000 010C depth: 0000 0000 0000 0002
key: 0000 0000 0000 000D data: 0000 0000 0000 010D found: 0000 0000 0000 0001 data: 0000 0000 0000 010D depth: 0000 0000 0000 0002
key: 0000 0000 0000 000E data: 0000 0000 0000 010E found: 0000 0000 0000 0001 data: 0000 0000 0000 010E depth: 0000 0000 0000 0002
key: 0000 0000 0000 000F data: 0000 0000 0000 010F found: 0000 0000 0000 0001 data: 0000 0000 0000 010F depth: 0000 0000 0000 0002
key: 0000 0000 0000 0010 data: 0000 0000 0000 0110 found: 0000 0000 0000 0001 data: 0000 0000 0000 0110 depth: 0000 0000 0000 0001
key: 0000 0000 0000 0011 data: 0000 0000 0000 0111 found: 0000 0000 0000 0001 data: 0000 0000 0000 0111 depth: 0000 0000 0000 0002
key: 0000 0000 0000 0012 data: 0000 0000 0000 0112 found: 0000 0000 0000 0001 data: 0000 0000 0000 0112 depth: 0000 0000 0000 0002
key: 0000 0000 0000 0013 data: 0000 0000 0000 0113 found: 0000 0000 0000 0001 data: 0000 0000 0000 0113 depth: 0000 0000 0000 0002
key: 0000 0000 0000 0014 data: 0000 0000 0000 0114 found: 0000 0000 0000 0001 data: 0000 0000 0000 0114 depth: 0000 0000 0000 0002
key: 0000 0000 0000 0015 data: 0000 0000 0000 0115 found: 0000 0000 0000 0001 data: 0000 0000 0000 0115 depth: 0000 0000 0000 0002
key: 0000 0000 0000 0016 data: 0000 0000 0000 0116 found: 0000 0000 0000 0001 data: 0000 0000 0000 0116 depth: 0000 0000 0000 0002
key: 0000 0000 0000 0017 data: 0000 0000 0000 0117 found: 0000 0000 0000 0001 data: 0000 0000 0000 0117 depth: 0000 0000 0000 0002
key: 0000 0000 0000 0018 data: 0000 0000 0000 0118 found: 0000 0000 0000 0001 data: 0000 0000 0000 0118 depth: 0000 0000 0000 0002
Found: 0000 0000 0000 0000
Found: 0000 0000 0000 0001
END
}
#latest:
if (1) {
for (0..7)
{ClearRegisters "k$_";
Cq($_,$_)->setMaskBit("k$_");
PrintOutRegisterInHex "k$_";
}
ok Assemble(debug => 0, eq => <<END);
k0: 0000 0000 0000 0001
k1: 0000 0000 0000 0002
k2: 0000 0000 0000 0004
k3: 0000 0000 0000 0008
k4: 0000 0000 0000 0010
k5: 0000 0000 0000 0020
k6: 0000 0000 0000 0040
k7: 0000 0000 0000 0080
END
}
#latest:
if (1) {
my $b = CreateByteString;
my $t = $b->CreateBlockMultiWayTree;
my $d = Vq(data);
my $f = Vq(found);
my $N = 24;
Vq(count, $N)->for(sub
{my ($index, $start, $next, $end) = @_;
if (1)
{my $k = $index * 2 + 1; my $d = $k + 0x100;
$t->insert(key => $k, data => $d);
}
if (1)
{my $k = $index * -2 + 2 * $N; my $d = $k + 0x100;
$t->insert(key => $k, data => $d);
}
});
$t->getKeysDataNode($t->first, 31, 30, 29);
PrintOutStringNL "Root"; $t->first->outNL(\'First: \');
PrintOutRegisterInHex zmm31, zmm30, zmm29;
KeepFree zmm 26;
$t->getKeysDataNode(Vq(offset, 0x258), 28,27,26);
PrintOutStringNL "Left";
PrintOutRegisterInHex zmm28, zmm27, zmm26;
KeepFree zmm 26;
$t->getKeysDataNode(Vq(offset, 0x3d8), 28,27,26);
PrintOutStringNL "Left";
PrintOutRegisterInHex zmm28, zmm27, zmm26;
KeepFree zmm 26;
$t->getKeysDataNode(Vq(offset, 0x318), 28,27,26);
PrintOutStringNL "Left";
PrintOutRegisterInHex zmm28, zmm27, zmm26;
KeepFree zmm 26;
$t->getKeysDataNode(Vq(offset, 0xd8), 28,27,26);
PrintOutStringNL "Left";
PrintOutRegisterInHex zmm28, zmm27, zmm26;
KeepFree zmm 26;
$t->getKeysDataNode(Vq(offset, 0x198), 28,27,26);
PrintOutStringNL "Left";
PrintOutRegisterInHex zmm28, zmm27, zmm26;
$t->find(key => Vq(key, 0xffff), $d, $f); $f->outNL(\'Found: \');
$t->find(key => Vq(key, 0x1b), $d, $f); $f->outNL(\'Found: \');
ok Assemble(debug => 0, eq => <<END);
Root
First: 0000 0000 0000 0018
zmm31: 0000 0058 0000 0004 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0024 0000 001A 0000 000F 0000 0008
zmm30: 0000 0098 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0124 0000 011A 0000 010F 0000 0108
zmm29: 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0198 0000 00D8 0000 0318 0000 03D8 0000 0258
Left
zmm28: 0000 0298 0000 0007 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0007 0000 0006 0000 0005 0000 0004 0000 0003 0000 0002 0000 0001
zmm27: 0000 02D8 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0107 0000 0106 0000 0105 0000 0104 0000 0103 0000 0102 0000 0101
zmm26: 0000 0258 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
Left
zmm28: 0000 0418 0000 0006 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 000E 0000 000D 0000 000C 0000 000B 0000 000A 0000 0009
zmm27: 0000 0458 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 010E 0000 010D 0000 010C 0000 010B 0000 010A 0000 0109
zmm26: 0000 03D8 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
Left
zmm28: 0000 0358 0000 000A 0000 0000 0000 0000 0000 0000 0000 0000 0000 0019 0000 0018 0000 0017 0000 0016 0000 0015 0000 0014 0000 0013 0000 0012 0000 0011 0000 0010
zmm27: 0000 0398 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0119 0000 0118 0000 0117 0000 0116 0000 0115 0000 0114 0000 0113 0000 0112 0000 0111 0000 0110
zmm26: 0000 0318 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
Left
zmm28: 0000 0118 0000 0009 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0023 0000 0022 0000 0021 0000 0020 0000 001F 0000 001E 0000 001D 0000 001C 0000 001B
zmm27: 0000 0158 0000 0018 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0123 0000 0122 0000 0121 0000 0120 0000 011F 0000 011E 0000 011D 0000 011C 0000 011B
zmm26: 0000 00D8 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
Left
zmm28: 0000 01D8 0000 000C 0000 0000 0000 0000 0000 0030 0000 002F 0000 002E 0000 002D 0000 002C 0000 002B 0000 002A 0000 0029 0000 0028 0000 0027 0000 0026 0000 0025
zmm27: 0000 0218 0000 0018 0000 0000 0000 0000 0000 0130 0000 012F 0000 012E 0000 012D 0000 012C 0000 012B 0000 012A 0000 0129 0000 0128 0000 0127 0000 0126 0000 0125
zmm26: 0000 0198 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
Found: 0000 0000 0000 0000
Found: 0000 0000 0000 0001
END
}
#latest:
if (1) { #TConvertUtf8ToUtf32
my @p = my ($out, $size, $fail) = (Vq(out), Vq(size), Vq(\'fail\'));
my $opens = Vq(opens);
my $class = Vq(class);
my $Chars = Rb(0x24, 0xc2, 0xa2, 0xc9, 0x91, 0xE2, 0x82, 0xAC, 0xF0, 0x90, 0x8D, 0x88);
my $chars = Vq(chars, $Chars);
GetNextUtf8CharAsUtf32 in=>$chars, @p; # Dollar UTF-8 Encoding: 0x24 UTF-32 Encoding: 0x00000024
$out->out(\'out1 : \'); $size->outNL(\' size : \');
GetNextUtf8CharAsUtf32 in=>$chars+1, @p; # Cents UTF-8 Encoding: 0xC2 0xA2 UTF-32 Encoding: 0x000000a2
$out->out(\'out2 : \'); $size->outNL(\' size : \');
GetNextUtf8CharAsUtf32 in=>$chars+3, @p; # Alpha UTF-8 Encoding: 0xC9 0x91 UTF-32 Encoding: 0x00000251
$out->out(\'out3 : \'); $size->outNL(\' size : \');
GetNextUtf8CharAsUtf32 in=>$chars+5, @p; # Euro UTF-8 Encoding: 0xE2 0x82 0xAC UTF-32 Encoding: 0x000020AC
$out->out(\'out4 : \'); $size->outNL(\' size : \');
GetNextUtf8CharAsUtf32 in=>$chars+8, @p; # Gothic Letter Hwair UTF-8 Encoding 0xF0 0x90 0x8D 0x88 UTF-32 Encoding: 0x00010348
$out->out(\'out5 : \'); $size->outNL(\' size : \');
my $statement = qq(ðÃÂÃÂú\\n ðÃÂÃÂÃÂðÃÂÃÂàðÃÂÃÂàðÃÂÃÂÃÂðÃÂÃÂÃÂðÃÂÃÂàãÃÂÃÂãÃÂÃÂðÃÂÃÂû ðÃÂÃÂéðÃÂÃÂÃ¥ðÃÂÃÂîðÃÂÃÂì ðÃÂÃÂüãÃÂÃÂãÃÂÃÂ\\nAAAAAAAA); # A sample sentence to parse
my $s = Cq(statement, Rs($statement));
my $l = Cq(size, length($statement));
AllocateMemory($l, my $address = Vq(address)); # Allocate enough memory for a copy of the string
CopyMemory(source => $s, target => $address, $l);
GetNextUtf8CharAsUtf32 in=>$address, @p;
$out->out(\'outA : \'); $size->outNL(\' size : \');
GetNextUtf8CharAsUtf32 in=>$address+4, @p;
$out->out(\'outB : \'); $size->outNL(\' size : \');
GetNextUtf8CharAsUtf32 in=>$address+5, @p;
$out->out(\'outC : \'); $size->outNL(\' size : \');
GetNextUtf8CharAsUtf32 in=>$address+30, @p;
$out->out(\'outD : \'); $size->outNL(\' size : \');
GetNextUtf8CharAsUtf32 in=>$address+35, @p;
$out->out(\'outE : \'); $size->outNL(\' size : \');
$address->printOutMemoryInHexNL($l);
Cq(\'newLine\', 0x0A)->putBIntoZmm(0, 0); # Single character classifications
Cq(\'newLine\', 0x01)->putBIntoZmm(0, 3);
Cq(\'space\', 0x20)->putBIntoZmm(0, 4);
Cq(\'space\', 0x02)->putBIntoZmm(0, 7);
if (1) # Classify a utf32 string
{my $a = Dd(0x0001d5ba, 0x00000020, 0x0001d44e, 0x0000000a, 0x0001d5bb, 0x0001d429);
my $t = Cq(\'test\', $a);
my $s = Cq(\'size\', 6);
ClassifyCharacters4 address=>$t, size=>$s;
PrintOutStringNL "Convert some utf8 to utf32";
$s->for(sub
{my ($index, $start, $next, $end) = @_;
my $a = $t+$index * 4;
$a->setReg(r15);
KeepFree r15;
Mov r15d, "[r15]";
KeepFree r15;
PrintOutRegisterInHex r15;
});
}
if (1) # Convert utf8 test string to utf32
{my @p = my ($u32, $size32, $count) = (Vq(u32), Vq(size32), Vq(count));
ConvertUtf8ToUtf32 u8 => $s, size8 => $l, @p;
ClassifyCharacters4 address=>$u32, size=>$count;
PrintOutStringNL "Convert test statement - special characters";
$count->for(sub
{my ($index, $start, $next, $end) = @_;
my $a = $u32 + $index * 4;
$a->setReg(r15);
KeepFree r15;
Mov r15d, "[r15]";
KeepFree r15;
PrintOutRegisterInHex r15;
});
Cq(\'variable\', 0x0) ->putDIntoZmm(0, 0); # Range classifications
Cq(\'variable\', 0x03) ->putBIntoZmm(0, 3);
Cq(\'variable\', 0x01D5A0)->putDIntoZmm(0, 4);
Cq(\'variable\', 0x04) ->putBIntoZmm(0, 7);
Cq(\'variable\', 0x01D434)->putDIntoZmm(0, 8);
Cq(\'variable\', 0x05) ->putBIntoZmm(0, 11);
Cq(\'variable\', 0x01D400)->putDIntoZmm(0, 12);
Cq(\'variable\', 0x06) ->putBIntoZmm(0, 15);
Cq(\'variable\', 0x7f) ->putDIntoZmm(1, 0);
Cq(\'variable\', 0x03) ->putBIntoZmm(1, 3);
Cq(\'variable\', 0x01D5D3)->putDIntoZmm(1, 4);
Cq(\'variable\', 0x04) ->putBIntoZmm(1, 7);
Cq(\'variable\', 0x01D467)->putDIntoZmm(1, 8);
Cq(\'variable\', 0x05) ->putBIntoZmm(1, 11);
Cq(\'variable\', 0x01D433)->putDIntoZmm(1, 12);
Cq(\'variable\', 0x06) ->putBIntoZmm(1, 15);
ClassifyInRange address=>$u32, size=>$count;
PrintOutStringNL "Convert test statement - ranges";
$count->for(sub
{my ($index, $start, $next, $end) = @_;
my $a = $u32 + $index * 4;
$a->setReg(r15);
KeepFree r15;
Mov r15d, "[r15]";
KeepFree r15;
PrintOutRegisterInHex r15;
});
my $bl = Rd(0x10002045, 0x12002329, 0x1400276c, 0x16002770, 0x1c0027e6, 0x24002983, 0x26002987, 0x380029fc, 0x3a003008, 0x3e003010, 0x40003014, 0x4800ff3b, 0x4900ff3d, 0x4a00ff5b, 0x4b00ff5d, 0);
my $bh = Rd(0x11002046, 0x1300232a, 0x1500276d, 0x1b002775, 0x230027ed, 0x25002984, 0x37002998, 0x390029fd, 0x3d00300b, 0x3f003011, 0x4700301b, 0x4800ff3b, 0x4900ff3d, 0x4a00ff5b, 0x4b00ff5d, 0);
Vmovdqu8 zmm0, "[$bl]";
Vmovdqu8 zmm1, "[$bh]";
ClassifyWithInRange address=>$u32, size=>$count;
PrintOutStringNL "Convert test statement - brackets";
$count->for(sub
{my ($index, $start, $next, $end) = @_;
my $a = $u32 + $index * 4;
$a->setReg(r15);
KeepFree r15;
Mov r15d, "[r15]";
KeepFree r15;
PrintOutRegisterInHex r15;
});
MatchBrackets address=>$u32, size=>$count, $opens, $fail;
PrintOutStringNL "Convert test statement - bracket matching";
$count->for(sub
{my ($index, $start, $next, $end) = @_;
my $a = $u32 + $index * 4;
$a->setReg(r15);
KeepFree r15;
Mov r15d, "[r15]";
KeepFree r15;
PrintOutRegisterInHex r15;
});
}
$address->clearMemory($l);
$address->printOutMemoryInHexNL($l);
ok Assemble(debug => 0, eq => <<END);
out1 : 0000 0000 0000 0024 size : 0000 0000 0000 0001
out2 : 0000 0000 0000 00A2 size : 0000 0000 0000 0002
out3 : 0000 0000 0000 0251 size : 0000 0000 0000 0002
out4 : 0000 0000 0000 20AC size : 0000 0000 0000 0003
out5 : 0000 0000 0001 0348 size : 0000 0000 0000 0004
outA : 0000 0000 0001 D5BA size : 0000 0000 0000 0004
outB : 0000 0000 0000 000A size : 0000 0000 0000 0001
outC : 0000 0000 0000 0020 size : 0000 0000 0000 0001
outD : 0000 0000 0000 0020 size : 0000 0000 0000 0001
outE : 0000 0000 0000 0010 size : 0000 0000 0000 0002
F09D 96BA 0A20 F09D918E F09D 91A0 F09D91A0 F09D 9196 F09D9194 F09D 919B 20E38090 E380 90F0 9D96BB20 F09D 90A9 F09D90A5 F09D 90AE F09D90AC 20F0 9D96 BCE38091 E380 910A 4141
Convert some utf8 to utf32
r15: 0000 0000 0001 D5BA
r15: 0000 0000 0200 0020
r15: 0000 0000 0001 D44E
r15: 0000 0000 0100 000A
r15: 0000 0000 0001 D5BB
r15: 0000 0000 0001 D429
Convert test statement - special characters
r15: 0000 0000 0001 D5BA
r15: 0000 0000 0100 000A
r15: 0000 0000 0200 0020
r15: 0000 0000 0001 D44E
r15: 0000 0000 0001 D460
r15: 0000 0000 0001 D460
r15: 0000 0000 0001 D456
r15: 0000 0000 0001 D454
r15: 0000 0000 0001 D45B
r15: 0000 0000 0200 0020
r15: 0000 0000 0000 3010
r15: 0000 0000 0000 3010
r15: 0000 0000 0001 D5BB
r15: 0000 0000 0200 0020
r15: 0000 0000 0001 D429
r15: 0000 0000 0001 D425
r15: 0000 0000 0001 D42E
r15: 0000 0000 0001 D42C
r15: 0000 0000 0200 0020
r15: 0000 0000 0001 D5BC
r15: 0000 0000 0000 3011
r15: 0000 0000 0000 3011
r15: 0000 0000 0100 000A
r15: 0000 0000 0000 0041
r15: 0000 0000 0000 0041
r15: 0000 0000 0000 0041
r15: 0000 0000 0000 0041
r15: 0000 0000 0000 0041
r15: 0000 0000 0000 0041
r15: 0000 0000 0000 0041
r15: 0000 0000 0000 0041
Convert test statement - ranges
r15: 0000 0000 0401 D5BA
r15: 0000 0000 0100 000A
r15: 0000 0000 0200 0020
r15: 0000 0000 0501 D44E
r15: 0000 0000 0501 D460
r15: 0000 0000 0501 D460
r15: 0000 0000 0501 D456
r15: 0000 0000 0501 D454
r15: 0000 0000 0501 D45B
r15: 0000 0000 0200 0020
r15: 0000 0000 0000 3010
r15: 0000 0000 0000 3010
r15: 0000 0000 0401 D5BB
r15: 0000 0000 0200 0020
r15: 0000 0000 0601 D429
r15: 0000 0000 0601 D425
r15: 0000 0000 0601 D42E
r15: 0000 0000 0601 D42C
r15: 0000 0000 0200 0020
r15: 0000 0000 0401 D5BC
r15: 0000 0000 0000 3011
r15: 0000 0000 0000 3011
r15: 0000 0000 0100 000A
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
Convert test statement - brackets
r15: 0000 0000 0401 D5BA
r15: 0000 0000 0100 000A
r15: 0000 0000 0200 0020
r15: 0000 0000 0501 D44E
r15: 0000 0000 0501 D460
r15: 0000 0000 0501 D460
r15: 0000 0000 0501 D456
r15: 0000 0000 0501 D454
r15: 0000 0000 0501 D45B
r15: 0000 0000 0200 0020
r15: 0000 0000 3E00 3010
r15: 0000 0000 3E00 3010
r15: 0000 0000 0401 D5BB
r15: 0000 0000 0200 0020
r15: 0000 0000 0601 D429
r15: 0000 0000 0601 D425
r15: 0000 0000 0601 D42E
r15: 0000 0000 0601 D42C
r15: 0000 0000 0200 0020
r15: 0000 0000 0401 D5BC
r15: 0000 0000 3F00 3011
r15: 0000 0000 3F00 3011
r15: 0000 0000 0100 000A
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
Convert test statement - bracket matching
r15: 0000 0000 0401 D5BA
r15: 0000 0000 0100 000A
r15: 0000 0000 0200 0020
r15: 0000 0000 0501 D44E
r15: 0000 0000 0501 D460
r15: 0000 0000 0501 D460
r15: 0000 0000 0501 D456
r15: 0000 0000 0501 D454
r15: 0000 0000 0501 D45B
r15: 0000 0000 0200 0020
r15: 0000 0000 3E00 0015
r15: 0000 0000 3E00 0014
r15: 0000 0000 0401 D5BB
r15: 0000 0000 0200 0020
r15: 0000 0000 0601 D429
r15: 0000 0000 0601 D425
r15: 0000 0000 0601 D42E
r15: 0000 0000 0601 D42C
r15: 0000 0000 0200 0020
r15: 0000 0000 0401 D5BC
r15: 0000 0000 3F00 000B
r15: 0000 0000 3F00 000A
r15: 0000 0000 0100 000A
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
r15: 0000 0000 0300 0041
0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000
END
}
#latest:
if (0) {
is_deeply Assemble(debug=>1), <<END;
END
}
ok 1;
unlink $_ for qw(hash print2 sde-log.txt sde-ptr-check.out.txt z.txt); # Remove incidental files
lll "Finished:", time - $start, "bytes assembled:", totalBytesAssembled;
' called at /usr/home/cpansand/.cpan/build/2021063005/Nasm-X86-20210629-0/blib/lib/Nasm/X86.pm line 13512
Nasm::X86::test() called at test.pl line 10
test.pl .. skipped: Nasm or Intel 64 emulator not available
Files=1, Tests=0, 1 wallclock secs ( 0.02 usr 0.00 sys + 0.41 cusr 0.08 csys = 0.52 CPU)
Result: NOTESTS
------------------------------
PREREQUISITES
------------------------------
Prerequisite modules loaded:
requires:
Module Need Have
----------------- ------ --------
Asm::C 0 20210330
Carp 0 1.50
Data::Dump 0 1.25
Data::Table::Text 0 20210518
feature 0 1.54
Test2::API 0 1.302185
Test::More 0 1.302185
Test::Most 0 0.37
configure_requires:
Module Need Have
----------------- ------ --------
Module::Build 0.4224 0.4231
------------------------------
ENVIRONMENT AND OTHER CONTEXT
------------------------------
Environment variables:
PATH = /usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/cpansand/bin/sh:/home/cpansand/bin:/usr/games:/home/cpansand/devel:/usr/home/eserte/src/srezic-misc/scripts
PERL5LIB =
PERL5OPT =
PERL5_CPANPLUS_IS_RUNNING = 36375
PERL5_CPAN_IS_RUNNING = 36375
PERL5_CPAN_IS_RUNNING_IN_RECURSION = 35862,36375
PERL_BATCH = yes
PERL_CANARY_STABILITY_NOPROMPT = 1
PERL_CPAN_REPORTER_CONFIG = /var/tmp/cpansmoker-1023/2021063005/cpanreporter_000_config.ini
PERL_EXTUTILS_AUTOINSTALL = --defaultdeps
PERL_USE_UNSAFE_INC = 1
SHELL = /bin/sh
TMPDIR = /var/tmp/cpansmoker-1023/2021063005
Perl special variables (and OS-specific diagnostics, for MSWin32):
$^X = /usr/perl5.30.3p/bin/perl
$UID/$EUID = 1023 / 1023
$GID = 1023 1023
$EGID = 1023 1023
Perl module toolchain versions installed:
Module Have
------------------- --------
CPAN 2.22
CPAN::Meta 2.150010
Cwd 3.78
ExtUtils::CBuilder 0.280231
ExtUtils::Command 7.62
ExtUtils::Install 2.20
ExtUtils::MakeMaker 7.62
ExtUtils::Manifest 1.72
ExtUtils::ParseXS 3.40
File::Spec 3.78
JSON 4.03
JSON::PP 4.06
Module::Build 0.4231
Module::Signature n/a
Parse::CPAN::Meta 2.150010
Test::Harness 3.42
Test::More 1.302185
YAML 1.30
YAML::Syck 1.34
version 0.9924
--
Summary of my perl5 (revision 5 version 30 subversion 3) configuration:
Platform:
osname=freebsd
osvers=14.0-current
archname=amd64-freebsd
uname='freebsd cloud2.bbbike.org 14.0-current freebsd 14.0-current #12 main-n246644-9674c2e68c6: thu may 13 22:18:45 utc 2021 root@cloud2.bbbike.org:usrobjusrhomeprojectsfreebsdamd64.amd64sysgeneric amd64 '
config_args='-ds -e -Dprefix=/usr/perl5.30.3p -Dcf_email=srezic@cpan.org -Doptimize=-O2 -pipe'
hint=recommended
useposix=true
d_sigaction=define
useithreads=undef
usemultiplicity=undef
use64bitint=define
use64bitall=define
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
bincompat5005=undef
Compiler:
cc='cc'
ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
optimize='-O2 -pipe'
cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
ccversion=''
gccversion='FreeBSD Clang 11.0.1 (git@github.com:llvm/llvm-project.git llvmorg-11.0.1-0-g43ff75f2c3fe)'
gccosandvers=''
intsize=4
longsize=8
ptrsize=8
doublesize=8
byteorder=12345678
doublekind=3
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=16
longdblkind=3
ivtype='long'
ivsize=8
nvtype='double'
nvsize=8
Off_t='off_t'
lseeksize=8
alignbytes=8
prototype=define
Linker and Libraries:
ld='cc'
ldflags ='-pthread -Wl,-E -fstack-protector-strong -L/usr/local/lib'
libpth=/usr/lib /usr/local/lib /usr/lib/clang/11.0.1/lib /usr/lib
libs=-lpthread -lgdbm -ldl -lm -lcrypt -lutil -lc
perllibs=-lpthread -ldl -lm -lcrypt -lutil -lc
libc=
so=so
useshrplib=false
libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs
dlext=so
d_dlsymun=undef
ccdlflags=' '
cccdlflags='-DPIC -fPIC'
lddlflags='-shared -L/usr/local/lib -fstack-protector-strong'
Characteristics of this binary (from libperl):
Compile-time options:
HAS_TIMES
PERLIO_LAYERS
PERL_COPY_ON_WRITE
PERL_DONT_CREATE_GVSV
PERL_MALLOC_WRAP
PERL_OP_PARENT
PERL_PRESERVE_IVUV
USE_64_BIT_ALL
USE_64_BIT_INT
USE_LARGE_FILES
USE_LOCALE
USE_LOCALE_COLLATE
USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC
USE_LOCALE_TIME
USE_PERLIO
USE_PERL_ATOF
Built under freebsd
Compiled at May 16 2021 12:37:52
%ENV:
PERL5LIB=""
PERL5OPT=""
PERL5_CPANPLUS_IS_RUNNING="36375"
PERL5_CPAN_IS_RUNNING="36375"
PERL5_CPAN_IS_RUNNING_IN_RECURSION="35862,36375"
PERL_BATCH="yes"
PERL_CANARY_STABILITY_NOPROMPT="1"
PERL_CPAN_REPORTER_CONFIG="/var/tmp/cpansmoker-1023/2021063005/cpanreporter_000_config.ini"
PERL_EXTUTILS_AUTOINSTALL="--defaultdeps"
PERL_USE_UNSAFE_INC="1"
@INC:
/usr/perl5.30.3p/lib/site_perl/5.30.3/amd64-freebsd
/usr/perl5.30.3p/lib/site_perl/5.30.3
/usr/perl5.30.3p/lib/5.30.3/amd64-freebsd
/usr/perl5.30.3p/lib/5.30.3
.