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

_mm512_add_ph
ADD TO COMPARE ADDED TO COMPARE

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

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

Example:
#include <immintrin.h>
#include <stdio.h>
int main() {
 __m512h a = _mm512_set_ph(        1.0f, 2.0f, 3.0f, 4.0f,         5.0f, 6.0f, 7.0f, 8.0f,        9.0f, 10.0f, 11.0f, 12.0f,        13.0f, 14.0f, 15.0f, 16.0f,        17.0f, 18.0f, 19.0f, 20.0f,        21.0f, 22.0f, 23.0f, 24.0f,        25.0f, 26.0f, 27.0f, 28.0f,        29.0f, 30.0f, 31.0f, 32.0f    );
 __m512h b = _mm512_set_ph(        32.0f, 31.0f, 30.0f, 29.0f,         28.0f, 27.0f, 26.0f, 25.0f,        24.0f, 23.0f, 22.0f, 21.0f,        20.0f, 19.0f, 18.0f, 17.0f,        16.0f, 15.0f, 14.0f, 13.0f,        12.0f, 11.0f, 10.0f, 9.0f,        8.0f, 7.0f, 6.0f, 5.0f,        4.0f, 3.0f, 2.0f, 1.0f    );
 __m512h d = _mm512_add_ph(a, b);
 _Float16 result[32];
 _mm512_storeu_ph(result, d);
 for (int i = 0; i < 32; i++) {
   printf("%f ", result[i]);
  }
  printf("\n");

  return 0;
 }

Prototypes

Assembly Instruction:
vaddph
Usage:
__m512h result = _mm512_add_ph( __m512h a, __m512h 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