I am implementing a C defined function in assembler. The function is as follows
extern void swapNums(float* one,float* two,float* three);
A) swapNums accepts 3 references to a float, and then places the smallest of these 3 values in 'one', the middle value in 'two' and the largest of the three values in 'three'.
I want to know:
Which registers are used to store the references to the 3 floats, i.e. Is it rsi,rdi,rdx... or is it xmm0,xmm1,xmm3 ...
How do I change the value in *one, *two, *three so that i can satisfy A)
I am accustomed to implementing C functions in assembler when the parameters of the function are passed by value. For example when dealing with floating point parameters, I follow the conventions below:
section .data
global <name of function>
<name of function>:
movss [x1], xmm0 ; move the first parameter into memory location x1
movss [x2], xmm1 ; move the second parameter into memory location x2
movss [xNorm], xmm2 ; move the third parameter into memory location x3
and then link the object files of the .asm and .c files when creating an executable
float testAbi(float *one) { return *one; }and compile it with assembly listing to see how C would work with that pointer. - Ped7g