blib/lib/Simd/Avx512.pm

filter: Statementstmt 90.6% 368 / 406 Branchbran 72.9% 124 / 170 Conditioncond 44.4% 36 / 81 MC/DCmcdc 21.2% 10 / 47 Subroutinesub 82.8% 87 / 105 Podpod 62.2% 51 / 82 totaltotal 75.8% 676 / 891 CC 128 SCAR 16.9
CC
128
Cov
80%
require8or16or32or64
30.0
vpcmpeq
13.0
byte
12.0
CRAP 5.4
↑ Summary
1 #!/usr/bin/perl -I/home/phil/perl/cpan/DataTableText/lib/
2 #-------------------------------------------------------------------------------
3 # Simd::Avx512 - Emulate SIMD Avx512 instructions
4 # Philip R Brenan at appaapps dot com, Appa Apps Ltd Inc., 2021
5 #-------------------------------------------------------------------------------
6 # podDocumentation
7 package Simd::Avx512;
8 1 our $VERSION = 20210130;
9 1 ▶use warnings FATAL => qw(all);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Data::Dump qw(dump);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use feature qw(say current_sub);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 my $develop = -e q(/home/phil/); # Development mode
16  
17 sub repeat($$) # Repeat a string
18 412 ▶ {my ($string, $repeat) = @_; # String to repeat, number of repetitions
Subroutine repeat: called CC=1 SCAR=0.0
Pod undocumented
19 412 $string x $repeat
20 }
21  
22 159 ▶sub zByte {repeat('0', 8)} # Zero byte
Subroutine zByte: called CC=1 SCAR=0.0
Pod undocumented
23 0 ▶sub zWord {repeat('0', 16)} # Zero word
Subroutine zWord: not called CC=1 SCAR=6.9
Pod undocumented
24 0 ▶sub zDWord {repeat('0', 32)} # Zero double word
Subroutine zDWord: not called CC=1 SCAR=6.9
Pod undocumented
25 90 ▶sub zQWord {repeat('0', 64)} # Zero quad word
Subroutine zQWord: called CC=1 SCAR=0.0
Pod undocumented
26  
27 sub zBytes($) # String of zero bytes of specified length
28 159 ▶ {my ($length) = @_; # Length
Subroutine zBytes: called CC=1 SCAR=0.0
Pod undocumented
29 159 repeat(zByte, $length)
30 }
31  
32 sub zWords($) # String of zero words of specified length
33 0 ▶ {my ($length) = @_; # Length
Subroutine zWords: not called CC=1 SCAR=6.9
Pod undocumented
34 0 repeat(zWord, $length)
35 }
36  
37 sub zDWords($) # String of zero double words of specified length
38 0 ▶ {my ($length) = @_; # Length
Subroutine zDWords: not called CC=1 SCAR=6.9
Pod undocumented
39 0 repeat(zDWord, $length)
40 }
41  
42 sub zQWords($) # String of zero quad words of specified length
43 0 ▶ {my ($length) = @_; # Length
Subroutine zQWords: not called CC=1 SCAR=6.9
Pod undocumented
44 0 repeat(zQWord, $length)
45 }
46  
47 sub byte($) # A byte with the specified value
48 0 ▶ {my ($value) = @_; # Value of the byte
Subroutine byte: not called CC=3 SCAR=24.8
Pod undocumented
49 0 ▶ confess "0 - 2**8 required ($value)" unless $value >= 0 and $value < 2**8;
Branch: 1 branch
BranchTrueFalseTotal
unless $value >= 0 and $value < 256 0 0 0
Condition0%0/3
$value >= 0 and $value < 256
!ll&&!rl&&r
000
MC/DC0%0/2
$value >= 0 and $value < 256
$value >= 0 $value < 256
Truth table0%0/3
A and B
A= $value >= 0B= $value < 256
ABresult
0X0
100
111
50 0 sprintf("%08b", $value)
51 }
52  
53 sub word($) # A word with the specified value
54 0 ▶ {my ($value) = @_; # Value of the word
Subroutine word: not called CC=3 SCAR=24.8
Pod undocumented
55 0 ▶ confess "0 - 2**16 required ($value)" unless $value >= 0 and $value < 2**16;
Branch: 1 branch
BranchTrueFalseTotal
unless $value >= 0 and $value < 65536 0 0 0
Condition0%0/3
$value >= 0 and $value < 65536
!ll&&!rl&&r
000
MC/DC0%0/2
$value >= 0 and $value < 65536
$value >= 0 $value < 65536
Truth table0%0/3
A and B
A= $value >= 0B= $value < 65536
ABresult
0X0
100
111
56 0 sprintf("%016b", $value)
57 }
58  
59 sub dWord($) # A double word with the specified value
60 0 ▶ {my ($value) = @_; # Value of the double word
Subroutine dWord: not called CC=3 SCAR=24.8
Pod undocumented
61 0 ▶ confess "0 - 2**32 required ($value)" unless $value >= 0 and $value < 2**32;
Branch: 1 branch
BranchTrueFalseTotal
unless $value >= 0 and $value < "4294967296" 0 0 0
Condition0%0/3
$value >= 0 and $value < "4294967296"
!ll&&!rl&&r
000
MC/DC0%0/2
$value >= 0 and $value < "4294967296"
$value >= 0 $value < "4294967296"
Truth table0%0/3
A and B
A= $value >= 0B= $value < "4294967296"
ABresult
0X0
100
111
62 0 sprintf("%032b", $value)
63 }
64  
65 sub qWord($) # A quad word with the specified value
66 0 ▶ {my ($value) = @_; # Value of the quad word
Subroutine qWord: not called CC=3 SCAR=24.8
Pod undocumented
67 0 ▶ confess "0 - 2**64 required ($value)" unless $value >= 0 and $value < 2**64;
Branch: 1 branch
BranchTrueFalseTotal
unless $value >= 0 and $value < "1.84467440737096e+19" 0 0 0
Condition0%0/3
$value >= 0 and $value < "1.84467440737096e+19"
!ll&&!rl&&r
000
MC/DC0%0/2
$value >= 0 and $value < "1.84467440737096e+19"
$value >= 0 $value < "1.84467440737096e+19"
Truth table0%0/3
A and B
A= $value >= 0B= $value < "1.84467440737096e+19"
ABresult
0X0
100
111
68 0 sprintf("%064b", $value)
69 }
70  
71 90 ▶sub maskRegister {zQWord} # Mask register set to zero
Subroutine maskRegister: called CC=1 SCAR=0.0
Pod undocumented
72  
73 sub require8or16or32or64($) # Check that we have a size of 8|16|32|64 bits
74 0 ▶ {my ($size) = @_; # Size to check
Subroutine require8or16or32or64: not called CC=5 SCAR=34.0
Pod undocumented
75 0 ▶ confess "8|16|32|64 required for operand ($size)" unless $size == 8 or $size == 16 or $size == 32 or $size == 64;
Branch: 1 branch
BranchTrueFalseTotal
unless $size == 8 or $size == 16 or $size == 32 or $size == 64 0 0 0
Condition0%0/9
$size == 8 or $size == 16 or $size == 32 or $size == 64
l!l&&r!l&&!r
000
$size == 8 or $size == 16 or $size == 32
l!l&&r!l&&!r
000
$size == 8 or $size == 16
l!l&&r!l&&!r
000
MC/DC0%0/4
$size == 8 or $size == 16 or $size == 32 or $size == 64
$size == 8 $size == 16 $size == 32 $size == 64
Truth table0%0/5
A or B or C or D
A= $size == 8B= $size == 16C= $size == 32D= $size == 64
ABCDresult
1XXX1
01XX1
001X1
00011
00000
76 }
77  
78 sub requireN($$) # Check that we have a string of N bits
79 110 ▶ {my ($size, $xmm) = @_; # Size in bits, bits
Subroutine requireN: called CC=4 SCAR=14.6
Pod undocumented
80 110 ▶ defined($xmm) or confess;
Branch: 1 branch
BranchTrueFalseTotal
defined $xmm or confess() 110 0 110
81 110 my $l = length $xmm;
82 110 ▶ confess "$size bits required for operand ($l)" unless $l == $size;
Branch: 1 branch
BranchTrueFalseTotal
unless $l == $size 0 110 110
83 110 ▶ confess "Only zeros and ones allowed in operand" unless $xmm =~ m(\A[01]+\Z);
Branch: 1 branch
BranchTrueFalseTotal
unless $xmm =~ /\A[01]+\Z/ 0 110 110
84 }
85  
86 sub require8($) # Check that we have a string of 8 bits
87 2 ▶ {my ($xmm) = @_; # Byte
Subroutine require8: called CC=1 SCAR=0.0
Pod undocumented
88 2 requireN(8, $xmm);
89 }
90  
91 sub require16($) # Check that we have a string of 16 bits
92 2 ▶ {my ($xmm) = @_; # Word
Subroutine require16: called CC=1 SCAR=0.0
Pod undocumented
93 2 requireN(16, $xmm);
94 }
95  
96 sub require32($) # Check that we have a string of 32 bits
97 2 ▶ {my ($xmm) = @_; # DWord
Subroutine require32: called CC=1 SCAR=0.0
Pod undocumented
98 2 requireN(32, $xmm);
99 }
100  
101 sub require64($) # Check that we have a string of 64 bits
102 62 ▶ {my ($xmm) = @_; # Bytes
Subroutine require64: called CC=1 SCAR=0.0
Pod undocumented
103 62 requireN(64, $xmm);
104 }
105  
106 sub require128($) # Check that we have a string of 128 bits
107 42 ▶ {my ($xmm) = @_; # Word
Subroutine require128: called CC=1 SCAR=0.0
Pod undocumented
108 42 requireN(128, $xmm);
109 }
110  
111 sub require256($) # Check that we have a string of 256 bits
112 0 ▶ {my ($xmm) = @_; # Dword
Subroutine require256: not called CC=1 SCAR=6.9
Pod undocumented
113 0 requireN(256, $xmm);
114 }
115  
116 sub require512($) # Check that we have a string of 512 bits
117 0 ▶ {my ($xmm) = @_; # Qword
Subroutine require512: not called CC=1 SCAR=6.9
Pod undocumented
118 0 requireN(128, $xmm);
119 }
120  
121 sub require128or256or512($;$) # Check that we have a string of 128|256|512 bits in the first operand and optionally the same in the second operand
122 108 ▶ {my ($xmm1, $xmm2) = @_; # Bytes, optional bytes
Subroutine require128or256or512: called CC=9 SCAR=22.5
Pod undocumented
123 108 my $l = length $xmm1;
124 108 ▶ confess "128|256|512 bits required for first operand ($l)" unless $l == 128 or $l == 256 or $l == 512;
Branch: 1 branch
BranchTrueFalseTotal
unless $l == 128 or $l == 256 or $l == 512 0 108 108
Condition83%5/6
$l == 128 or $l == 256 or $l == 512
l!l&&r!l&&!r
49590
$l == 128 or $l == 256
l!l&&r!l&&!r
40959
MC/DC0%0/3
$l == 128 or $l == 256 or $l == 512
$l == 128 $l == 256 $l == 512
Truth table75%3/4
A or B or C
A= $l == 128B= $l == 256C= $l == 512
ABCresult
1XX1
01X1
0011
0000
125 108 ▶ if (defined $xmm2)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $xmm2) 96 12 108
126 96 {my $m = length $xmm2;
127 96 ▶ confess "128|256|512 bits required for second operand ($m)" unless $m == 128 or $m == 256 or $m == 512;
Branch: 1 branch
BranchTrueFalseTotal
unless $m == 128 or $m == 256 or $m == 512 0 96 96
Condition83%5/6
$m == 128 or $m == 256 or $m == 512
l!l&&r!l&&!r
45510
$m == 128 or $m == 256
l!l&&r!l&&!r
38751
MC/DC0%0/3
$m == 128 or $m == 256 or $m == 512
$m == 128 $m == 256 $m == 512
Truth table75%3/4
A or B or C
A= $m == 128B= $m == 256C= $m == 512
ABCresult
1XX1
01X1
0011
0000
128 96 ▶ confess "Operands must have same length($l,$m)" unless $l == $m;
Branch: 1 branch
BranchTrueFalseTotal
unless $l == $m 0 96 96
129 }
130 $l
131 108 }
132  
133 sub require64or128or256or512($) # Check that we have a string of 64|128|256|512 bits
134 3 ▶ {my ($xmm) = @_; # Bytes
Subroutine require64or128or256or512: called CC=6 SCAR=22.8
Pod undocumented
135 3 my $l = length $xmm;
136 3 ▶ confess "64|128|256|512 bits required for operand" unless $l == 64 or $l == 128 or $l == 256 or $l == 512;
Branch: 1 branch
BranchTrueFalseTotal
unless $l == 64 or $l == 128 or $l == 256 or $l == 512 0 3 3
Condition33%3/9
$l == 64 or $l == 128 or $l == 256 or $l == 512
l!l&&r!l&&!r
300
$l == 64 or $l == 128 or $l == 256
l!l&&r!l&&!r
300
$l == 64 or $l == 128
l!l&&r!l&&!r
300
MC/DC0%0/4
$l == 64 or $l == 128 or $l == 256 or $l == 512
$l == 64 $l == 128 $l == 256 $l == 512
Truth table20%1/5
A or B or C or D
A= $l == 64B= $l == 128C= $l == 256D= $l == 512
ABCDresult
1XXX1
01XX1
001X1
00011
00000
137 3 ▶ confess "Only zeros and ones allowed in operand" unless $xmm =~ m(\A[01]+\Z);
Branch: 1 branch
BranchTrueFalseTotal
unless $xmm =~ /\A[01]+\Z/ 0 3 3
138 }
139  
140 sub requireSameLength($$) # Check that the two operands have the same length
141 448 ▶ {my ($xmm1, $xmm2) = @_; # Bytes, bytes
Subroutine requireSameLength: called CC=2 SCAR=7.0
Pod undocumented
142 448 my ($l, $L) = (length($xmm1), length($xmm2));
143 448 ▶ confess "Operands have different lengths($l, $L)" unless $l == $L;
Branch: 1 branch
BranchTrueFalseTotal
unless $l == $L 0 448 448
144 448 $l
145 }
146  
147 sub requireNumber128or256or512($) # Check that we have a number with a value of 128|256|512
148 4 ▶ {my ($n) = @_; # Number
Subroutine requireNumber128or256or512: called CC=4 SCAR=17.9
Pod undocumented
149 4 ▶ confess "128|256|512 required for operand" unless $n == 128 or $n == 256 or $n == 512;
Branch: 1 branch
BranchTrueFalseTotal
unless $n == 128 or $n == 256 or $n == 512 0 4 4
Condition33%2/6
$n == 128 or $n == 256 or $n == 512
l!l&&r!l&&!r
040
$n == 128 or $n == 256
l!l&&r!l&&!r
004
MC/DC0%0/3
$n == 128 or $n == 256 or $n == 512
$n == 128 $n == 256 $n == 512
Truth table25%1/4
A or B or C
A= $n == 128B= $n == 256C= $n == 512
ABCresult
1XX1
01X1
0011
0000
150 }
151  
152 sub flipBitsUnderMask($$) # Flip the bits in a string where the corresponding mask bit is 1 else leave the bit as is
153 29 ▶ {my ($string, $mask) = @_; # Bit string, mask
Subroutine flipBitsUnderMask: called CC=4 SCAR=13.9
Pod undocumented
154 29 my $l = requireSameLength $string, $mask;
155 29 my $f = '';
156 29 for my $i(0..$l-1) # Each character in the string and mask
157 1636 {my $s = substr($string, $i, 1);
158 1636 ▶ $f .= substr($mask, $i, 1) eq '0' ? $s : $s eq '0' ? '1' : '0'
Branch: 2 branches
BranchTrueFalseTotal
substr($mask, $i, 1) eq '0' ? : 1468 168 1636
$s eq '0' ? : 105 63 168
159 }
160 $f
161 29 }
162  
163 sub compareTwosComplement($$) # Compare two numbers in two's complement formats and return -1 if the first number is less than the second, 0 if they are equal, else +1
164 103 ▶ {my ($a, $b) = @_; # First, second
Subroutine compareTwosComplement: called CC=10 SCAR=23.0
Pod undocumented
165 103 my $n = requireSameLength $a, $b;
166  
167 103 ▶ return -1 if substr($a, 0, 1) eq '1' and substr($b, 0, 1) eq '0'; # Leading sign bit
Branch: 1 branch
BranchTrueFalseTotal
if substr($a, 0, 1) eq 1 and substr($b, 0, 1) eq 0 15 88 103
Condition100%3/3
substr($a, 0, 1) eq 1 and substr($b, 0, 1) eq 0
!ll&&!rl&&r
701815
MC/DC100%2/2
substr($a, 0, 1) eq 1 and substr($b, 0, 1) eq 0
substr($a, 0, 1) eq 1 substr($b, 0, 1) eq 0
Truth table100%3/3
A and B
A= substr($a, 0, 1) eq 1B= substr($b, 0, 1) eq 0
ABresult
0X0
100
111
168 88 ▶ return +1 if substr($a, 0, 1) eq '0' and substr($b, 0, 1) eq '1';
Branch: 1 branch
BranchTrueFalseTotal
if substr($a, 0, 1) eq 0 and substr($b, 0, 1) eq 1 7 81 88
Condition100%3/3
substr($a, 0, 1) eq 0 and substr($b, 0, 1) eq 1
!ll&&!rl&&r
18637
MC/DC100%2/2
substr($a, 0, 1) eq 0 and substr($b, 0, 1) eq 1
substr($a, 0, 1) eq 0 substr($b, 0, 1) eq 1
Truth table100%3/3
A and B
A= substr($a, 0, 1) eq 0B= substr($b, 0, 1) eq 1
ABresult
0X0
100
111
169  
170 81 for(1..$n) # Non sign bits
171 701 ▶ {return -1 if substr($a, $_, 1) eq '0' and substr($b, $_, 1) eq '1';
Branch: 1 branch
BranchTrueFalseTotal
if substr($a, $_, 1) eq 0 and substr($b, $_, 1) eq 1 10 691 701
Condition100%3/3
substr($a, $_, 1) eq 0 and substr($b, $_, 1) eq 1
!ll&&!rl&&r
14055110
MC/DC100%2/2
substr($a, $_, 1) eq 0 and substr($b, $_, 1) eq 1
substr($a, $_, 1) eq 0 substr($b, $_, 1) eq 1
Truth table100%3/3
A and B
A= substr($a, $_, 1) eq 0B= substr($b, $_, 1) eq 1
ABresult
0X0
100
111
172 691 ▶ return +1 if substr($a, $_, 1) eq '1' and substr($b, $_, 1) eq '0';
Branch: 1 branch
BranchTrueFalseTotal
if substr($a, $_, 1) eq 1 and substr($b, $_, 1) eq 0 18 673 691
Condition100%3/3
substr($a, $_, 1) eq 1 and substr($b, $_, 1) eq 0
!ll&&!rl&&r
6046918
MC/DC100%2/2
substr($a, $_, 1) eq 1 and substr($b, $_, 1) eq 0
substr($a, $_, 1) eq 1 substr($b, $_, 1) eq 0
Truth table100%3/3
A and B
A= substr($a, $_, 1) eq 1B= substr($b, $_, 1) eq 0
ABresult
0X0
100
111
173 }
174 0 # Equal
175 53 }
176  
177 #D1 Instructions # Emulation of Avx512 instructions
178  
179 sub PSLLDQ($$) # Packed Shift Left Logical DoubleQword
180 8 ▶ {my ($xmm1, $imm8) = @_; # Bytes, length of shift in bytes
Subroutine PSLLDQ: called CC=1 SCAR=0.0
Pod documented
181 8 require128 $xmm1; # Check that we have a string of 128 bits
182 8 substr($xmm1, $imm8 * 8).zBytes($imm8)
183 }
184  
185 sub VPSLLDQ($$) # Packed Shift Left Logical DoubleQword
186 3 ▶ {my ($xmm1, $imm8) = @_; # Bytes, length of shift in bytes
Subroutine VPSLLDQ: called CC=5 SCAR=16.5
Pod documented
187 3 require128or256or512 $xmm1; # Check that we have a string of 128 bits
188 3 ▶ confess "0 - 15 for shift amount required" unless $imm8 >= 0 and $imm8 < 16;
Branch: 1 branch
BranchTrueFalseTotal
unless $imm8 >= 0 and $imm8 < 16 0 3 3
Condition33%1/3
$imm8 >= 0 and $imm8 < 16
!ll&&!rl&&r
003
MC/DC0%0/2
$imm8 >= 0 and $imm8 < 16
$imm8 >= 0 $imm8 < 16
Truth table33%1/3
A and B
A= $imm8 >= 0B= $imm8 < 16
ABresult
0X0
100
111
189  
190 3 ▶ return PSLLDQ($xmm1, $imm8) if length($xmm1) == 128;
Branch: 1 branch
BranchTrueFalseTotal
if length $xmm1 == 128 1 2 3
191  
192 2 ▶ return PSLLDQ(substr($xmm1, 0, 128), $imm8).
Branch: 1 branch
BranchTrueFalseTotal
if length $xmm1 == 256 1 1 2
193 PSLLDQ(substr($xmm1, 128, 128), $imm8) if length($xmm1) == 256;
194  
195 1 return PSLLDQ(substr($xmm1, 0, 128), $imm8).
196 PSLLDQ(substr($xmm1, 128, 128), $imm8).
197 PSLLDQ(substr($xmm1, 256, 128), $imm8).
198 PSLLDQ(substr($xmm1, 384, 128), $imm8)
199 }
200  
201 sub PSRLDQ($$) # Packed Shift Right Logical DoubleQword
202 18 ▶ {my ($xmm1, $imm8) = @_; # Bytes, length of shift
Subroutine PSRLDQ: called CC=1 SCAR=0.0
Pod documented
203 18 require128 $xmm1; # Check that we have a string of 128 bits
204 18 zBytes($imm8).substr($xmm1, 0, 128 - $imm8 * 8)
205 }
206  
207 sub VPSRLDQ($$) # Packed Shift Right Logical DoubleQword
208 3 ▶ {my ($xmm1, $imm8) = @_; # Bytes, length of shift
Subroutine VPSRLDQ: called CC=5 SCAR=16.5
Pod documented
209 3 require128or256or512 $xmm1; # Check that we have a string of 128 bits
210 3 ▶ confess "0 - 15 for shift amount required" unless $imm8 >= 0 and $imm8 < 16;
Branch: 1 branch
BranchTrueFalseTotal
unless $imm8 >= 0 and $imm8 < 16 0 3 3
Condition33%1/3
$imm8 >= 0 and $imm8 < 16
!ll&&!rl&&r
003
MC/DC0%0/2
$imm8 >= 0 and $imm8 < 16
$imm8 >= 0 $imm8 < 16
Truth table33%1/3
A and B
A= $imm8 >= 0B= $imm8 < 16
ABresult
0X0
100
111
211  
212 3 ▶ return PSRLDQ($xmm1, $imm8) if length($xmm1) == 128;
Branch: 1 branch
BranchTrueFalseTotal
if length $xmm1 == 128 1 2 3
213  
214 2 ▶ return PSRLDQ(substr($xmm1, 0, 128), $imm8).
Branch: 1 branch
BranchTrueFalseTotal
if length $xmm1 == 256 1 1 2
215 PSRLDQ(substr($xmm1, 128, 128), $imm8) if length($xmm1) == 256;
216  
217 1 return PSRLDQ(substr($xmm1, 0, 128), $imm8).
218 PSRLDQ(substr($xmm1, 128, 128), $imm8).
219 PSRLDQ(substr($xmm1, 256, 128), $imm8).
220 PSRLDQ(substr($xmm1, 384, 128), $imm8)
221 }
222  
223 #D1 PCMP # Packed CoMPare
224 #D2 PCMPEQ # Packed CoMPare EQual
225  
226 sub pcmpeq($$$) #P Packed CoMPare EQual
227 4 ▶ {my ($size, $xmm1, $xmm2) = @_; # Size in bits, element, element
Subroutine pcmpeq: called CC=4 SCAR=13.9
Pod documented
228  
229 4 ▶ require8or16or32or64 $size if $develop; # We supply this parameter so we ought to get it right
Branch: 1 branch
BranchTrueFalseTotal
if $develop 0 4 4
230 4 require128 $xmm1; # Check that we have a string of 128 bits in the first operand
231 4 require128 $xmm2; # Check that we have a string of 128 bits in the second operand
232 4 requireSameLength $xmm1, $xmm2; # Check operands have the same length
233  
234 4 my $N = 128 / $size; # Bytes in operation
235 4 my $clear = '0' x $size;
236 4 my $set = '1' x $size;
237 4 my $xmm3 = zBytes $N;
238 4 for(0..$N-1)
239 30 {my $o = $_ * $size;
240 30 ▶ substr($xmm3, $o, $size) =
Branch: 1 branch
BranchTrueFalseTotal
substr($xmm1, $o, $size) eq substr($xmm2, $o, $size) ? : 18 12 30
241 substr($xmm1, $o, $size) eq
242 substr($xmm2, $o, $size) ? $set : $clear;
243 }
244 $xmm3
245 4 }
246  
247 sub PCMPEQB($$) # Packed CoMPare EQual Byte
248 1 ▶ {my ($xmm1, $xmm2) = @_; # Bytes, bytes
Subroutine PCMPEQB: called CC=1 SCAR=0.0
Pod documented
249 1 pcmpeq 8, $xmm1, $xmm2;
250 }
251  
252 sub PCMPEQW($$) # Packed CoMPare EQual Word
253 1 ▶ {my ($xmm1, $xmm2) = @_; # Words, words
Subroutine PCMPEQW: called CC=1 SCAR=0.0
Pod documented
254 1 pcmpeq 16, $xmm1, $xmm2;
255 }
256  
257 sub PCMPEQD($$) # Packed CoMPare EQual DWord
258 1 ▶ {my ($xmm1, $xmm2) = @_; # DWords, DWords
Subroutine PCMPEQD: called CC=1 SCAR=0.0
Pod documented
259 1 pcmpeq 32, $xmm1, $xmm2;
260 }
261  
262 sub PCMPEQQ($$) # Packed CoMPare EQual QWord
263 1 ▶ {my ($xmm1, $xmm2) = @_; # QWords, QWords
Subroutine PCMPEQQ: called CC=1 SCAR=0.0
Pod documented
264 1 pcmpeq 64, $xmm1, $xmm2;
265 }
266  
267 #D2 PCMPGT # Packed CoMPare Greater Than
268  
269 sub pcmpgt($$$) #P Packed CoMPare Greater Than
270 4 ▶ {my ($size, $xmm1, $xmm2) = @_; # Size in bits, element, element
Subroutine pcmpgt: called CC=4 SCAR=13.9
Pod documented
271  
272 4 ▶ require8or16or32or64 $size if $develop; # We supply this parameter so we ought to get it right
Branch: 1 branch
BranchTrueFalseTotal
if $develop 0 4 4
273 4 require128 $xmm1; # Check that we have a string of 128 bits in the first operand
274 4 require128 $xmm2; # Check that we have a string of 128 bits in the second operand
275 4 requireSameLength $xmm1, $xmm2; # Check operands have the same length
276  
277 4 my $N = 128 / $size; # Bytes in operation
278 4 my $clear = '0' x $size;
279 4 my $set = '1' x $size;
280 4 my $xmm3 = zBytes $N;
281 4 for(0..$N-1)
282 30 {my $o = $_ * $size;
283 30 ▶ substr($xmm3, $o, $size) = +1 == compareTwosComplement( # Signed compare
Branch: 1 branch
BranchTrueFalseTotal
1 == &compareTwosComplement(substr($xmm1, $o, $size), substr($xmm2, $o, $size)) ? : 11 19 30
284 substr($xmm1, $o, $size),
285 substr($xmm2, $o, $size)) ? $set : $clear;
286 }
287 $xmm3
288 4 }
289  
290 sub PCMPGTB($$) # Packed CoMPare Greater Than Byte
291 1 ▶ {my ($xmm1, $xmm2) = @_; # Bytes, bytes
Subroutine PCMPGTB: called CC=1 SCAR=0.0
Pod documented
292 1 pcmpgt 8, $xmm1, $xmm2;
293 }
294  
295 sub PCMPGTW($$) # Packed CoMPare Greater Than Word
296 1 ▶ {my ($xmm1, $xmm2) = @_; # Words, words
Subroutine PCMPGTW: called CC=1 SCAR=0.0
Pod documented
297 1 pcmpgt 16, $xmm1, $xmm2;
298 }
299  
300 sub PCMPGTD($$) # Packed CoMPare Greater Than DWord
301 1 ▶ {my ($xmm1, $xmm2) = @_; # DWords, DWords
Subroutine PCMPGTD: called CC=1 SCAR=0.0
Pod documented
302 1 pcmpgt 32, $xmm1, $xmm2;
303 }
304  
305 sub PCMPGTQ($$) # Packed CoMPare Greater Than QWord
306 1 ▶ {my ($xmm1, $xmm2) = @_; # QWords, QWords
Subroutine PCMPGTQ: called CC=1 SCAR=0.0
Pod documented
307 1 pcmpgt 64, $xmm1, $xmm2;
308 }
309  
310 #D1 VPCMP # Packed CoMPare
311 #D2 VPCMPEQ # Packed CoMPare EQual
312  
313 sub vpcmpeq($$$;$) #P Packed CoMPare EQual Byte|word|double|quad with optional masking
314 5 ▶ {my ($size, $k2, $xmm1, $xmm2) = @_; # Size in bits: 8|16|32|64 of each element, optional input mask, bytes, bytes
Subroutine vpcmpeq: called CC=13 SCAR=25.7
Pod documented
315  
316 5 ▶ require8or16or32or64 $size if $develop; # We supply this parameter so we ought to get it right
Branch: 1 branch
BranchTrueFalseTotal
if $develop 0 5 5
317 5 ▶ require64or128or256or512 $k2 if defined $k2; # Optional mask
Branch: 1 branch
BranchTrueFalseTotal
if defined $k2 3 2 5
318 5 require128or256or512 $xmm1, $xmm2; # Check that we have a string of 128 bits in the first operand
319  
320 5 my $N = length($xmm1) / $size; # Bytes|Words|Doubles|Quads in operation
321 5 ▶ if (defined $k2) # Masked operation
Branch: 1 branch
BranchTrueFalseTotal
if (defined $k2) 3 2 5
322 3 {my $k1 = maskRegister; # Result register
323 3 ▶ $k2 = substr($k2, 48) if $N == 16; # Relevant portion of register
Branch: 1 branch
BranchTrueFalseTotal
if $N == 16 1 2 3
324 3 ▶ $k2 = substr($k2, 32) if $N == 32;
Branch: 1 branch
BranchTrueFalseTotal
if $N == 32 1 2 3
325 3 for(0..$N-1)
326 112 ▶ {next unless substr($k2, $_, 1) eq '1';
Branch: 1 branch
BranchTrueFalseTotal
unless substr($k2, $_, 1) eq 1 96 16 112
327 16 my $o = $_ * $size;
328 16 ▶ substr($k1, $_, 1) = substr($xmm1, $o, $size) eq
Branch: 1 branch
BranchTrueFalseTotal
substr($xmm1, $o, $size) eq substr($xmm2, $o, $size) ? : 13 3 16
329 substr($xmm2, $o, $size) ? '1' : '0';
330 }
331 3 ▶ return zBytes(6).substr($k1, 0, 16) if $N == 16;
Branch: 1 branch
BranchTrueFalseTotal
if $N == 16 1 2 3
332 2 ▶ return zBytes(4).substr($k1, 0, 32) if $N == 32;
Branch: 1 branch
BranchTrueFalseTotal
if $N == 32 1 1 2
333 1 return $k1
334 }
335  
336 2 my $xmm3 = zBytes $N; # Non masked operation
337 2 my $clear = '0' x $size;
338 2 my $set = '1' x $size;
339 2 for(0..$N-1)
340 48 {my $o = $_ * $size;
341 48 ▶ substr($xmm3, $o, $size) = substr($xmm1, $o, $size) eq
Branch: 1 branch
BranchTrueFalseTotal
substr($xmm1, $o, $size) eq substr($xmm2, $o, $size) ? : 36 12 48
342 substr($xmm2, $o, $size) ? $set : $clear
343 }
344 $xmm3
345 2 }
346  
347 sub VPCMPEQB($$;$) # Packed CoMPare EQual Byte with optional masking
348 5 ▶ {my ($k2, $xmm1, $xmm2) = @_ == 3 ? @_ : (undef, @_); # Optional input mask, bytes, bytes
Subroutine VPCMPEQB: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ == 3 ? : 3 2 5
349 5 vpcmpeq(8, $k2, $xmm1, $xmm2)
350 }
351  
352 sub VPCMPEQW($$;$) # Packed CoMPare EQual Byte with optional masking
353 0 ▶ {my ($k2, $xmm1, $xmm2) = @_ == 3 ? @_ : (undef, @_); # Optional input mask, words, words
Subroutine VPCMPEQW: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ == 3 ? : 0 0 0
354 0 vpcmpeq(16, $k2, $xmm1, $xmm2)
355 }
356  
357 sub VPCMPEQD($$;$) # Packed CoMPare EQual Byte with optional masking
358 0 ▶ {my ($k2, $xmm1, $xmm2) = @_ == 3 ? @_ : (undef, @_); # Optional input mask, dwords, dwords
Subroutine VPCMPEQD: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ == 3 ? : 0 0 0
359 0 vpcmpeq(32, $k2, $xmm1, $xmm2)
360 }
361  
362 sub VPCMPEQQ($$;$) # Packed CoMPare EQual Byte with optional masking
363 0 ▶ {my ($k2, $xmm1, $xmm2) = @_ == 3 ? @_ : (undef, @_); # Optional input mask, qwords, qwords
Subroutine VPCMPEQQ: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ == 3 ? : 0 0 0
364 0 vpcmpeq(64, $k2, $xmm1, $xmm2)
365 }
366  
367 #D2 VPCMP # Packed CoMPare
368  
369 sub vpcmp($$$$$) #P Packed CoMPare
370 10 ▶ {my ($size, $k2, $xmm1, $xmm2, $op) = @_; # Size of element in bits, input mask, bytes, bytes, test code
Subroutine vpcmp: called CC=6 SCAR=17.9
Pod documented
371  
372 10 ▶ require8or16or32or64 $size if $develop; # We supply this parameter so we ought to get it right
Branch: 1 branch
BranchTrueFalseTotal
if $develop 0 10 10
373 10 require64 $k2; # Mask
374 10 require128or256or512 $xmm1, $xmm2; # Check that we have a string of 128 bits in the first operand
375 10 ▶ confess "Invalid op code $op" unless $op =~ m(\A(0|1|2|4|5|6)\Z); # Test code
Branch: 1 branch
BranchTrueFalseTotal
unless $op =~ /\A(0|1|2|4|5|6)\Z/ 0 10 10
376  
377 my $T = # String tests
378 16 ▶ [sub {return 1 if compareTwosComplement($_[0], $_[1]) == 0; 0}, # eq 0
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if &compareTwosComplement($_[0], $_[1]) == 0 10 6 16
379 8 ▶ sub {return 1 if compareTwosComplement($_[0], $_[1]) == -1; 0}, # lt 1
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if &compareTwosComplement($_[0], $_[1]) == -1 3 5 8
380 8 ▶ sub {return 1 if compareTwosComplement($_[0], $_[1]) != +1; 0}, # le 2
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if &compareTwosComplement($_[0], $_[1]) != 1 7 1 8
381 undef,
382 16 ▶ sub {return 1 if compareTwosComplement($_[0], $_[1]) != 0; 0}, # ne 4
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if &compareTwosComplement($_[0], $_[1]) != 0 6 10 16
383 8 ▶ sub {return 1 if compareTwosComplement($_[0], $_[1]) != -1; 0}, # ge 5
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if &compareTwosComplement($_[0], $_[1]) != -1 5 3 8
384 8 ▶ sub {return 1 if compareTwosComplement($_[0], $_[1]) == +1; 0}, # gt 6
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if &compareTwosComplement($_[0], $_[1]) == 1 1 7 8
385 10 ];
386  
387 10 my $N = length($xmm1) / $size; # Number of elements
388 10 my $k1 = maskRegister;
389 10 $k2 = substr($k2, -$N); # Relevant portion of mask
390 10 for(0..$N-1)
391 480 ▶ {next unless substr($k2, $_, 1) eq '1'; # Mask
Branch: 1 branch
BranchTrueFalseTotal
unless substr($k2, $_, 1) eq 1 416 64 480
392 64 my $o = $_ * $size;
393 64 ▶ substr($k1, $_, 1) = &{$$T[$op]}(substr($xmm1, $o, $size), # Compare according to code
Branch: 1 branch
BranchTrueFalseTotal
&{$T->[$op];}(substr($xmm1, $o, $size), substr($xmm2, $o, $size)) ? : 32 32 64
394 substr($xmm2, $o, $size)) ? '1' : '0';
395 }
396  
397 10 substr(zBytes(8).substr($k1, 0, $N), -64)
398 }
399  
400 sub VPCMPB($$$$) # Packed CoMPare Byte
401 10 ▶ {my ($k2, $xmm1, $xmm2, $op) = @_; # Input mask, bytes, bytes, test code
Subroutine VPCMPB: called CC=1 SCAR=0.0
Pod documented
402 10 vpcmp 8, $k2, $xmm1, $xmm2, $op
403 }
404  
405 sub VPCMPW($$$$) # Packed CoMPare Word
406 0 ▶ {my ($k2, $xmm1, $xmm2, $op) = @_; # Input mask, words, words, test code
Subroutine VPCMPW: not called CC=1 SCAR=6.9
Pod documented
407 0 vpcmp 16, $k2, $xmm1, $xmm2, $op
408 }
409  
410 sub VPCMPD($$$$) # Packed CoMPare Dword
411 0 ▶ {my ($k2, $xmm1, $xmm2, $op) = @_; # Input mask, dwords, dwords, test code
Subroutine VPCMPD: not called CC=1 SCAR=6.9
Pod documented
412 0 vpcmp 32, $k2, $xmm1, $xmm2, $op
413 }
414  
415 sub VPCMPQ($$$$) # Packed CoMPare Qword
416 0 ▶ {my ($k2, $xmm1, $xmm2, $op) = @_; # Input mask, qwords, qwords, test code
Subroutine VPCMPQ: not called CC=1 SCAR=6.9
Pod documented
417 0 vpcmp 64, $k2, $xmm1, $xmm2, $op
418 }
419  
420 #D2 VPCMPU # Packed CoMPare Unsigned
421  
422 sub vpcmpu($$$$$) #P Packed CoMPare Unsigned
423 46 ▶ {my ($size, $k2, $xmm1, $xmm2, $op) = @_; # Size of element in bits, input mask, bytes, bytes, test code
Subroutine vpcmpu: called CC=6 SCAR=17.9
Pod documented
424  
425 46 ▶ require8or16or32or64 $size if $develop; # We supply this parameter so we ought to get it right
Branch: 1 branch
BranchTrueFalseTotal
if $develop 0 46 46
426 46 require64 $k2; # Mask
427 46 require128or256or512 $xmm1, $xmm2; # Check that we have a string of 128 bits in the first operand
428 46 ▶ confess "Invalid op code $op" unless $op =~ m(\A(0|1|2|4|5|6)\Z); # Test code
Branch: 1 branch
BranchTrueFalseTotal
unless $op =~ /\A(0|1|2|4|5|6)\Z/ 0 46 46
429  
430 my $T = # String tests
431 50 ▶ [sub {return 1 if $_[0] eq $_[1]; 0}, # eq 0
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] eq $_[1] 18 32 50
432 42 ▶ sub {return 1 if $_[0] lt $_[1]; 0}, # lt 1
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] lt $_[1] 13 29 42
433 42 ▶ sub {return 1 if $_[0] le $_[1]; 0}, # le 2
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] le $_[1] 25 17 42
434 undef,
435 50 ▶ sub {return 1 if $_[0] ne $_[1]; 0}, # ne 4
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] ne $_[1] 32 18 50
436 42 ▶ sub {return 1 if $_[0] ge $_[1]; 0}, # ge 5
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] ge $_[1] 29 13 42
437 42 ▶ sub {return 1 if $_[0] gt $_[1]; 0}, # gt 6
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] gt $_[1] 17 25 42
438 46 ];
439  
440 46 my $N = length($xmm1) / $size; # Number of elements
441 46 my $k1 = maskRegister;
442 46 $k2 = substr($k2, -$N); # Relevant portion of mask
443 46 for(0..$N-1)
444 1152 ▶ {next unless substr($k2, $_, 1) eq '1'; # Mask
Branch: 1 branch
BranchTrueFalseTotal
unless substr($k2, $_, 1) eq 1 884 268 1152
445 268 my $o = $_ * $size;
446 268 ▶ substr($k1, $_, 1) = &{$$T[$op]}(substr($xmm1, $o, $size), # Compare according to code
Branch: 1 branch
BranchTrueFalseTotal
&{$T->[$op];}(substr($xmm1, $o, $size), substr($xmm2, $o, $size)) ? : 134 134 268
447 substr($xmm2, $o, $size)) ? '1' : '0';
448 }
449  
450 46 substr(zBytes(8).substr($k1, 0, $N), -64)
451 }
452  
453 sub VPCMPUB($$$$) # Packed CoMPare Unsigned Byte
454 10 ▶ {my ($k2, $xmm1, $xmm2, $op) = @_; # Input mask, bytes, bytes, test code
Subroutine VPCMPUB: called CC=1 SCAR=0.0
Pod documented
455 10 vpcmpu 8, $k2, $xmm1, $xmm2, $op
456 }
457  
458 sub VPCMPUW($$$$) # Packed CoMPare Unsigned Word
459 12 ▶ {my ($k2, $xmm1, $xmm2, $op) = @_; # Input mask, words, words, test code
Subroutine VPCMPUW: called CC=1 SCAR=0.0
Pod documented
460 12 vpcmpu 16, $k2, $xmm1, $xmm2, $op
461 }
462  
463 sub VPCMPUD($$$$) # Packed CoMPare Unsigned Dword
464 12 ▶ {my ($k2, $xmm1, $xmm2, $op) = @_; # Input mask, dwords, dwords, test code
Subroutine VPCMPUD: called CC=1 SCAR=0.0
Pod documented
465 12 vpcmpu 32, $k2, $xmm1, $xmm2, $op
466 }
467  
468 sub VPCMPUQ($$$$) # Packed CoMPare Unsigned Qword
469 12 ▶ {my ($k2, $xmm1, $xmm2, $op) = @_; # Input mask, qwords, qwords, test code
Subroutine VPCMPUQ: called CC=1 SCAR=0.0
Pod documented
470 12 vpcmpu 64, $k2, $xmm1, $xmm2, $op
471 }
472  
473 #D1 VPTEST # Packed TEST
474 #D2 VPTESTM # Packed TEST MASK
475  
476 sub andAndTest($$) #P And two bit strings of the same length and return 0 if the result is 0 else 1
477 308 ▶ {my ($a, $b) = @_; # Element, element
Subroutine andAndTest: called CC=4 SCAR=13.9
Pod documented
478 308 my $N = requireSameLength $a, $b; # Check that the two elements have the same length
479 308 for(0..$N-1) # Look for match
480 4113 ▶ {return 1 if substr($a, $_, 1) eq '1' and substr($b, $_, 1) eq '1';
Branch: 1 branch
BranchTrueFalseTotal
if substr($a, $_, 1) eq 1 and substr($b, $_, 1) eq 1 60 4053 4113
Condition100%3/3
substr($a, $_, 1) eq 1 and substr($b, $_, 1) eq 1
!ll&&!rl&&r
39698460
MC/DC100%2/2
substr($a, $_, 1) eq 1 and substr($b, $_, 1) eq 1
substr($a, $_, 1) eq 1 substr($b, $_, 1) eq 1
Truth table100%3/3
A and B
A= substr($a, $_, 1) eq 1B= substr($b, $_, 1) eq 1
ABresult
0X0
100
111
481 }
482 0
483 248 }
484  
485 sub vptest($$$) #P Packed TEST
486 31 ▶ {my ($size, $xmm1, $xmm2) = @_; # Size of element in bits, element, element
Subroutine vptest: called CC=4 SCAR=13.9
Pod documented
487  
488 31 ▶ require8or16or32or64 $size if $develop; # We supply this parameter so we ought to get it right
Branch: 1 branch
BranchTrueFalseTotal
if $develop 0 31 31
489 31 require128or256or512 $xmm1, $xmm2; # Check that we have a string of 128 bits in the first operand
490  
491 31 my $N = length($xmm1) / $size; # Number of elements
492 31 my $k1 = maskRegister;
493 31 for(0..$N-1)
494 308 {my $o = $_ * $size;
495 308 ▶ substr($k1, $_, 1) = andAndTest(substr($xmm1, $o, $size), # Test two elements
Branch: 1 branch
BranchTrueFalseTotal
&andAndTest(substr($xmm1, $o, $size), substr($xmm2, $o, $size)) ? : 60 248 308
496 substr($xmm2, $o, $size)) ? '1' : '0';
497 }
498  
499 31 substr(zBytes(8).substr($k1, 0, $N), -64)
500 }
501  
502 sub VPTESTMB($$) # Packed TEST Mask Byte
503 10 ▶ {my ($xmm1, $xmm2) = @_; # Bytes, bytes
Subroutine VPTESTMB: called CC=1 SCAR=0.0
Pod documented
504 10 vptest 8, $xmm1, $xmm2
505 }
506  
507 sub VPTESTMW($$) # Packed TEST Mask Word
508 10 ▶ {my ($xmm1, $xmm2) = @_; # Words, words
Subroutine VPTESTMW: called CC=1 SCAR=0.0
Pod documented
509 10 vptest 16, $xmm1, $xmm2
510 }
511  
512 sub VPTESTMD($$) # Packed TEST Mask Dword
513 10 ▶ {my ($xmm1, $xmm2) = @_; # Dwords, dwords
Subroutine VPTESTMD: called CC=1 SCAR=0.0
Pod documented
514 10 vptest 32, $xmm1, $xmm2
515 }
516  
517 sub VPTESTMQ($$) # Packed TEST Mask Quad
518 1 ▶ {my ($xmm1, $xmm2) = @_; # Quads, quads
Subroutine VPTESTMQ: called CC=1 SCAR=0.0
Pod documented
519 1 vptest 64, $xmm1, $xmm2
520 }
521  
522 #D1 VPBROADCAST # VPBROADCASTB - Packed BROADCAST Byte
523  
524 sub VPBROADCASTB($$) # Packed TEST Mask Byte
525 1 ▶ {my ($size, $b) = @_; # Size of target in bits, byte
Subroutine VPBROADCASTB: called CC=1 SCAR=0.0
Pod documented
526 1 requireNumber128or256or512 $size;
527 1 require8 $b;
528 1 repeat($b, $size / 8)
529 }
530  
531 sub VPBROADCASTW($$) # Packed TEST Mask Word
532 1 ▶ {my ($size, $w) = @_; # Size of target in bits, word
Subroutine VPBROADCASTW: called CC=1 SCAR=0.0
Pod documented
533 1 requireNumber128or256or512 $size;
534 1 require16 $w;
535 1 repeat($w, $size / 16)
536 }
537  
538 sub VPBROADCASTD($$) # Packed TEST Mask Dword
539 1 ▶ {my ($size, $d) = @_; # Size of target in bits, dword
Subroutine VPBROADCASTD: called CC=1 SCAR=0.0
Pod documented
540 1 requireNumber128or256or512 $size;
541 1 require32 $d;
542 1 repeat($d, $size / 32)
543 }
544  
545 sub VPBROADCASTQ($$) # Packed TEST Mask Quad
546 1 ▶ {my ($size, $q) = @_; # Size of target in bits, byte
Subroutine VPBROADCASTQ: called CC=1 SCAR=0.0
Pod documented
547 1 requireNumber128or256or512 $size;
548 1 require64 $q;
549 1 repeat($q, $size / 64)
550 }
551  
552 #D1 VPINSR # Packed INSeRt
553  
554 sub VPINSRB($$$) # Packed INSeRt Byte
555 1 ▶ {my ($target, $byte, $pos) = @_; # Target element, byte, position to insert byte expressed as number of bytes from lowest order byte numbered 0
Subroutine VPINSRB: called CC=3 SCAR=11.6
Pod documented
556 1 require128or256or512 $target;
557 1 require8 $byte;
558 1 ▶ confess "Invalid position $pos" if $pos < 0 or $pos > length($target);
Branch: 1 branch
BranchTrueFalseTotal
if $pos < 0 or $pos > length $target 0 1 1
Condition33%1/3
$pos < 0 or $pos > length $target
l!l&&r!l&&!r
001
MC/DC0%0/2
$pos < 0 or $pos > length $target
$pos < 0 $pos > length $target
Truth table33%1/3
A or B
A= $pos < 0B= $pos > length $target
ABresult
1X1
011
000
559 1 substr($target, -($pos+1)*8, 8) = $byte;
560 1 $target
561 }
562  
563 sub VPINSRW($$$) # Packed INSeRt Word
564 1 ▶ {my ($target, $word, $pos) = @_; # Target element, word, position to insert byte expressed as number of words from lowest order word numbered 0
Subroutine VPINSRW: called CC=3 SCAR=11.6
Pod documented
565 1 require128or256or512 $target;
566 1 require16 $word;
567 1 ▶ confess "Invalid position $pos" if $pos < 0 or $pos > length($target) / 2;
Branch: 1 branch
BranchTrueFalseTotal
if $pos < 0 or $pos > length($target) / 2 0 1 1
Condition33%1/3
$pos < 0 or $pos > length($target) / 2
l!l&&r!l&&!r
001
MC/DC0%0/2
$pos < 0 or $pos > length($target) / 2
$pos < 0 $pos > length($target) / 2
Truth table33%1/3
A or B
A= $pos < 0B= $pos > length($target) / 2
ABresult
1X1
011
000
568 1 substr($target, -($pos+1)*16, 16) = $word;
569 1 $target
570 }
571  
572 sub VPINSRD($$$) # Packed INSeRt Dword
573 1 ▶ {my ($target, $dword, $pos) = @_; # Target element, dword, position to insert byte expressed as number of dwords from lowest order dword numbered 0
Subroutine VPINSRD: called CC=3 SCAR=11.6
Pod documented
574 1 require128or256or512 $target;
575 1 require32 $dword;
576 1 ▶ confess "Invalid position $pos" if $pos < 0 or $pos > length($target) / 4;
Branch: 1 branch
BranchTrueFalseTotal
if $pos < 0 or $pos > length($target) / 4 0 1 1
Condition33%1/3
$pos < 0 or $pos > length($target) / 4
l!l&&r!l&&!r
001
MC/DC0%0/2
$pos < 0 or $pos > length($target) / 4
$pos < 0 $pos > length($target) / 4
Truth table33%1/3
A or B
A= $pos < 0B= $pos > length($target) / 4
ABresult
1X1
011
000
577 1 substr($target, -($pos+1)*32, 32) = $dword;
578 1 $target
579 }
580  
581 sub VPINSRQ($$$) # Packed INSeRt Quad
582 1 ▶ {my ($target, $qword, $pos) = @_; # Target element, qword, position to insert byte expressed as number of dwords from lowest order qword numbered 0
Subroutine VPINSRQ: called CC=3 SCAR=11.6
Pod documented
583 1 require128or256or512 $target;
584 1 require64 $qword;
585 1 ▶ confess "Invalid position $pos" if $pos < 0 or $pos > length($target) / 8;
Branch: 1 branch
BranchTrueFalseTotal
if $pos < 0 or $pos > length($target) / 8 0 1 1
Condition33%1/3
$pos < 0 or $pos > length($target) / 8
l!l&&r!l&&!r
001
MC/DC0%0/2
$pos < 0 or $pos > length($target) / 8
$pos < 0 $pos > length($target) / 8
Truth table33%1/3
A or B
A= $pos < 0B= $pos > length($target) / 8
ABresult
1X1
011
000
586 1 substr($target, -($pos+1)*64, 64) = $qword;
587 1 $target
588 }
589  
590 #D1 VPLZCNT # Packed Leading Zero CouNT
591  
592 sub VPLZCNTD($) # Packed Leading Zero CouNT Dword
593 1 ▶ {my ($target) = @_; # Target element
Subroutine VPLZCNTD: called CC=2 SCAR=6.9
Pod documented
594 1 require128or256or512 $target;
595 1 my $r = '';
596 1 my $n = length($target) / 32;
597 1 for(0..$n-1)
598 16 {my $b = substr($target, $_*32, 32) =~ s(1.*\Z) ()sr;
599 16 $r .= sprintf("%032b", length $b);
600 }
601 $r
602 1 }
603  
604 sub VPLZCNTQ($) # Packed Leading Zero CouNT Qword
605 1 ▶ {my ($target) = @_; # Target element
Subroutine VPLZCNTQ: called CC=2 SCAR=6.9
Pod documented
606 1 require128or256or512 $target;
607 1 my $r = '';
608 1 my $n = length($target) / 64;
609 1 for(0..$n-1)
610 8 {my $b = substr($target, $_*64, 64) =~ s(1.*\Z) ()sr;
611 8 $r .= sprintf("%064b", length $b);
612 }
613 $r
614 1 }
615  
616 #D1 Compress and Expand # Compress or expand
617 #D2 VPCOMPRESS # Packed COMPRESS
618  
619 sub vpcompress($$$$$) #P Packed COMPRESS
620 2 ▶ {my ($size, $xmm1, $k2, $z, $xmm2) = @_; # Size of each element in bits, Compression target, compression mask, clear upper elements, source to compress
Subroutine vpcompress: called CC=4 SCAR=13.9
Pod documented
621 2 require64 $k2;
622 2 my $n = require128or256or512 $xmm1, $xmm2;
623 2 my $N = $n / $size; # Number of elements
624 2 ▶ $xmm1 = '0' x length $xmm1 if $z; # Clear target if requested
Branch: 1 branch
BranchTrueFalseTotal
if $z 0 2 2
625 2 my $p = 0; # Position in target
626 2 for(1..$N) # Compress selected elements
627 6 ▶ {if (substr($k2, -$_, 1) eq '1')
Branch: 1 branch
BranchTrueFalseTotal
if (substr($k2, -$_, 1) eq 1) 3 3 6
628 3 {substr($xmm1, --$p * $size, $size) = substr($xmm2, -$_ * $size, $size)
629 }
630 }
631 $xmm1
632 2 }
633  
634 sub VPCOMPRESSD($$$$) # Packed COMPRESS Dword
635 1 ▶ {my ($xmm1, $k2, $z, $xmm2) = @_; # Compression target, compression mask, clear upper elements, source to compress
Subroutine VPCOMPRESSD: called CC=1 SCAR=0.0
Pod documented
636 1 vpcompress 32, $xmm1, $k2, $z, $xmm2
637 }
638  
639 sub VPCOMPRESSQ($$$$) # Packed COMPRESS Qword
640 1 ▶ {my ($xmm1, $k2, $z, $xmm2) = @_; # Compression target, compression mask, clear upper elements, source to compress
Subroutine VPCOMPRESSQ: called CC=1 SCAR=0.0
Pod documented
641 1 vpcompress 64, $xmm1, $k2, $z, $xmm2
642 }
643  
644 #D2 VPEXPAND # Packed EXPAND
645  
646 sub vpexpand($$$$$) #P Packed EXPAND
647 2 ▶ {my ($size, $xmm1, $k2, $z, $xmm2) = @_; # Size of each element in bits, Compression target, expansion mask, clear upper elements, source to expand
Subroutine vpexpand: called CC=4 SCAR=13.9
Pod documented
648 2 require64 $k2;
649 2 my $n = require128or256or512 $xmm1, $xmm2;
650 2 my $N = $n / $size; # Number of elements
651 2 ▶ $xmm1 = '0' x length $xmm1 if $z; # Clear target if requested
Branch: 1 branch
BranchTrueFalseTotal
if $z 0 2 2
652 2 my $p = 0; # Position in target
653 2 for(1..$N) # Compress selected elements
654 6 ▶ {if (substr($k2, -$_, 1) eq '1')
Branch: 1 branch
BranchTrueFalseTotal
if (substr($k2, -$_, 1) eq 1) 3 3 6
655 3 {substr($xmm2, -$_ * $size, $size) = substr($xmm1, --$p * $size, $size)
656 }
657 }
658 $xmm1
659 2 }
660  
661 sub VPEXPANDD($$$$) # Packed EXPAND Dword
662 1 ▶ {my ($xmm1, $k2, $z, $xmm2) = @_; # Compression target, expansion mask, clear upper elements, source to expand
Subroutine VPEXPANDD: called CC=1 SCAR=0.0
Pod documented
663 1 vpexpand 32, $xmm1, $k2, $z, $xmm2
664 }
665  
666 sub VPEXPANDQ($$$$) # Packed EXPAND Qword
667 1 ▶ {my ($xmm1, $k2, $z, $xmm2) = @_; # Compression target, expansion mask, clear upper elements, source to expand
Subroutine VPEXPANDQ: called CC=1 SCAR=0.0
Pod documented
668 1 vpexpand 64, $xmm1, $k2, $z, $xmm2
669 }
670  
671 #D0
672 #-------------------------------------------------------------------------------
673 # Export
674 #-------------------------------------------------------------------------------
675  
676 1 ▶use Exporter qw(import);
Subroutine BEGIN: called CC=1 SCAR=0.0
677  
678 1 ▶use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
Subroutine BEGIN: called CC=1 SCAR=0.0
679  
680 1 @ISA = qw(Exporter);
681 1 @EXPORT_OK = qw(
682 );
683 1 %EXPORT_TAGS = (all=>[@EXPORT, @EXPORT_OK]);
684  
685 # podDocumentation
686  
687 =pod
688  
689 =encoding utf-8
690  
691 =head1 Name
692  
693 Simd::Avx512 - Emulate SIMD Avx512 instructions
694  
695 =head1 Synopsis
696  
697 Help needed please!
698  
699 The instructions being emulated are illustrated at: L<https://www.officedaytime.com/simd512e/>
700 The instructions being emulated are described at: L<https://hjlebbink.github.io/x86doc/>
701  
702 =head2 Example
703  
704 Find the number of leading zeros in each of 8 quad words.
705  
706 if (1) {
707 my ($i, $od, $oq) = (
708 #Q0 1 2 3 4 5 6 7 8
709 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
710 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
711 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
712 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
713 '00000000101010100000001101010100101110101001111111010101011100110010100101010111110010101001010101100110100100001000110010101000011111010100111100101100000000000010001111001010111010111111111101001010100010111111001000010000100010100100111111100000000011010010010010000101101011110000000100011111111000000010000010101110111000000000011000111110100001000111111110001000000101011111100000000011101111100000100111111110000010011111111000000000111011101100000000001000111100011110010000011111111000001000010110010111',
714 '00000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000001000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000110000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000011',
715 '00000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000000',
716 );
717  
718 is_deeply VPLZCNTD($i), $od;
719 is_deeply VPLZCNTQ($i), $oq;
720 }
721  
722 =head1 Description
723  
724 Emulate SIMD Avx512 instructions
725  
726  
727 Version 20210129.
728  
729  
730 The following sections describe the methods in each functional area of this
731 module. For an alphabetic listing of all methods by name see L<Index|/Index>.
732  
733  
734  
735 =head1 Instructions
736  
737 Emulation of Avx512 instructions
738  
739 =head2 PSLLDQ($xmm1, $imm8)
740  
741 Packed Shift Left Logical DoubleQword
742  
743 Parameter Description
744 1 $xmm1 Bytes
745 2 $imm8 Length of shift in bytes
746  
747 B<Example:>
748  
749  
750  
751 is_deeply PSLLDQ( # 128 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
752  
753 #Q0 1 2 3 4 5 6 7 8
754 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
755 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
756 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
757 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
758 '11100001000010000000000011000000000000000100000000001000000000000110000000000000000000111111000000000000000000000000000000001111'
759 ,2),
760 '00000000110000000000000001000000000010000000000001100000000000000000001111110000000000000000000000000000000011110000000000000000'
761  
762  
763 =head2 VPSLLDQ($xmm1, $imm8)
764  
765 Packed Shift Left Logical DoubleQword
766  
767 Parameter Description
768 1 $xmm1 Bytes
769 2 $imm8 Length of shift in bytes
770  
771 B<Example:>
772  
773  
774  
775 is_deeply VPSLLDQ( # 128 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
776  
777 #Q0 1 2 3 4 5 6 7 8
778 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
779 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
780 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
781 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
782 '11100001000010000000000011000000000000000100000000001000000000000110000000000000000000111111000000000000000000000000000000001111'
783 ,2),
784 '00000000110000000000000001000000000010000000000001100000000000000000001111110000000000000000000000000000000011110000000000000000'
785  
786  
787 is_deeply VPSLLDQ( # 2*128 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
788  
789 #Q0 1 2 3 4 5 6 7 8
790 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
791 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
792 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
793 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
794 '11100001000010000000000011000000000000000100000000001000000000000110000000000000000000111111000000000000000000000000000000001111'
795 .'11100001000010000000000011000000000000000100000000001000000000000110000000000000000000111111000000000000000000000000000000001111'
796 ,2),
797 '00000000110000000000000001000000000010000000000001100000000000000000001111110000000000000000000000000000000011110000000000000000'
798 .'00000000110000000000000001000000000010000000000001100000000000000000001111110000000000000000000000000000000011110000000000000000'
799  
800  
801 is_deeply VPSLLDQ( # 4*128 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
802  
803 #Q0 1 2 3 4 5 6 7 8
804 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
805 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
806 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
807 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
808 '11100001000010000000000011000000000000000100000000001000000000000110000000000000000000111111000000000000000000000000000000001111'
809 .'11100001000010000000000011000000000000000100000000001000000000000110000000000000000000111111000000000000000000000000000000001111'
810 .'11100001000010000000000011000000000000000100000000001000000000000110000000000000000000111111000000000000000000000000000000001111'
811 .'11100001000010000000000011000000000000000100000000001000000000000110000000000000000000111111000000000000000000000000000000001111'
812 ,2),
813 '00000000110000000000000001000000000010000000000001100000000000000000001111110000000000000000000000000000000011110000000000000000'
814 .'00000000110000000000000001000000000010000000000001100000000000000000001111110000000000000000000000000000000011110000000000000000'
815 .'00000000110000000000000001000000000010000000000001100000000000000000001111110000000000000000000000000000000011110000000000000000'
816 .'00000000110000000000000001000000000010000000000001100000000000000000001111110000000000000000000000000000000011110000000000000000'
817  
818  
819 =head2 PSRLDQ($xmm1, $imm8)
820  
821 Packed Shift Right Logical DoubleQword
822  
823 Parameter Description
824 1 $xmm1 Bytes
825 2 $imm8 Length of shift
826  
827 B<Example:>
828  
829  
830  
831 is_deeply PSRLDQ( # 128 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
832  
833 #Q0 1 2 3 4 5 6 7 8
834 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
835 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
836 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
837 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
838 '11100001000010000000000011000000000000000100000000001000000000000110000000000000000000111111000000000000000000000000000000001111'
839 ,2),
840 '00000000000000001110000100001000000000001100000000000000010000000000100000000000011000000000000000000011111100000000000000000000'
841  
842  
843 =head2 VPSRLDQ($xmm1, $imm8)
844  
845 Packed Shift Right Logical DoubleQword
846  
847 Parameter Description
848 1 $xmm1 Bytes
849 2 $imm8 Length of shift
850  
851 B<Example:>
852  
853  
854  
855 is_deeply VPSRLDQ( # 128 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
856  
857 #Q0 1 2 3 4 5 6 7 8
858 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
859 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
860 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
861 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
862 '11100001000010000000000011000000000000000100000000001000000000000110000000000000000000111111000000000000000000000000000000001111'
863 ,2),
864 '00000000000000001110000100001000000000001100000000000000010000000000100000000000011000000000000000000011111100000000000000000000'
865  
866  
867 is_deeply VPSRLDQ( # 2*128 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
868  
869 #Q0 1 2 3 4 5 6 7 8
870 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
871 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
872 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
873 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
874 '11100001000010000000000011000000000000000100000000001000000000000110000000000000000000111111000000000000000000000000000000001111'
875 .'11100001000010000000000011000000000000000100000000001000000000000110000000000000000000111111000000000000000000000000000000001111'
876 ,2),
877 '00000000000000001110000100001000000000001100000000000000010000000000100000000000011000000000000000000011111100000000000000000000'
878 .'00000000000000001110000100001000000000001100000000000000010000000000100000000000011000000000000000000011111100000000000000000000'
879  
880  
881 is_deeply VPSRLDQ( # 4*128 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
882  
883 #Q0 1 2 3 4 5 6 7 8
884 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
885 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
886 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
887 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
888 '11100001000010000000000011000000000000000100000000001000000000000110000000000000000000111111000000000000000000000000000000001111'
889 .'11100001000010000000000011000000000000000100000000001000000000000110000000000000000000111111000000000000000000000000000000001111'
890 .'11100001000010000000000011000000000000000100000000001000000000000110000000000000000000111111000000000000000000000000000000001111'
891 .'11100001000010000000000011000000000000000100000000001000000000000110000000000000000000111111000000000000000000000000000000001111'
892 ,2),
893 '00000000000000001110000100001000000000001100000000000000010000000000100000000000011000000000000000000011111100000000000000000000'
894 .'00000000000000001110000100001000000000001100000000000000010000000000100000000000011000000000000000000011111100000000000000000000'
895 .'00000000000000001110000100001000000000001100000000000000010000000000100000000000011000000000000000000011111100000000000000000000'
896 .'00000000000000001110000100001000000000001100000000000000010000000000100000000000011000000000000000000011111100000000000000000000'
897  
898  
899 =head1 PCMP
900  
901 Packed CoMPare
902  
903 =head2 PCMPEQ
904  
905 Packed CoMPare EQual
906  
907 =head3 PCMPEQB($xmm1, $xmm2)
908  
909 Packed CoMPare EQual Byte
910  
911 Parameter Description
912 1 $xmm1 Bytes
913 2 $xmm2 Bytes
914  
915 B<Example:>
916  
917  
918  
919 is_deeply PCMPEQB( # 128 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
920  
921 #Q0 1 2 3 4 5 6 7 8
922 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
923 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
924 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
925 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
926 '11100001000010000000000011000000000000011000000000010000000000001100000000000000000001111110000000000000000000000000000000011110'
927 ,'11100001000001000000000011000000000000010000000000100000000000001100000000000000000001111110000000000000000000000000000000011010'
928 ),
929 '11111111000000001111111111111111111111110000000000000000111111111111111111111111111111111111111111111111111111111111111100000000'
930  
931  
932 =head3 PCMPEQW($xmm1, $xmm2)
933  
934 Packed CoMPare EQual Word
935  
936 Parameter Description
937 1 $xmm1 Words
938 2 $xmm2 Words
939  
940 B<Example:>
941  
942  
943  
944 is_deeply PCMPEQW( # 128 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
945  
946 #Q0 1 2 3 4 5 6 7 8
947 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
948 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
949 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
950 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
951 '11100001000010000000000011000000000000011000000000010000000000001100000000000000000001111110000000000000000000000000000000011110'
952 ,'11100001000001000000000011000000000000010000000000100000000000001100000000000000000001111110000000000000000000000000000000011010'
953 ),
954 '00000000000000001111111111111111000000000000000000000000000000001111111111111111111111111111111111111111111111110000000000000000'
955  
956  
957 =head3 PCMPEQD($xmm1, $xmm2)
958  
959 Packed CoMPare EQual DWord
960  
961 Parameter Description
962 1 $xmm1 DWords
963 2 $xmm2 DWords
964  
965 B<Example:>
966  
967  
968  
969 is_deeply PCMPEQD( # 128 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
970  
971 #Q0 1 2 3 4 5 6 7 8
972 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
973 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
974 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
975 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
976 '11100001000010000000000011000000000000011000000000010000000000001100000000000000000001111110000000000000000000000000000000011110'
977 ,'11100001000001000000000011000000000000010000000000100000000000001100000000000000000001111110000000000000000000000000000000011010'
978 ),
979 '00000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111100000000000000000000000000000000'
980  
981  
982 =head3 PCMPEQQ($xmm1, $xmm2)
983  
984 Packed CoMPare EQual QWord
985  
986 Parameter Description
987 1 $xmm1 QWords
988 2 $xmm2 QWords
989  
990 B<Example:>
991  
992  
993  
994 is_deeply PCMPEQQ( # 128 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
995  
996 #Q0 1 2 3 4 5 6 7 8
997 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
998 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
999 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1000 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1001 '11100001000011000000000011000000000000011000000000110000000000001100000000000000000001111110000000000000000000000000000000011110'
1002 ,'11100001000011000000000011000000000000011000000000110000000000001100000000000000000001111110000000000000000000000000000000011010'
1003 ),
1004 '11111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000'
1005  
1006  
1007 =head2 PCMPGT
1008  
1009 Packed CoMPare Greater Than
1010  
1011 =head3 PCMPGTB($xmm1, $xmm2)
1012  
1013 Packed CoMPare Greater Than Byte
1014  
1015 Parameter Description
1016 1 $xmm1 Bytes
1017 2 $xmm2 Bytes
1018  
1019 B<Example:>
1020  
1021  
1022  
1023 is_deeply PCMPGTB( # 128 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1024  
1025 #Q0 1 2 3 4 5 6 7 8
1026 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1027 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1028 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1029 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1030 '11100001000010000000000011000000010000011000000000010000000000001100000000000000000001111110000000000000000000000000000000011110'
1031 ,'11100001000001000000000001000000100000010000000000100000000000001100000000000000000001111110000000000000000000000000000000011010'
1032 ),
1033 '00000000111111110000000000000000111111110000000000000000000000000000000000000000000000000000000000000000000000000000000011111111'
1034  
1035  
1036 =head3 PCMPGTW($xmm1, $xmm2)
1037  
1038 Packed CoMPare Greater Than Word
1039  
1040 Parameter Description
1041 1 $xmm1 Words
1042 2 $xmm2 Words
1043  
1044 B<Example:>
1045  
1046  
1047  
1048 is_deeply PCMPGTW( # 128 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1049  
1050 #Q0 1 2 3 4 5 6 7 8
1051 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1052 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1053 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1054 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1055 '11100001000010000000000011000000000000011000000000010000000000001100000000000000000001111110000000000000000000000000000000011110'
1056 ,'11100001000001000000000011000000000000010000000000100000000000001100000000000000000000111110000000000000000000000000000000011010'
1057 ),
1058 '11111111111111110000000000000000111111111111111100000000000000000000000000000000111111111111111100000000000000001111111111111111'
1059  
1060  
1061 =head3 PCMPGTD($xmm1, $xmm2)
1062  
1063 Packed CoMPare Greater Than DWord
1064  
1065 Parameter Description
1066 1 $xmm1 DWords
1067 2 $xmm2 DWords
1068  
1069 B<Example:>
1070  
1071  
1072  
1073 is_deeply PCMPGTD( # 128 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1074  
1075 #Q0 1 2 3 4 5 6 7 8
1076 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1077 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1078 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1079 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1080 '11100001000010000000000011000000000000011000000000010000000000001100000000000000000001111110000000000000000000000000000000011110'
1081 ,'11100001000001000000000011000000000000010000000000100000000000001100000000000000000001111110000000000000000000000000000000011010'
1082 ),
1083 '11111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000011111111111111111111111111111111'
1084  
1085  
1086 =head3 PCMPGTQ($xmm1, $xmm2)
1087  
1088 Packed CoMPare Greater Than QWord
1089  
1090 Parameter Description
1091 1 $xmm1 QWords
1092 2 $xmm2 QWords
1093  
1094 B<Example:>
1095  
1096  
1097  
1098 is_deeply PCMPGTQ( # 128 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1099  
1100 #Q0 1 2 3 4 5 6 7 8
1101 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1102 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1103 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1104 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1105 '11100001000011000000000011000000000000011000000000110000000000001100000000000000000001111110000000000000000000000000000000011110'
1106 ,'11100001000011000000000011000000000000011000000000110000000000001100000000000000000001111110000000000000000000000000000000011010'
1107 ),
1108 '00000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111'
1109  
1110  
1111 =head1 VPCMP
1112  
1113 Packed CoMPare
1114  
1115 =head2 VPCMPEQ
1116  
1117 Packed CoMPare EQual
1118  
1119 =head3 VPCMPEQB($k2, $xmm1, $xmm2)
1120  
1121 Packed CoMPare EQual Byte with optional masking
1122  
1123 Parameter Description
1124 1 $k2 Optional input mask
1125 2 $xmm1 Bytes
1126 3 $xmm2 Bytes
1127  
1128 B<Example:>
1129  
1130  
1131  
1132 is_deeply VPCMPEQB( # 128 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1133  
1134 #Q0 1 2 3 4 5 6 7 8
1135 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1136 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1137 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1138 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1139 '11100001000010000000000011000000000000011000000000010000000000001100000000000000000001111110000000000000000000000000000000011110'
1140 ,'11100001000001000000000011000000000000010000000000100000000000001100000000000000000001111110000000000000000000000000000000011010'
1141 ),
1142 '11111111000000001111111111111111111111110000000000000000111111111111111111111111111111111111111111111111111111111111111100000000'
1143  
1144  
1145 is_deeply VPCMPEQB( # 512 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1146  
1147 #Q0 1 2 3 4 5 6 7 8
1148 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1149 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1150 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1151 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1152 '11100001000010000000000011000000000000011000000000010000000000001100000000000000000001111110000000000000000000000000000000011110'
1153 .'11100001000010000000000011000000000000011000000000010000000000001100000000000000000001111110000000000000000000000000000000011110'
1154 ,'11100001000001000000000011000000000000010000000000100000000000001100000000000000000001111110000000000000000000000000000000011010'
1155 .'11100001000001000000000011000000000000010000000000100000000000001100000000000000000001111110000000000000000000000000000000011010'
1156 ),
1157 '11111111000000001111111111111111111111110000000000000000111111111111111111111111111111111111111111111111111111111111111100000000'
1158 .'11111111000000001111111111111111111111110000000000000000111111111111111111111111111111111111111111111111111111111111111100000000'
1159  
1160  
1161 is_deeply VPCMPEQB( # 128 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1162  
1163 #Q0 1 2 3 4 5 6 7 8
1164 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1165 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1166 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1167 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1168 '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1169 '00000001000010000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1170 '10000001000010000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1171 ),
1172 '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1';
1173  
1174  
1175 is_deeply VPCMPEQB( # 256 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1176  
1177 #Q0 1 2 3 4 5 6 7 8
1178 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1179 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1180 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1181 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1182 '1'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '1'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1183 '0000000100001000000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1184 '1000000100001000000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1185 ),
1186 '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1';
1187  
1188  
1189 is_deeply VPCMPEQB( # 512 # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1190  
1191 #Q0 1 2 3 4 5 6 7 8
1192 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1193 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1194 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1195 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1196 '1'. '1'. '1'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1197 '00000000110000001000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1198 '00000000110000000000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1199 ),
1200 '1'. '1'. '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1';
1201  
1202  
1203 =head3 VPCMPEQW($k2, $xmm1, $xmm2)
1204  
1205 Packed CoMPare EQual Byte with optional masking
1206  
1207 Parameter Description
1208 1 $k2 Optional input mask
1209 2 $xmm1 Words
1210 3 $xmm2 Words
1211  
1212 =head3 VPCMPEQD($k2, $xmm1, $xmm2)
1213  
1214 Packed CoMPare EQual Byte with optional masking
1215  
1216 Parameter Description
1217 1 $k2 Optional input mask
1218 2 $xmm1 Dwords
1219 3 $xmm2 Dwords
1220  
1221 =head3 VPCMPEQQ($k2, $xmm1, $xmm2)
1222  
1223 Packed CoMPare EQual Byte with optional masking
1224  
1225 Parameter Description
1226 1 $k2 Optional input mask
1227 2 $xmm1 Qwords
1228 3 $xmm2 Qwords
1229  
1230 =head2 VPCMP
1231  
1232 Packed CoMPare
1233  
1234 =head3 VPCMPB($k2, $xmm1, $xmm2, $op)
1235  
1236 Packed CoMPare Byte
1237  
1238 Parameter Description
1239 1 $k2 Input mask
1240 2 $xmm1 Bytes
1241 3 $xmm2 Bytes
1242 4 $op Test code
1243  
1244 B<Example:>
1245  
1246  
1247 my ($mi, $mo, $o1, $o2) = ( # 128
1248 #Q0 1 2 3 4 5 6 7 8
1249 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1250 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1251 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1252 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1253 '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1254 '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1255 '00000001000010000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1256 '10000001000010000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1257 );
1258  
1259  
1260 is_deeply VPCMPB($mi, $o1, $o2, 0), $mo; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1261  
1262  
1263 is_deeply VPCMPB($mi, $o1, $o2, 4), zBytes(6).flipBitsUnderMask substr($mo, 48), substr($mi, 48); # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1264  
1265  
1266 my ($mi, $mo, $o1, $o2) = ( # 256
1267 #Q0 1 2 3 4 5 6 7 8
1268 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1269 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1270 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1271 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1272 '1'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '1'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1273 '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1274 '0000000100001000000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1275 '1000000100001000000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1276 );
1277  
1278 is_deeply VPCMPB($mi, $o1, $o2, 0), $mo; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1279  
1280  
1281 is_deeply VPCMPB($mi, $o1, $o2, 4), zBytes(4).flipBitsUnderMask substr($mo, 32), substr($mi, 32); # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1282  
1283  
1284 my ($mi, $meq, $mlt, $mgt, $o1, $o2) = ( # 512
1285 #Q0 1 2 3 4 5 6 7 8
1286 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1287 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1288 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1289 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1290 '1'. '1'. '1'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1291 '1'. '1'. '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1292 '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0',
1293 '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0',
1294 '00000000110000001000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000110000111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1295 '00000000110000000000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000001100000011111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1296 );
1297  
1298 is_deeply VPCMPB($mi, $o1, $o2, 0), $meq; # eq # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1299  
1300  
1301 is_deeply VPCMPB($mi, $o1, $o2, 1), $mlt; # lt # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1302  
1303  
1304 is_deeply VPCMPB($mi, $o1, $o2, 2), flipBitsUnderMask $mgt, $mi; # le # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1305  
1306  
1307 is_deeply VPCMPB($mi, $o1, $o2, 4), flipBitsUnderMask $meq, $mi; # ne # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1308  
1309  
1310 is_deeply VPCMPB($mi, $o1, $o2, 5), flipBitsUnderMask $mlt, $mi; # ge # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1311  
1312  
1313 is_deeply VPCMPB($mi, $o1, $o2, 6), $mgt; # gt # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1314  
1315  
1316  
1317 =head3 VPCMPW($k2, $xmm1, $xmm2, $op)
1318  
1319 Packed CoMPare Word
1320  
1321 Parameter Description
1322 1 $k2 Input mask
1323 2 $xmm1 Words
1324 3 $xmm2 Words
1325 4 $op Test code
1326  
1327 =head3 VPCMPD($k2, $xmm1, $xmm2, $op)
1328  
1329 Packed CoMPare Dword
1330  
1331 Parameter Description
1332 1 $k2 Input mask
1333 2 $xmm1 Dwords
1334 3 $xmm2 Dwords
1335 4 $op Test code
1336  
1337 =head3 VPCMPQ($k2, $xmm1, $xmm2, $op)
1338  
1339 Packed CoMPare Qword
1340  
1341 Parameter Description
1342 1 $k2 Input mask
1343 2 $xmm1 Qwords
1344 3 $xmm2 Qwords
1345 4 $op Test code
1346  
1347 =head2 VPCMPU
1348  
1349 Packed CoMPare Unsigned
1350  
1351 =head3 VPCMPUB($k2, $xmm1, $xmm2, $op)
1352  
1353 Packed CoMPare Unsigned Byte
1354  
1355 Parameter Description
1356 1 $k2 Input mask
1357 2 $xmm1 Bytes
1358 3 $xmm2 Bytes
1359 4 $op Test code
1360  
1361 B<Example:>
1362  
1363  
1364 my ($mi, $mo, $o1, $o2) = ( # 128
1365 #Q0 1 2 3 4 5 6 7 8
1366 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1367 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1368 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1369 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1370 '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1371 '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1372 '00000001000010000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1373 '10000001000010000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1374 );
1375  
1376  
1377 is_deeply VPCMPUB($mi, $o1, $o2, 0), $mo; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1378  
1379  
1380 is_deeply VPCMPUB($mi, $o1, $o2, 4), zBytes(6).flipBitsUnderMask substr($mo, 48), substr($mi, 48); # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1381  
1382  
1383 my ($mi, $mo, $o1, $o2) = ( # 256
1384 #Q0 1 2 3 4 5 6 7 8
1385 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1386 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1387 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1388 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1389 '1'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '1'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1390 '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1391 '0000000100001000000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1392 '1000000100001000000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1393 );
1394  
1395 is_deeply VPCMPUB($mi, $o1, $o2, 0), $mo; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1396  
1397  
1398 is_deeply VPCMPUB($mi, $o1, $o2, 4), zBytes(4).flipBitsUnderMask substr($mo, 32), substr($mi, 32); # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1399  
1400  
1401 my ($mi, $meq, $mlt, $mgt, $o1, $o2) = ( # 512
1402 #Q0 1 2 3 4 5 6 7 8
1403 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1404 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1405 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1406 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1407 '1'. '1'. '1'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1408 '1'. '1'. '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1409 '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0',
1410 '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0',
1411 '00000000110000001000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000110000111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1412 '00000000110000000000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000001100000011111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1413 );
1414  
1415 is_deeply VPCMPUB($mi, $o1, $o2, 0), $meq; # eq # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1416  
1417  
1418 is_deeply VPCMPUB($mi, $o1, $o2, 1), $mlt; # lt # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1419  
1420  
1421 is_deeply VPCMPUB($mi, $o1, $o2, 2), flipBitsUnderMask $mgt, $mi; # le # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1422  
1423  
1424 is_deeply VPCMPUB($mi, $o1, $o2, 4), flipBitsUnderMask $meq, $mi; # ne # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1425  
1426  
1427 is_deeply VPCMPUB($mi, $o1, $o2, 5), flipBitsUnderMask $mlt, $mi; # ge # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1428  
1429  
1430 is_deeply VPCMPUB($mi, $o1, $o2, 6), $mgt; # gt # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1431  
1432  
1433  
1434 =head3 VPCMPUW($k2, $xmm1, $xmm2, $op)
1435  
1436 Packed CoMPare Unsigned Word
1437  
1438 Parameter Description
1439 1 $k2 Input mask
1440 2 $xmm1 Words
1441 3 $xmm2 Words
1442 4 $op Test code
1443  
1444 B<Example:>
1445  
1446  
1447 my ($mi, $meq, $mlt, $mgt, $o1, $o2) = ( # 512
1448 #Q0 1 2 3 4 5 6 7 8
1449 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1450 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1451 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1452 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1453 '1'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1454 '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1455 '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0',
1456 '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0',
1457 '00000000110000001000000001100000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000110000011111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1458 '00000000110000000000000001100000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000001100000111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1459 );
1460 for my $i(\($mi, $meq, $mlt, $mgt))
1461 {$$i = zBytes(4).$$i;
1462 }
1463  
1464 is_deeply VPCMPUW($mi, $o1, $o2, 0), $meq; # eq # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1465  
1466  
1467 is_deeply VPCMPUW($mi, $o1, $o2, 1), $mlt; # lt # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1468  
1469  
1470 is_deeply VPCMPUW($mi, $o1, $o2, 2), flipBitsUnderMask $mgt, $mi; # le # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1471  
1472  
1473 is_deeply VPCMPUW($mi, $o1, $o2, 4), flipBitsUnderMask $meq, $mi; # ne # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1474  
1475  
1476 is_deeply VPCMPUW($mi, $o1, $o2, 5), flipBitsUnderMask $mlt, $mi; # ge # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1477  
1478  
1479 is_deeply VPCMPUW($mi, $o1, $o2, 6), $mgt; # gt # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1480  
1481  
1482 my ($mi, $meq, $mlt, $mgt, $o1, $o2) = ( # 512
1483 #Q0 1 2 3 4 5 6 7 8
1484 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1485 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1486 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1487 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1488 '1'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1489 '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1490 '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0',
1491 '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0',
1492 '00000000110000001000000001100000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000110000011111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1493 '00000000110000000000000001100000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000001100000111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1494 );
1495 for my $i(\($mi, $meq, $mlt, $mgt))
1496 {$$i = zBytes(4).$$i;
1497 }
1498  
1499 is_deeply VPCMPUW($mi, $o1, $o2, 0), $meq; # eq # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1500  
1501  
1502 is_deeply VPCMPUW($mi, $o1, $o2, 1), $mlt; # lt # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1503  
1504  
1505 is_deeply VPCMPUW($mi, $o1, $o2, 2), flipBitsUnderMask $mgt, $mi; # le # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1506  
1507  
1508 is_deeply VPCMPUW($mi, $o1, $o2, 4), flipBitsUnderMask $meq, $mi; # ne # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1509  
1510  
1511 is_deeply VPCMPUW($mi, $o1, $o2, 5), flipBitsUnderMask $mlt, $mi; # ge # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1512  
1513  
1514 is_deeply VPCMPUW($mi, $o1, $o2, 6), $mgt; # gt # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1515  
1516  
1517  
1518 =head3 VPCMPUD($k2, $xmm1, $xmm2, $op)
1519  
1520 Packed CoMPare Unsigned Dword
1521  
1522 Parameter Description
1523 1 $k2 Input mask
1524 2 $xmm1 Dwords
1525 3 $xmm2 Dwords
1526 4 $op Test code
1527  
1528 B<Example:>
1529  
1530  
1531 my ($mi, $meq, $mlt, $mgt, $o1, $o2) = ( # 512
1532 #Q0 1 2 3 4 5 6 7 8
1533 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1534 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1535 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1536 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1537 '1'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1538 '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0',
1539 '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0',
1540 '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1541 '00000000110000001000000001100000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000110000011111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000',
1542 '00000000110000000000000001100000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000001100000111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000',
1543 );
1544 for my $i(\($mi, $meq, $mlt, $mgt))
1545 {$$i = zBytes(6).$$i;
1546 }
1547  
1548 is_deeply VPCMPUD($mi, $o1, $o2, 0), $meq; # eq # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1549  
1550  
1551 is_deeply VPCMPUD($mi, $o1, $o2, 1), $mlt; # lt # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1552  
1553  
1554 is_deeply VPCMPUD($mi, $o1, $o2, 2), flipBitsUnderMask $mgt, $mi; # le # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1555  
1556  
1557 is_deeply VPCMPUD($mi, $o1, $o2, 4), flipBitsUnderMask $meq, $mi; # ne # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1558  
1559  
1560 is_deeply VPCMPUD($mi, $o1, $o2, 5), flipBitsUnderMask $mlt, $mi; # ge # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1561  
1562  
1563 is_deeply VPCMPUD($mi, $o1, $o2, 6), $mgt; # gt # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1564  
1565  
1566 my ($mi, $meq, $mlt, $mgt, $o1, $o2) = ( # 512
1567 #Q0 1 2 3 4 5 6 7 8
1568 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1569 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1570 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1571 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1572 '1'. '1'. '1'. '0'. '0'. '0'. '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1573 '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0',
1574 '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0',
1575 '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1576 '00000000110000001000000001100000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000110000011111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000',
1577 '00000000110000000000000001100000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000001100000111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000',
1578 );
1579 for my $i(\($mi, $meq, $mlt, $mgt))
1580 {$$i = zBytes(6).$$i;
1581 }
1582  
1583 is_deeply VPCMPUD($mi, $o1, $o2, 0), $meq; # eq # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1584  
1585  
1586 is_deeply VPCMPUD($mi, $o1, $o2, 1), $mlt; # lt # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1587  
1588  
1589 is_deeply VPCMPUD($mi, $o1, $o2, 2), flipBitsUnderMask $mgt, $mi; # le # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1590  
1591  
1592 is_deeply VPCMPUD($mi, $o1, $o2, 4), flipBitsUnderMask $meq, $mi; # ne # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1593  
1594  
1595 is_deeply VPCMPUD($mi, $o1, $o2, 5), flipBitsUnderMask $mlt, $mi; # ge # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1596  
1597  
1598 is_deeply VPCMPUD($mi, $o1, $o2, 6), $mgt; # gt # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1599  
1600  
1601  
1602 =head3 VPCMPUQ($k2, $xmm1, $xmm2, $op)
1603  
1604 Packed CoMPare Unsigned Qword
1605  
1606 Parameter Description
1607 1 $k2 Input mask
1608 2 $xmm1 Qwords
1609 3 $xmm2 Qwords
1610 4 $op Test code
1611  
1612 B<Example:>
1613  
1614  
1615 my ($mi, $meq, $mlt, $mgt, $o1, $o2) = ( # 512
1616 #Q0 1 2 3 4 5 6 7 8
1617 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1618 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1619 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1620 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1621 '1'. '1'. '1'. '1'. '1'. '0'. '0'. '1',
1622 '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0',
1623 '1'. '0'. '1'. '1'. '0'. '0'. '0'. '0',
1624 '0'. '0'. '0'. '0'. '1'. '0'. '0'. '1',
1625 '00000000110000001000000001100000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000000000000000000000110000000110000011111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000',
1626 '00000000110000001000000001100000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000011000001100000111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000',
1627 );
1628 for my $i(\($mi, $meq, $mlt, $mgt))
1629 {$$i = zBytes(7).$$i;
1630 }
1631  
1632 is_deeply VPCMPUQ($mi, $o1, $o2, 0), $meq; # eq # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1633  
1634  
1635 is_deeply VPCMPUQ($mi, $o1, $o2, 1), $mlt; # lt # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1636  
1637  
1638 is_deeply VPCMPUQ($mi, $o1, $o2, 2), flipBitsUnderMask $mgt, $mi; # le # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1639  
1640  
1641 is_deeply VPCMPUQ($mi, $o1, $o2, 4), flipBitsUnderMask $meq, $mi; # ne # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1642  
1643  
1644 is_deeply VPCMPUQ($mi, $o1, $o2, 5), flipBitsUnderMask $mlt, $mi; # ge # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1645  
1646  
1647 is_deeply VPCMPUQ($mi, $o1, $o2, 6), $mgt; # gt # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1648  
1649  
1650 my ($mi, $meq, $mlt, $mgt, $o1, $o2) = ( # 512
1651 #Q0 1 2 3 4 5 6 7 8
1652 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1653 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1654 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1655 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1656 '1'. '1'. '1'. '1'. '1'. '0'. '0'. '1',
1657 '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0',
1658 '1'. '0'. '1'. '1'. '0'. '0'. '0'. '0',
1659 '0'. '0'. '0'. '0'. '1'. '0'. '0'. '1',
1660 '00000000110000001000000001100000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000000000000000000000110000000110000011111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000',
1661 '00000000110000001000000001100000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000011000001100000111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000',
1662 );
1663 for my $i(\($mi, $meq, $mlt, $mgt))
1664 {$$i = zBytes(7).$$i;
1665 }
1666  
1667 is_deeply VPCMPUQ($mi, $o1, $o2, 0), $meq; # eq # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1668  
1669  
1670 is_deeply VPCMPUQ($mi, $o1, $o2, 1), $mlt; # lt # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1671  
1672  
1673 is_deeply VPCMPUQ($mi, $o1, $o2, 2), flipBitsUnderMask $mgt, $mi; # le # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1674  
1675  
1676 is_deeply VPCMPUQ($mi, $o1, $o2, 4), flipBitsUnderMask $meq, $mi; # ne # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1677  
1678  
1679 is_deeply VPCMPUQ($mi, $o1, $o2, 5), flipBitsUnderMask $mlt, $mi; # ge # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1680  
1681  
1682 is_deeply VPCMPUQ($mi, $o1, $o2, 6), $mgt; # gt # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1683  
1684  
1685  
1686 =head1 VPTEST
1687  
1688 Packed TEST
1689  
1690 =head2 VPTESTM
1691  
1692 Packed TEST MASK
1693  
1694 =head3 VPTESTMB($xmm1, $xmm2)
1695  
1696 Packed TEST Mask Byte
1697  
1698 Parameter Description
1699 1 $xmm1 Bytes
1700 2 $xmm2 Bytes
1701  
1702 B<Example:>
1703  
1704  
1705 my ($o1, $o2, $k1) = ( # 128
1706 #Q0 1 2
1707 #D0 1 2 3 4
1708 #W0 1 2 3 4 5 6 7 0
1709 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0
1710 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670
1711 '00000001000010000000000011000000000100000000001000010010000000000001100000000000000010100000101000011000000000111111111100010000',
1712 '10000001000010000000100011001000000001000001000000001100000001000000000000010010000101000001010000000110000111000000000000010000',
1713 '1'. '1'. '0'. '1'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '0'. '1',
1714 );
1715  
1716 is_deeply VPTESTMB($o1, $o2), zBytes(6).$k1; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1717  
1718  
1719  
1720 =head3 VPTESTMW($xmm1, $xmm2)
1721  
1722 Packed TEST Mask Word
1723  
1724 Parameter Description
1725 1 $xmm1 Words
1726 2 $xmm2 Words
1727  
1728 B<Example:>
1729  
1730  
1731 my ($o1, $o2, $k1) = ( # 256
1732 #Q0 1 2 3 4 5 6 7 8
1733 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1734 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1735 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1736 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1737 '0000110100001000000000001100000000010000000000000001001000000000000000000000000000000000110000000000000000000000000011000001000100000001000010000000000011000000000100000000000000010010000000000000010000000000000000000000000000000000000000000000000000010000',
1738 '0000000101001000000000001100000000010000110000000001001000000000000000000000000000000011000000000000000110000000000000010001000100000001100010000000000011000000000100000010000000010010001000000000000000010000000000000100000000000001100000000000000000010000',
1739 '1'. '1'. '1'. '1'. '0'. '0'. '0'. '1'. '1'. '1'. '1'. '1'. '0'. '0'. '0'. '1',
1740 );
1741  
1742  
1743 is_deeply VPTESTMW($o1, $o2), zBytes(6).$k1; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1744  
1745  
1746  
1747 =head3 VPTESTMD($xmm1, $xmm2)
1748  
1749 Packed TEST Mask Dword
1750  
1751 Parameter Description
1752 1 $xmm1 Dwords
1753 2 $xmm2 Dwords
1754  
1755 B<Example:>
1756  
1757  
1758 my ($o1, $o2, $k1) = ( # 512
1759 #Q0 1 2 3 4 5 6 7 8
1760 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1761 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1762 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1763 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1764 '00011001000010100100000011000000000100000101000000010010000000000000000000000000000000000000000000000001001000100000000000010000000000010000100000000000110000000001000000000000000100000000000000000100000000000000000000000000000000000111110000000000000100000000000100001000000000001110000000010000000000000001111000000000000000001110000000000000000000000001001010101010000000000001000000000001000010000000000011000000000100000100000000010010001000000000010000000000000000000000000000000000000000000000000000010000',
1765 '00010101000010101000000011000000000100000010100000010010000000000000000000000000000000000000000000000001010010000000000000010000000000010000100000000000110000000001000000000000000100100000010000000001000000000000000000000000000000111100001111100000000100000000000000000000000000000100010000000000000000000000000011000000000000001001000000000000000000000001001001010001010100000001000000000000000000000000000000000000000000100000000000000000000010000000000000000000000000000000000000000000000000000000000000010000',
1766 '1'. '1'. '0'. '1'. '1'. '1'. '0'. '1'. '1'. '0'. '1'. '1'. '0'. '0'. '0'. '1',
1767 );
1768  
1769  
1770 is_deeply VPTESTMD($o1, $o2), zBytes(6).$k1; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1771  
1772  
1773  
1774 =head3 VPTESTMQ($xmm1, $xmm2)
1775  
1776 Packed TEST Mask Quad
1777  
1778 Parameter Description
1779 1 $xmm1 Quads
1780 2 $xmm2 Quads
1781  
1782 B<Example:>
1783  
1784  
1785 my ($o1, $o2, $k1) = ( # 512
1786 #Q0 1 2 3 4 5 6 7 8
1787 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1788 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1789 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1790 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1791 '00011001000010100100000011000000000100000101000000010010000000000000000000000000000000000000000000000001001000100000000000010000000000010000100000000000110000000001000000000000000100000000000000000100000000000000000000000000000000000111110000000000000100000000000100001000000000001110000000010000000000000001001000000000000000000110000000000000000000000000000010101010000000000001000000000001000010000000000011000000000100000100000000010010001000000000010000000001111111111111111111111111111111111111111100000000',
1792 '00010101000010101000000011000000000100000010100000010010000000000000000000000000000000000000000000000000000000000000000000100000000000001000010000000000000011000000000000000011000000100000010000000001000000000000000000000000000000111000001111100000000000000000000000000000000000000100010000000000000000000001001000000000000000001001000000000000000000000001001001010001010100000010000000000000001100000000000100100000001000100000000000100100000010000000010000000000000000000000000000000000000000000000000000010000',
1793 '1'. '0'. '0'. '0'. '1'. '0'. '0'. '1',
1794 );
1795  
1796  
1797 is_deeply VPTESTMQ($o1, $o2), zBytes(7).$k1; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1798  
1799  
1800  
1801 =head1 VPBROADCAST
1802  
1803 VPBROADCASTB - Packed BROADCAST Byte
1804  
1805 =head2 VPBROADCASTB($size, $b)
1806  
1807 Packed TEST Mask Byte
1808  
1809 Parameter Description
1810 1 $size Size of target in bits
1811 2 $b Byte
1812  
1813 B<Example:>
1814  
1815  
1816 my $b = '00010011' x 64;
1817  
1818 is_deeply VPBROADCASTB(512, '00010011'), $b; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1819  
1820 is_deeply VPBROADCASTW(512, '0001001100010011'), $b;
1821 is_deeply VPBROADCASTD(512, '00010011000100110001001100010011'), $b;
1822 is_deeply VPBROADCASTQ(512, '0001001100010011000100110001001100010011000100110001001100010011'), $b;
1823  
1824  
1825 =head2 VPBROADCASTW($size, $w)
1826  
1827 Packed TEST Mask Word
1828  
1829 Parameter Description
1830 1 $size Size of target in bits
1831 2 $w Word
1832  
1833 =head2 VPBROADCASTD($size, $d)
1834  
1835 Packed TEST Mask Dword
1836  
1837 Parameter Description
1838 1 $size Size of target in bits
1839 2 $d Dword
1840  
1841 =head2 VPBROADCASTQ($size, $q)
1842  
1843 Packed TEST Mask Quad
1844  
1845 Parameter Description
1846 1 $size Size of target in bits
1847 2 $q Byte
1848  
1849 =head1 VPINSR
1850  
1851 Packed INSeRt
1852  
1853 =head2 VPINSRB($target, $byte, $pos)
1854  
1855 Packed INSeRt Byte
1856  
1857 Parameter Description
1858 1 $target Target element
1859 2 $byte Byte
1860 3 $pos Position to insert byte expressed as number of bytes from lowest order byte numbered 0
1861  
1862 B<Example:>
1863  
1864  
1865 my ($i, $ob, $ow, $od, $oq) = ( # 512
1866 #Q0 1 2 3 4 5 6 7 8
1867 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1868 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1869 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1870 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1871 '11111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000',
1872 '11111111000000001111111100010000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000',
1873 '11111111000000000001000000010000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000',
1874 '11111111000000001111111100000000000100000001000000010000000100001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000',
1875 '11111111000000001111111100000000111111110000000011111111000000000001000000010000000100000001000000010000000100000001000000010000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000',
1876 );
1877  
1878  
1879 is_deeply VPINSRB($i, '00010000', 60), $ob; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1880  
1881 is_deeply VPINSRW($i, '0001000000010000', 30), $ow;
1882 is_deeply VPINSRD($i, '00010000000100000001000000010000', 14), $od;
1883 is_deeply VPINSRQ($i, '0001000000010000000100000001000000010000000100000001000000010000', 6), $oq;
1884  
1885  
1886 =head2 VPINSRW($target, $word, $pos)
1887  
1888 Packed INSeRt Word
1889  
1890 Parameter Description
1891 1 $target Target element
1892 2 $word Word
1893 3 $pos Position to insert byte expressed as number of words from lowest order word numbered 0
1894  
1895 B<Example:>
1896  
1897  
1898 my ($i, $ob, $ow, $od, $oq) = ( # 512
1899 #Q0 1 2 3 4 5 6 7 8
1900 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1901 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1902 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1903 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1904 '11111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000',
1905 '11111111000000001111111100010000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000',
1906 '11111111000000000001000000010000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000',
1907 '11111111000000001111111100000000000100000001000000010000000100001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000',
1908 '11111111000000001111111100000000111111110000000011111111000000000001000000010000000100000001000000010000000100000001000000010000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000',
1909 );
1910  
1911 is_deeply VPINSRB($i, '00010000', 60), $ob;
1912  
1913 is_deeply VPINSRW($i, '0001000000010000', 30), $ow; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1914  
1915 is_deeply VPINSRD($i, '00010000000100000001000000010000', 14), $od;
1916 is_deeply VPINSRQ($i, '0001000000010000000100000001000000010000000100000001000000010000', 6), $oq;
1917  
1918  
1919 =head2 VPINSRD($target, $dword, $pos)
1920  
1921 Packed INSeRt Dword
1922  
1923 Parameter Description
1924 1 $target Target element
1925 2 $dword Dword
1926 3 $pos Position to insert byte expressed as number of dwords from lowest order dword numbered 0
1927  
1928 B<Example:>
1929  
1930  
1931 my ($i, $ob, $ow, $od, $oq) = ( # 512
1932 #Q0 1 2 3 4 5 6 7 8
1933 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1934 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1935 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1936 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1937 '11111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000',
1938 '11111111000000001111111100010000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000',
1939 '11111111000000000001000000010000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000',
1940 '11111111000000001111111100000000000100000001000000010000000100001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000',
1941 '11111111000000001111111100000000111111110000000011111111000000000001000000010000000100000001000000010000000100000001000000010000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000',
1942 );
1943  
1944 is_deeply VPINSRB($i, '00010000', 60), $ob;
1945 is_deeply VPINSRW($i, '0001000000010000', 30), $ow;
1946  
1947 is_deeply VPINSRD($i, '00010000000100000001000000010000', 14), $od; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1948  
1949 is_deeply VPINSRQ($i, '0001000000010000000100000001000000010000000100000001000000010000', 6), $oq;
1950  
1951  
1952 =head2 VPINSRQ($target, $qword, $pos)
1953  
1954 Packed INSeRt Quad
1955  
1956 Parameter Description
1957 1 $target Target element
1958 2 $qword Qword
1959 3 $pos Position to insert byte expressed as number of dwords from lowest order qword numbered 0
1960  
1961 B<Example:>
1962  
1963  
1964 my ($i, $ob, $ow, $od, $oq) = ( # 512
1965 #Q0 1 2 3 4 5 6 7 8
1966 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1967 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1968 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
1969 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
1970 '11111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000',
1971 '11111111000000001111111100010000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000',
1972 '11111111000000000001000000010000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000',
1973 '11111111000000001111111100000000000100000001000000010000000100001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000',
1974 '11111111000000001111111100000000111111110000000011111111000000000001000000010000000100000001000000010000000100000001000000010000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000',
1975 );
1976  
1977 is_deeply VPINSRB($i, '00010000', 60), $ob;
1978 is_deeply VPINSRW($i, '0001000000010000', 30), $ow;
1979 is_deeply VPINSRD($i, '00010000000100000001000000010000', 14), $od;
1980  
1981 is_deeply VPINSRQ($i, '0001000000010000000100000001000000010000000100000001000000010000', 6), $oq; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
1982  
1983  
1984  
1985 =head1 VPLZCNT
1986  
1987 Packed Leading Zero CouNT
1988  
1989 =head2 VPLZCNTD($target)
1990  
1991 Packed Leading Zero CouNT Dword
1992  
1993 Parameter Description
1994 1 $target Target element
1995  
1996 B<Example:>
1997  
1998  
1999 my ($i, $od, $oq) = ( # 512
2000 #Q0 1 2 3 4 5 6 7 8
2001 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
2002 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
2003 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
2004 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
2005 '00000000101010100000001101010100101110101001111111010101011100110010100101010111110010101001010101100110100100001000110010101000011111010100111100101100000000000010001111001010111010111111111101001010100010111111001000010000100010100100111111100000000011010010010010000101101011110000000100011111111000000010000010101110111000000000011000111110100001000111111110001000000101011111100000000011101111100000100111111110000010011111111000000000111011101100000000001000111100011110010000011111111000001000010110010111',
2006 '00000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000001000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000110000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000011',
2007 '00000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000000',
2008 );
2009  
2010  
2011 is_deeply VPLZCNTD($i), $od; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
2012  
2013 is_deeply VPLZCNTQ($i), $oq;
2014  
2015  
2016 =head2 VPLZCNTQ($target)
2017  
2018 Packed Leading Zero CouNT Qword
2019  
2020 Parameter Description
2021 1 $target Target element
2022  
2023 B<Example:>
2024  
2025  
2026 my ($i, $od, $oq) = ( # 512
2027 #Q0 1 2 3 4 5 6 7 8
2028 #D0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
2029 #W0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
2030 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
2031 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
2032 '00000000101010100000001101010100101110101001111111010101011100110010100101010111110010101001010101100110100100001000110010101000011111010100111100101100000000000010001111001010111010111111111101001010100010111111001000010000100010100100111111100000000011010010010010000101101011110000000100011111111000000010000010101110111000000000011000111110100001000111111110001000000101011111100000000011101111100000100111111110000010011111111000000000111011101100000000001000111100011110010000011111111000001000010110010111',
2033 '00000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000001000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000110000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000011',
2034 '00000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000000',
2035 );
2036  
2037 is_deeply VPLZCNTD($i), $od;
2038  
2039 is_deeply VPLZCNTQ($i), $oq; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
2040  
2041  
2042  
2043 =head1 Compress and Expand
2044  
2045 Compress or expand
2046  
2047 =head2 VPCOMPRESS
2048  
2049 Packed COMPRESS
2050  
2051 =head3 VPCOMPRESSD($xmm1, $k2, $z, $xmm2)
2052  
2053 Packed COMPRESS Dword
2054  
2055 Parameter Description
2056 1 $xmm1 Compression target
2057 2 $k2 Compression mask
2058 3 $z Clear upper elements
2059 4 $xmm2 Source to compress
2060  
2061 B<Example:>
2062  
2063  
2064 my ($m, $i, $o, $p) = ( # 128
2065 #Q0 1 2
2066 #D0 1 2 3 4
2067 #W0 1 2 3 4 5 6 7 0
2068 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0
2069 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670
2070 '1'. '0'. '1'. '0',
2071 '11000000000000000000000000000000111111111111111111111111111111101000000000000000000000000000000011111111111111111111111111111111',
2072 '00000000000000000000000000000000111111111111111000000000000000001100000000000000000000000000000010000000000000000000000000000000',
2073 '11000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000',
2074 );
2075 $m = zBytes(7).'0000'.$m; # Zero pad mask
2076  
2077 is_deeply VPCOMPRESSD($o, $m, 0, $i), $o; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
2078  
2079 is_deeply VPEXPANDD ($p, $m, 0, $o), $p;
2080  
2081  
2082 =head3 VPCOMPRESSQ($xmm1, $k2, $z, $xmm2)
2083  
2084 Packed COMPRESS Qword
2085  
2086 Parameter Description
2087 1 $xmm1 Compression target
2088 2 $k2 Compression mask
2089 3 $z Clear upper elements
2090 4 $xmm2 Source to compress
2091  
2092 B<Example:>
2093  
2094  
2095 my ($m, $i, $o, $p) = ( # 128
2096 #Q0 1 2
2097 #D0 1 2 3 4
2098 #W0 1 2 3 4 5 6 7 0
2099 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0
2100 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670
2101 '1'. '0',
2102 '10000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111',
2103 '00000000000000000000000000000000111111111111111000000000000000001000000000000000000000000000000000000000000000000000000000000000',
2104 '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
2105 );
2106 $m = zBytes(7).'000000'.$m; # Zero pad mask
2107  
2108 is_deeply VPCOMPRESSQ($o, $m, 0, $i), $o; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
2109  
2110 is_deeply VPEXPANDQ ($p, $m, 0, $o), $p;
2111  
2112  
2113 =head2 VPEXPAND
2114  
2115 Packed EXPAND
2116  
2117 =head3 VPEXPANDD($xmm1, $k2, $z, $xmm2)
2118  
2119 Packed EXPAND Dword
2120  
2121 Parameter Description
2122 1 $xmm1 Compression target
2123 2 $k2 Expansion mask
2124 3 $z Clear upper elements
2125 4 $xmm2 Source to expand
2126  
2127 B<Example:>
2128  
2129  
2130 my ($m, $i, $o, $p) = ( # 128
2131 #Q0 1 2
2132 #D0 1 2 3 4
2133 #W0 1 2 3 4 5 6 7 0
2134 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0
2135 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670
2136 '1'. '0'. '1'. '0',
2137 '11000000000000000000000000000000111111111111111111111111111111101000000000000000000000000000000011111111111111111111111111111111',
2138 '00000000000000000000000000000000111111111111111000000000000000001100000000000000000000000000000010000000000000000000000000000000',
2139 '11000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000',
2140 );
2141 $m = zBytes(7).'0000'.$m; # Zero pad mask
2142 is_deeply VPCOMPRESSD($o, $m, 0, $i), $o;
2143  
2144 is_deeply VPEXPANDD ($p, $m, 0, $o), $p; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
2145  
2146  
2147  
2148 =head3 VPEXPANDQ($xmm1, $k2, $z, $xmm2)
2149  
2150 Packed EXPAND Qword
2151  
2152 Parameter Description
2153 1 $xmm1 Compression target
2154 2 $k2 Expansion mask
2155 3 $z Clear upper elements
2156 4 $xmm2 Source to expand
2157  
2158 B<Example:>
2159  
2160  
2161 my ($m, $i, $o, $p) = ( # 128
2162 #Q0 1 2
2163 #D0 1 2 3 4
2164 #W0 1 2 3 4 5 6 7 0
2165 #B0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0
2166 #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670
2167 '1'. '0',
2168 '10000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111',
2169 '00000000000000000000000000000000111111111111111000000000000000001000000000000000000000000000000000000000000000000000000000000000',
2170 '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
2171 );
2172 $m = zBytes(7).'000000'.$m; # Zero pad mask
2173 is_deeply VPCOMPRESSQ($o, $m, 0, $i), $o;
2174  
2175 is_deeply VPEXPANDQ ($p, $m, 0, $o), $p; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲
2176  
2177  
2178  
2179  
2180 =head1 Private Methods
2181  
2182 =head2 pcmpeq($size, $xmm1, $xmm2)
2183  
2184 Packed CoMPare EQual
2185  
2186 Parameter Description
2187 1 $size Size in bits
2188 2 $xmm1 Element
2189 3 $xmm2 Element
2190  
2191 =head2 pcmpgt($size, $xmm1, $xmm2)
2192  
2193 Packed CoMPare Greater Than
2194  
2195 Parameter Description
2196 1 $size Size in bits
2197 2 $xmm1 Element
2198 3 $xmm2 Element
2199  
2200 =head2 vpcmpeq($size, $k2, $xmm1, $xmm2)
2201  
2202 Packed CoMPare EQual Byte|word|double|quad with optional masking
2203  
2204 Parameter Description
2205 1 $size Size in bits: 8|16|32|64 of each element
2206 2 $k2 Optional input mask
2207 3 $xmm1 Bytes
2208 4 $xmm2 Bytes
2209  
2210 =head2 vpcmp($size, $k2, $xmm1, $xmm2, $op)
2211  
2212 Packed CoMPare
2213  
2214 Parameter Description
2215 1 $size Size of element in bits
2216 2 $k2 Input mask
2217 3 $xmm1 Bytes
2218 4 $xmm2 Bytes
2219 5 $op Test code
2220  
2221 =head2 vpcmpu($size, $k2, $xmm1, $xmm2, $op)
2222  
2223 Packed CoMPare Unsigned
2224  
2225 Parameter Description
2226 1 $size Size of element in bits
2227 2 $k2 Input mask
2228 3 $xmm1 Bytes
2229 4 $xmm2 Bytes
2230 5 $op Test code
2231  
2232 =head2 andAndTest($a, $b)
2233  
2234 And two bit strings of the same length and return 0 if the result is 0 else 1
2235  
2236 Parameter Description
2237 1 $a Element
2238 2 $b Element
2239  
2240 =head2 vptest($size, $xmm1, $xmm2)
2241  
2242 Packed TEST
2243  
2244 Parameter Description
2245 1 $size Size of element in bits
2246 2 $xmm1 Element
2247 3 $xmm2 Element
2248  
2249 =head2 vpcompress($size, $xmm1, $k2, $z, $xmm2)
2250  
2251 Packed COMPRESS
2252  
2253 Parameter Description
2254 1 $size Size of each element in bits
2255 2 $xmm1 Compression target
2256 3 $k2 Compression mask
2257 4 $z Clear upper elements
2258 5 $xmm2 Source to compress
2259  
2260 =head2 vpexpand($size, $xmm1, $k2, $z, $xmm2)
2261  
2262 Packed EXPAND
2263  
2264 Parameter Description
2265 1 $size Size of each element in bits
2266 2 $xmm1 Compression target
2267 3 $k2 Expansion mask
2268 4 $z Clear upper elements
2269 5 $xmm2 Source to expand
2270  
2271  
2272 =head1 Index
2273  
2274  
2275 1 L<andAndTest|/andAndTest> - And two bit strings of the same length and return 0 if the result is 0 else 1
2276  
2277 2 L<pcmpeq|/pcmpeq> - Packed CoMPare EQual
2278  
2279 3 L<PCMPEQB|/PCMPEQB> - Packed CoMPare EQual Byte
2280  
2281 4 L<PCMPEQD|/PCMPEQD> - Packed CoMPare EQual DWord
2282  
2283 5 L<PCMPEQQ|/PCMPEQQ> - Packed CoMPare EQual QWord
2284  
2285 6 L<PCMPEQW|/PCMPEQW> - Packed CoMPare EQual Word
2286  
2287 7 L<pcmpgt|/pcmpgt> - Packed CoMPare Greater Than
2288  
2289 8 L<PCMPGTB|/PCMPGTB> - Packed CoMPare Greater Than Byte
2290  
2291 9 L<PCMPGTD|/PCMPGTD> - Packed CoMPare Greater Than DWord
2292  
2293 10 L<PCMPGTQ|/PCMPGTQ> - Packed CoMPare Greater Than QWord
2294  
2295 11 L<PCMPGTW|/PCMPGTW> - Packed CoMPare Greater Than Word
2296  
2297 12 L<PSLLDQ|/PSLLDQ> - Packed Shift Left Logical DoubleQword
2298  
2299 13 L<PSRLDQ|/PSRLDQ> - Packed Shift Right Logical DoubleQword
2300  
2301 14 L<VPBROADCASTB|/VPBROADCASTB> - Packed TEST Mask Byte
2302  
2303 15 L<VPBROADCASTD|/VPBROADCASTD> - Packed TEST Mask Dword
2304  
2305 16 L<VPBROADCASTQ|/VPBROADCASTQ> - Packed TEST Mask Quad
2306  
2307 17 L<VPBROADCASTW|/VPBROADCASTW> - Packed TEST Mask Word
2308  
2309 18 L<vpcmp|/vpcmp> - Packed CoMPare
2310  
2311 19 L<VPCMPB|/VPCMPB> - Packed CoMPare Byte
2312  
2313 20 L<VPCMPD|/VPCMPD> - Packed CoMPare Dword
2314  
2315 21 L<vpcmpeq|/vpcmpeq> - Packed CoMPare EQual Byte|word|double|quad with optional masking
2316  
2317 22 L<VPCMPEQB|/VPCMPEQB> - Packed CoMPare EQual Byte with optional masking
2318  
2319 23 L<VPCMPEQD|/VPCMPEQD> - Packed CoMPare EQual Byte with optional masking
2320  
2321 24 L<VPCMPEQQ|/VPCMPEQQ> - Packed CoMPare EQual Byte with optional masking
2322  
2323 25 L<VPCMPEQW|/VPCMPEQW> - Packed CoMPare EQual Byte with optional masking
2324  
2325 26 L<VPCMPQ|/VPCMPQ> - Packed CoMPare Qword
2326  
2327 27 L<vpcmpu|/vpcmpu> - Packed CoMPare Unsigned
2328  
2329 28 L<VPCMPUB|/VPCMPUB> - Packed CoMPare Unsigned Byte
2330  
2331 29 L<VPCMPUD|/VPCMPUD> - Packed CoMPare Unsigned Dword
2332  
2333 30 L<VPCMPUQ|/VPCMPUQ> - Packed CoMPare Unsigned Qword
2334  
2335 31 L<VPCMPUW|/VPCMPUW> - Packed CoMPare Unsigned Word
2336  
2337 32 L<VPCMPW|/VPCMPW> - Packed CoMPare Word
2338  
2339 33 L<vpcompress|/vpcompress> - Packed COMPRESS
2340  
2341 34 L<VPCOMPRESSD|/VPCOMPRESSD> - Packed COMPRESS Dword
2342  
2343 35 L<VPCOMPRESSQ|/VPCOMPRESSQ> - Packed COMPRESS Qword
2344  
2345 36 L<vpexpand|/vpexpand> - Packed EXPAND
2346  
2347 37 L<VPEXPANDD|/VPEXPANDD> - Packed EXPAND Dword
2348  
2349 38 L<VPEXPANDQ|/VPEXPANDQ> - Packed EXPAND Qword
2350  
2351 39 L<VPINSRB|/VPINSRB> - Packed INSeRt Byte
2352  
2353 40 L<VPINSRD|/VPINSRD> - Packed INSeRt Dword
2354  
2355 41 L<VPINSRQ|/VPINSRQ> - Packed INSeRt Quad
2356  
2357 42 L<VPINSRW|/VPINSRW> - Packed INSeRt Word
2358  
2359 43 L<VPLZCNTD|/VPLZCNTD> - Packed Leading Zero CouNT Dword
2360  
2361 44 L<VPLZCNTQ|/VPLZCNTQ> - Packed Leading Zero CouNT Qword
2362  
2363 45 L<VPSLLDQ|/VPSLLDQ> - Packed Shift Left Logical DoubleQword
2364  
2365 46 L<VPSRLDQ|/VPSRLDQ> - Packed Shift Right Logical DoubleQword
2366  
2367 47 L<vptest|/vptest> - Packed TEST
2368  
2369 48 L<VPTESTMB|/VPTESTMB> - Packed TEST Mask Byte
2370  
2371 49 L<VPTESTMD|/VPTESTMD> - Packed TEST Mask Dword
2372  
2373 50 L<VPTESTMQ|/VPTESTMQ> - Packed TEST Mask Quad
2374  
2375 51 L<VPTESTMW|/VPTESTMW> - Packed TEST Mask Word
2376  
2377 =head1 Installation
2378  
2379 This module is written in 100% Pure Perl and, thus, it is easy to read,
2380 comprehend, use, modify and install via B<cpan>:
2381  
2382 sudo cpan install Simd::Avx512
2383  
2384 =head1 Author
2385  
2386 L<philiprbrenan@gmail.com|mailto:philiprbrenan@gmail.com>
2387  
2388 L<http://www.appaapps.com|http://www.appaapps.com>
2389  
2390 =head1 Copyright
2391  
2392 Copyright (c) 2016-2021 Philip R Brenan.
2393  
2394 This module is free software. It may be used, redistributed and/or modified
2395 under the same terms as Perl itself.
2396  
2397 =cut
2398  
2399  
2400  
2401 # Tests and documentation
2402  
2403 sub test
2404 1 ▶ {my $p = __PACKAGE__;
Subroutine test: called CC=5 SCAR=16.1
Pod undocumented
2405 1 binmode($_, ":utf8") for *STDOUT, *STDERR;
2406 1 ▶ return if eval "eof(${p}::DATA)";
Branch: 1 branch
BranchTrueFalseTotal
if eval "eof(${p}::DATA)" 0 1 1
2407 1 my $s = eval "join('', <${p}::DATA>)";
2408 1 ▶ $@ and die $@;
Branch: 1 branch
BranchTrueFalseTotal
$@ and die $@ 0 1 1
2409 1 ▶ eval $s;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine positionOfMostSignificantBitIn64: called CC=6 SCAR=17.9
Pod undocumented
Branch: 4 branches
BranchTrueFalseTotal
substr(&VPTESTMD($s, $s), -2, 1) eq '1' ? : 3 6 9
substr(&VPTESTMW($s, $s), -2, 1) eq '1' ? : 2 7 9
substr(&VPTESTMB($s, $s), -2, 1) eq '1' ? : 5 4 9
$_ eq '0' ? : 41 8 49
2410 1 ▶ $@ and die $@;
Branch: 1 branch
BranchTrueFalseTotal
$@ and die $@ 0 1 1
2411 1 1
2412 }
2413  
2414 1 ▶test unless caller;
Branch: 1 branch
BranchTrueFalseTotal
unless caller 0 1 1
2415  
2416 1 1;
2417 # podDocumentation
2418 __DATA__
↑ Summary