Udostępnij za pośrednictwem


__m64_mux1

Microsoft Specific

Emits the IPF instruction mux1, the 1-byte form of the mux instruction, which is used to arrange bytes in a particular pattern specified by the second parameter.

__m64 __m64_mux1( 
   __m64 source, 
   const int permutation 
);

Parameters

  • [in] source
    The source data for the permutation operation.

  • [in] permutation
    Specifies the permutation of the source bytes in the result.

Requirements

Intrinsic

Architecture

__m64_mux1

IPF

Header file <intrin.h>

Remarks

The available patterns are specified in the following table.

Permutation

Operation

Description

0x0

@brcst

Copy the least significant byte to all bytes of the result.

0x8

@mix

Perform a Mix operation on the two halves of the source.

0x9

@shuf

Perform a Shuffle operation on the two halves of the source.

0xA

@alt

Perform an Alternate operation on the two halves of the source.

0xB

@rev

Reverse the order of the bytes.

Example

// mux1.cpp
// processor: IPF
#include <stdio.h>
#include <intrin.h>
#include <memory.h>

#pragma intrinsic(__m64_mux1)

void m64tochararray(__m64 m64, char* c)
{
    for (int j = 0; j < 8; j+)
        c[j] = m64.m64_i8[j];
}

void chararraytom64(const char* c, __m64* pm64)
{
    for (int j = 0; j < 8; j+)
        pm64->m64_i8[j] = c[j];
}

int main()
{
    char s1[9] = "01234567";
    char s2[9];
    __m64 m, result;

    printf_s("Source string:          %s\n", s1);

    memset(s2, 0, 9);
    chararraytom64(s1, &m);  
    result = __m64_mux1(m, 0); // @brcst form
    m64tochararray(result, s2);     
    printf_s("mux1 @brcst (0x0) form: %s\n", s2);

    memset(s2, 0, 9);
    chararraytom64(s1, &m);  
    result = __m64_mux1(m, 8); // @mix form
    m64tochararray(result, s2);     
    printf_s("mux1 @mix   (0x8) form: %s\n", s2);

    memset(s2, 0, 9);
    chararraytom64(s1, &m);  
    result = __m64_mux1(m, 9); // @shuf form
    m64tochararray(result, s2);     
    printf_s("mux1 @shuf  (0x9) form: %s\n", s2);

    memset(s2, 0, 9);
    chararraytom64(s1, &m);  
    result = __m64_mux1(m, 0xA); // @alt form
    m64tochararray(result, s2);     
    printf_s("mux1 @alt   (0xA) form: %s\n", s2);

    memset(s2, 0, 9);
    chararraytom64(s1, &m);  
    result = __m64_mux1(m, 0xB); // @rev form
    m64tochararray(result, s2);     
    printf_s("mux1 @rev   (0xB) form: %s\n", s2);
}

Source string: 01234567 mux1 @brcst (0x0) form: 00000000 mux1 @mix (0x8) form: 04261537 mux1 @shuf (0x9) form: 04152637 mux1 @alt (0xA) form: 02461357 mux1 @rev (0xB) form: 76543210

See Also

Reference

__m64

Compiler Intrinsics