AVX Instruction Class
AVX instructions are Intel internal instructions and can be used only on x86 servers. The instruction names and functions implemented by the AVX2KI library are the same as those of the AVX instructions.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include "avx2ki.h" void AvxExample() { int32_t a[4] = {-5, 13, 4, -20}; int32_t b[4] = {12, 3, 0, 7}; int32_t c[4] = {0}; __m128i t1 = _mm_load_epi32(a); __m128i t2 = _mm_load_epi32(b); __m128i dst = _mm_add_epi32(t1, t2); _mm_store_epi32(c, dst); printf("dst: %d %d %d %d\n", c[0], c[1], c[2], c[3]); } int main(void) { AvxExample(); return 0; } |
Output:
dst: 7 16 4 -13
Parent topic: Function Syntax