Intrinsics for Converting Half Floats

There are four intrinsics for converting half-floats to 32-bit floats and 32-bit floats to half-floats. The prototypes for these half-float conversion intrinsics are in the emmintrin.h file.

float _cvtsh_ss(unsigned short x, int imm);

This intrinsic takes a half-float value, x, and converts it to a 32-bit float value, which is returned.

unsigned short _cvtss_sh(float x, int imm);

This intrinsic takes a 32-bit float value, x, and converts it to a half-float value, which is returned.

__m128 _mm_cvtph_ps(__m128i x, int imm);

This intrinsic takes four packed half-float values and converts them to four 32-bit float values, which are returned. The upper 64-bits of x are ignored. The lower 64-bits are taken as four 16-bit float values for conversion.

__m128i _mm_cvtps_ph(_m128 x, int imm);

This intrinsic takes four packed 32-bit float values and converts them to four half-float values, which are returned. The upper 64-bits in the returned result are all zeros. The lower 64-bits contain the four packed 16-bit float values.

See Also


Submit feedback on this help topic

Copyright © 1996-2011, Intel Corporation. All rights reserved.