'How to sum two integer vectors in asm [duplicate]

Using SIMD instructions and pure assembly, make a function to add efficiently any size of integer vectors.

input: int v[] = {1, 2, 3, 4, 5} , j[] = {2, 3, 4, 5, 6}

output : int sum[] ={3, 5, 7, 9, 11}

code in C++:

int main() {

int v[10000], r[10000], sum[10000];

for (int i = 0; i < 10000; i++) {
    v[i] = i;
    r[i] = i;
    sum[i] = r[i] + v[i];

}
//Somatorio de dois vetores de inteiros 
printf("    Somatorio dos dois vetores : \n");
for (int i = 0; i < 10000; i++) {
    printf("    %d", sum[i]);
}

return 0; 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source