Skip to content

util: Replace inline assembly with SSE intrinsics for float-to-half conversion

What does this MR do and why?

util: Replace inline assembly with SSE intrinsics for float-to-half conversion

This change optimizes the float-to-half conversion function by replacing
direct inline assembly with SSE intrinsics, improving readability,
maintainability, and accuracy.

Advantages of using SSE over ASM:
- SSE intrinsics provide better optimization and performance.
- It ensures better accuracy through functions designed by the
  processor manufacturers.
- SSE intrinsics improve code portability and maintainability over
  inline assembly.

Changes include:
- Introduction of _mesa_float_to_half_optimized function in
  half_float.c, which utilizes SSE intrinsics to perform
  the conversion.
- Inline function _mesa_float_to_half in half_float.h now calls the
  optimized function when SSE is available.
- Maintained the existing slow path function for non-SSE compatible
  environments.
- Followed 3-space indentation and a 78-character line limit.

This change results in a more efficient and accurate float-to-half
conversion while maintaining compatibility with processors that do
not support SSE.

Change-Id: I84a8f21c534b1118df25d1c2189c331e668cf427
Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>

Merge request reports

Loading