Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Microsoft Specific
Emits the Streaming SIMD Extensions 4 (SSE4) instruction pmaxuw. This instruction chooses the larger value of the two parameters.
__m128i _mm_max_epu16(
__m128i a,
__m128i b
);
Parameters
[in] a
A 128-bit parameter that contains eight 16-bit unsigned integers.[in] b
A 128-bit parameter that contains eight 16-bit unsigned integers.
Return value
A 128-bit parameter that can be defined with the following equations:
r0 := (a0 > b0) ? a0 : b0
r1 := (a1 > b1) ? a1 : b1
...
r7 := (a7 > b7) ? a7 : b7
Requirements
Intrinsic |
Architecture |
---|---|
_mm_max_epu16 |
x86, x64 |
Header file <smmintrin.h>
Remarks
r0-r7, a0-a7, and b0-b7 are the sequentially ordered 16-bit components of return value r and parameters a and b. r0, a0, and b0 are the least significant 16 bits.
Before you use this intrinsic, software must ensure that the processor supports the instruction.
Example
#include <stdio.h>
#include <smmintrin.h>
int main ()
{
__m128i a, b;
a.m128i_u16[0] = 65535;
a.m128i_u16[1] = 128;
a.m128i_u16[2] = 128;
a.m128i_u16[3] = 128;
a.m128i_u16[4] = 17;
a.m128i_u16[5] = 39000;
a.m128i_u16[6] = 40000;
a.m128i_u16[7] = 0;
b.m128i_u16[0] = 65534;
b.m128i_u16[1] = 0;
b.m128i_u16[2] = 128;
b.m128i_u16[3] = 129;
b.m128i_u16[4] = 5740;
b.m128i_u16[5] = 1;
b.m128i_u16[6] = 45000;
b.m128i_u16[7] = 0;
__m128i res = _mm_max_epu16(a, b);
printf_s(" a\t b\t res\n%5d\t%5d\t%5d\n%5d\t%5d\t%5d\n",
a.m128i_u16[0], b.m128i_u16[0], res.m128i_u16[0],
a.m128i_u16[1], b.m128i_u16[1], res.m128i_u16[1]);
printf_s("%5d\t%5d\t%5d\n%5d\t%5d\t%5d\n%5d\t%5d\t%5d\n%5d\t%5d\t%5d\n",
a.m128i_u16[2], b.m128i_u16[2], res.m128i_u16[2],
a.m128i_u16[3], b.m128i_u16[3], res.m128i_u16[3],
a.m128i_u16[4], b.m128i_u16[4], res.m128i_u16[4],
a.m128i_u16[5], b.m128i_u16[5], res.m128i_u16[5]);
printf_s("%5d\t%5d\t%5d\n%5d\t%5d\t%5d\n",
a.m128i_u16[6], b.m128i_u16[6], res.m128i_u16[6],
a.m128i_u16[7], b.m128i_u16[7], res.m128i_u16[7]);
return 0;
}
a b res 65535 65534 65535 128 0 128 128 128 128 128 129 129 17 5740 5740 39000 1 39000 40000 45000 45000 0 0 0