This library provides a set of SIMD-accelerated routines for performing vector mathematics on x86 architectures. It is implemented in x86 assembly to leverage the power of SIMD (Single Instruction, Multiple Data) instructions, offering significant performance improvements for vector operations.
- High Performance: Leverages SIMD instructions(SSE) to perform vector math operations efficiently.
- Assembly Optimization: Written in x86 assembly for maximum control over instruction usage and performance.
- Wide Range of Operations: Includes basic operations like addition, subtraction, multiplication, and dot product, as well as more complex functions like vector normalization.
- Supports Various Data Types: Handles vectors with different data types, including 32-bit and 64-bit floating-point numbers.
- x86 CPU with support for SSE instructions.
- nasm (>= 2.15)
- C/C++ compiler for linking the library with higher-level code (optional).
make
#include <stdio.h>
#include <stdlib.h>
#include "vml.h"
int main(int argc, char** argv) {
float v1[] = {1, 3, 5, 7, 9};
float v2[] = {2, 4, 6, 8, 10};
float result[5];
unsigned int size = sizeof(v1)/sizeof(float);
_vec_add(result, v1, v2, size);
for (int i = 0; i < size; i++) {
printf("%f\n", result[i]);
}
return 0;
}
➜ bin git:(main) ✗ ./benchmark
No SIMD: 0.000004s
SIMD: 0.000002s
Contributions are welcome! Please submit a pull request or open an issue to discuss changes.
This project is licensed under the LGPL License. See the LICENSE file for details.
Developed by M. Sami Gürpınar