The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Name

Simd::Avx512 - Emulate SIMD instructions

Synopsis

Help needed please!

Description

Emulate SIMD instructions

Version 20210121.

The following sections describe the methods in each functional area of this module. For an alphabetic listing of all methods by name see Index.

Instructions

Emulation of Avx512 instructions

PSLLDQ($xmm1, $imm8)

Packed Shift Left Logical DoubleQword

     Parameter  Description
  1  $xmm1      Bytes
  2  $imm8      Length of shift

Example:

  is_deeply  PSLLDQ(repeat("$b55$b33",  8), 1), repeat(repeat("$b33$b55", 7)."$b33$b00", 1);   # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲

  

VPSLLDQ($xmm1, $imm8)

Packed Shift Left Logical DoubleQword

     Parameter  Description
  1  $xmm1      Bytes
  2  $imm8      Length of shift

Example:

  is_deeply VPSLLDQ(repeat("$b55$b33", 16), 1), repeat(repeat("$b33$b55", 7)."$b33$b00", 2);   # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲

  

PSRLDQ($xmm1, $imm8)

Packed Shift Right Logical DoubleQword

     Parameter  Description
  1  $xmm1      Bytes
  2  $imm8      Length of shift

Example:

  is_deeply  PSRLDQ(repeat("$b55$b33",  8), 1), repeat("$b00$b55".repeat("$b33$b55", 7), 1);   # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲

  

VPSRLDQ($xmm1, $imm8)

Packed Shift Right Logical DoubleQword

     Parameter  Description
  1  $xmm1      Bytes
  2  $imm8      Length of shift

Example:

  is_deeply VPSRLDQ(repeat("$b55$b33", 16), 1), repeat("$b00$b55".repeat("$b33$b55", 7), 2);   # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲

  

PCMPEQB($xmm1, $xmm2)

Packed CoMPare EQual Byte

     Parameter  Description
  1  $xmm1      Bytes
  2  $xmm2      Bytes

Example:

    is_deeply  PCMPEQB(repeat("$b00$b01$b02$b03",  4),  # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲

                       repeat("$b06$b05$b04$b03",  4)),
               repeat("$b00$b00$b00$bff",  4);
  

VPCMPEQB($k2, $xmm1, $xmm2)

Packed CoMPare EQual Byte with optional masking

     Parameter  Description
  1  $k2        Optional input mask
  2  $xmm1      Bytes
  3  $xmm2      Bytes

Example:

    is_deeply VPCMPEQB(repeat("$b00$b01$b02$b03",  8),  # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲

                       repeat("$b06$b05$b04$b03",  8)),
              repeat("$b00$b00$b00$bff",  8);
  
  
    is_deeply VPCMPEQB(                                                           # 128  # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲

  #Q0                                                               1                                                               2                                                               3                                                               4                                                               5                                                               6                                                               7                                                               8
  #D0                               1                               2                               3                               4                               5                               6                               7                               0                               1                               2                               3                               4                               5                               6                               7                               8
  #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
  #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
  #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
   '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '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',
                                                                                                                                                                                                                                                                                                                                                                                                   '00000001000010000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
                                                                                                                                                                                                                                                                                                                                                                                                   '10000001000010000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
  ),
   '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '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';
  

VPCMPUB($k2, $xmm1, $xmm2, $op)

Packed CoMPare Unsigned Byte

     Parameter  Description
  1  $k2        Input mask
  2  $xmm1      Bytes
  3  $xmm2      Bytes
  4  $op        Test code

Example:

    is_deeply VPCMPUB(                                                            # 256  # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲

  #Q0                                                               1                                                               2                                                               3                                                               4                                                               5                                                               6                                                               7                                                               8
  #D0                               1                               2                               3                               4                               5                               6                               7                               0                               1                               2                               3                               4                               5                               6                               7                               8
  #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
  #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
  #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
   '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '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'.    '0',
                                                                                                                                                                                                                                                                   '0000000100001000000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
                                                                                                                                                                                                                                                                   '1000000100001000000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
  0),
   '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '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';
  
  
    is_deeply VPCMPUB(                                                            # 512  # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲

  #Q0                                                               1                                                               2                                                               3                                                               4                                                               5                                                               6                                                               7                                                               8
  #D0                               1                               2                               3                               4                               5                               6                               7                               0                               1                               2                               3                               4                               5                               6                               7                               8
  #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
  #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
  #b012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345678
   '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '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'.    '0',
   '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100001000000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
   '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000100001000000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
  0),
   '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '0'.    '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';
  

Index

1 PCMPEQB - Packed CoMPare EQual Byte

2 PSLLDQ - Packed Shift Left Logical DoubleQword

3 PSRLDQ - Packed Shift Right Logical DoubleQword

4 VPCMPEQB - Packed CoMPare EQual Byte with optional masking

5 VPCMPUB - Packed CoMPare Unsigned Byte

6 VPSLLDQ - Packed Shift Left Logical DoubleQword

7 VPSRLDQ - Packed Shift Right Logical DoubleQword

Installation

This module is written in 100% Pure Perl and, thus, it is easy to read, comprehend, use, modify and install via cpan:

  sudo cpan install Simd::Avx512

Author

philiprbrenan@gmail.com

http://www.appaapps.com

Copyright

Copyright (c) 2016-2019 Philip R Brenan.

This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.