次の方法で共有


_mm_alignr_pi8

Microsoft Specific

Emits the Supplemental Streaming SIMD Extensions 3 (SSSE3) instruction palignr. This instruction extracts a 64-bit byte aligned value from the concatenation of the input parameters.

__m64 _mm_alignr_pi8( 
   __m64 a,
   __m64 b,
   const int ralign 
);

Parameters

  • [in] a
    A 64-bit parameter that contains eight 8-bit integers.

  • [in] b
    A 64-bit parameter that contains eight 8-bit integers.

  • [in] ralign
    An integer constant that specifies how many bytes to shift the interim result to the right.

Return value

r := (CONCAT(a, b) >> (ralign * 8)) & 0xffffffff

Requirements

Intrinsic

Architecture

_mm_alignr_pi8

x86, x64

Header file <tmmintrin.h>

Remarks

r is the 64-bit result value.

CONCAT(a, b) is the 128-bit unsigned intermediate value that is formed by concatenating parameters a and b. The result value is the rightmost 64 bits after shifting this intermediate result right by ralign bytes.

If ralign > 16, the result value is zero.

Before using this intrinsic, software must ensure that the processor supports the instruction.

Example

// _mm_alignr_pi8
#include <stdio.h>
#include <tmmintrin.h>

int main () {
    __m64 a, b;

    a.m64_u32[1] = 0x01234567;
    a.m64_u32[0] = 0x89ABCDEF;
    b.m64_u32[1] = 0xFFDDEECC;
    b.m64_u32[0] = 0xBBAA9988;

    // A right align value of four should remove the lowest 4 bytes of "b"
    __m64 res = _mm_alignr_pi8( a, b, 4 );

    printf_s("Original a: 0x%016I64x\nOriginal b: 0x%016I64x\n",
        a.m64_u64, b.m64_u64);
    printf_s("Result res: 0x%016I64x\n",
        res.m64_u64);

    _mm_empty();

    return 0;
}
Original a: 0x0123456789abcdef
Original b: 0xffddeeccbbaa9988
Result res: 0x89abcdefffddeecc

See Also

Reference

Compiler Intrinsics