Please enter what you're looking for to continue your search
 

_mm_add_ph
ADD TO COMPARE ADDED TO COMPARE

 Location: Arithmetic  >  Vector Add
 CPU Extensions: AVX512_FP16, AVX512VL
Purpose:
Add packed half-precision (16-bit) floating-point elements in a and b, and store the results in output.
Result:

A 128-bit vector containing the result of the addition.

Example:
#include <immintrin.h>
#include <stdio.h>
int main() {
 __m128h a = _mm_set_ph(        1.0f, 2.0f, 3.0f, 4.0f,         5.0f, 6.0f, 7.0f, 8.0f    );
 __m128h b = _mm_set_ph(        8.0f, 7.0f, 6.0f, 5.0f,         4.0f, 3.0f, 2.0f, 1.0f    );
 __m128h d = _mm_add_ph(a, b);
 _Float16 result[8];
 _mm_storeu_ph(result, d);
 for (int i = 0; i < 8; i++) {
   printf("%f ", result[i]);
  }
  printf("\n");

  return 0;
 }

Prototypes

Assembly Instruction:
vaddph
Usage:
__m128h result = _mm_add_ph( __m128h a, __m128h b )
Performance Metrics:
📊 Unlock Performance Insights

Get access to detailed performance metrics including latency, throughput, and CPU-specific benchmarks for this intrinsic.

SIMD Intrinsics Summary
SIMD Engines: 6
C Intrinsics: 10444
NEON: 4353
AVX2: 405
AVX512: 4717
SSE4.2: 598
VSX: 192
IBM-Z: 179