_mm_max_epu32
Microsoft Specific
Emits the Streaming SIMD Extensions 4 (SSE4) instruction pmaxud. This instruction chooses the larger value of the two parameters.
__m128i _mm_max_epu32(
__m128i a,
__m128i b
);
Parameters
[in] a
A 128-bit parameter that contains four 32-bit unsigned integers.[in] b
A 128-bit parameter that contains four 32-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
r2 := (a2 > b2) ? a2 : b2
r3 := (a3 > b3) ? a3 : b3
Requirements
Intrinsic |
Architecture |
---|---|
_mm_max_epu32 |
x86, x64 |
Header file <smmintrin.h>
Remarks
r0-r3, a0-a3, and b0-b3 are the sequentially ordered 32-bit components of return value r and parameters a and b. r0, a0, and b0 are the least significant 32 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_u32[0] = 0;
a.m128i_u32[1] = 65000;
a.m128i_u32[2] = 128;
a.m128i_u32[3] = 200000;
b.m128i_u32[0] = 1;
b.m128i_u32[1] = 70000;
b.m128i_u32[2] = 127;
b.m128i_u32[3] = 100000;
__m128i res = _mm_max_epu32(a, b);
printf_s(" a\t b\t res\n");
printf_s("%6d\t%6d\t%6d\n%6d\t%6d\t%6d\n%6d\t%6d\t%6d\n%6d\t%6d\t%6d\n",
a.m128i_u32[0], b.m128i_u32[0], res.m128i_u32[0],
a.m128i_u32[1], b.m128i_u32[1], res.m128i_u32[1],
a.m128i_u32[2], b.m128i_u32[2], res.m128i_u32[2],
a.m128i_u32[3], b.m128i_u32[3], res.m128i_u32[3]);
return 0;
}
a b res
0 1 1
65000 70000 70000
128 127 128
200000 100000 200000