I'm reading the research paper Privado: Practical and Secure DNN Inference to hide the input-dependent branch. I am trying to understand the following GCC assembly code in that paper:
float temp;asm volatile("fld %2 \n""fld %3 \n""fcomi \n""fcmovbe %%st(1), %%st \n""fstp %0 \n""fstp %1 \n" :"=m"(maxval), "=m"(temp) :"m"(val), "m"(maxval));
I am confused about what each line of the code means. What does %%st(1),%%st
mean? Why are there %0
,%1
,%2
,%3
when there are only three variables temp
, maxval
and val
?
I know the function of this code is similar to:
if(val>maxval) maxval=val;
But I don't know how the code operates internally. I want to change the code slightly into:
if(val>maxval) val2=maxval;
where val2
is a new variable