SSE_ALL-Swizzle-MMX

SSE_ALL-Swizzle-MMX#

_m_pextrw#

Tech:

SSE_ALL

Category:

Swizzle

Header:

xmmintrin.h

Searchable:

SSE_ALL-Swizzle-MMX

Register:

MMX 64 bit

Return Type:

int

Param Types:

__m64 a, int imm8

Param ETypes:

UI16 a, IMM imm8

int _m_pextrw(__m64 a, int imm8);

Intel Description

Extract a 16-bit integer from “a”, selected with “imm8”, and store the result in the lower element of “dst”.

Intel Implementation Psudeo-Code

dst[15:0] := (a[63:0] >> (imm8[1:0] * 16))[15:0]
dst[31:16] := 0

_m_pinsrw#

Tech:

SSE_ALL

Category:

Swizzle

Header:

xmmintrin.h

Searchable:

SSE_ALL-Swizzle-MMX

Register:

MMX 64 bit

Return Type:

__m64

Param Types:

__m64 a, int i, int imm8

Param ETypes:

UI16 a, UI16 i, IMM imm8

__m64 _m_pinsrw(__m64 a, int i, int imm8);

Intel Description

Copy “a” to “dst”, and insert the 16-bit integer “i” into “dst” at the location specified by “imm8”.

Intel Implementation Psudeo-Code

dst[63:0] := a[63:0]
sel := imm8[1:0]*16
dst[sel+15:sel] := i[15:0]

_m_pshufw#

Tech:

SSE_ALL

Category:

Swizzle

Header:

xmmintrin.h

Searchable:

SSE_ALL-Swizzle-MMX

Register:

MMX 64 bit

Return Type:

__m64

Param Types:

__m64 a, int imm8

Param ETypes:

UI16 a, IMM imm8

__m64 _m_pshufw(__m64 a, int imm8);

Intel Description

Shuffle 16-bit integers in “a” using the control in “imm8”, and store the results in “dst”.

Intel Implementation Psudeo-Code

DEFINE SELECT4(src, control) {
        CASE(control[1:0]) OF
        0:      tmp[15:0] := src[15:0]
        1:      tmp[15:0] := src[31:16]
        2:      tmp[15:0] := src[47:32]
        3:      tmp[15:0] := src[63:48]
        ESAC
        RETURN tmp[15:0]
}
dst[15:0] := SELECT4(a[63:0], imm8[1:0])
dst[31:16] := SELECT4(a[63:0], imm8[3:2])
dst[47:32] := SELECT4(a[63:0], imm8[5:4])
dst[63:48] := SELECT4(a[63:0], imm8[7:6])