I have an array of number from 0-255. I want to calculate 255 - elem for each element in the array with inline assembly in C using SSE instructions.
this is my code:
#include <stdio.h>
int main(){
__declspec(align(16)) float a[5] = {250, 18, 48, 16, 15};
__declspec(align(16)) float constant = 255;
_asm{
movups xmm0, [a]
}
return 0;
}
how can I do that ?
actually I know I can do this:
int main(){
const array_number = 5;
__declspec(align(16)) float ff = 4;
__declspec(align(16)) float a[5] = {250, 18, 48, 16, 15};
__declspec(align(16)) float b[5] = {255,255,255,255,255};
__declspec(align(16)) float res[5];
_asm{
mov ecx, array_number
movups xmm0, [a]
movups xmm1, [b]
subps xmm1, xmm0
movups [res], xmm1
}
return 0;
}
but if array a size grows I hove to increase numbers in array b.