_mm_cvtt_ps2pi
Microsoft Specific
Generates the Convert Packed Single-Precision Floating-Point Values to Packed Doubleword Integers (cvtps2pi) instruction, which converts the floating-point values in the first two elements in the __m128 structure valueto 32-bit integers and returns an __m64 structure containing the two 32-bit integers.
__m64 _mm_cvtt_ps2pi(
__m128 value
);
Parameters
- [in] value
An __m128 structure containing four single-precision floating-point values.
Return Value
An __m64 structure containing the two 32-bit integers resulting from the conversion.
Requirements
Intrinsic |
Architecture |
---|---|
_mm_cvtt_ps2pi |
x86 with SSE2 |
Header file <intrin.h>
Remarks
This intrinsic differs from _mm_cvt_ps2pi only in that the floating-point values are truncated rather than rounded according to the setting of the MXCSR register.
Because __m128 represents an XMM register and __m64 represents an MMX register, this intrinsic generates an instruction that operates on these registers directly and does not involve system memory.
This routine is only available as an intrinsic.
Example
// _mm_cvtt_ps2pi.cpp
// processor: x86
#include <intrin.h>
#include <stdio.h>
#pragma intrinsic(_mm_cvtt_ps2pi)
int main()
{
__m128 a;
__m64 b;
float af[4] = { 101.5, 200.5,300.5, 400.5 };
// Load a with the floating point values
// _mm_loadu_ps allowed unaligned addresses
a = _mm_loadu_ps(af);
//
b = _mm_cvtt_ps2pi(a);
// Return to floating point
_mm_empty();
// Print out the values in b
printf_s("%d %d\n", b.m64_i32[0], b.m64_i32[1]);
}
101 200