summaryrefslogtreecommitdiff
path: root/3/11_floating_point/54_funct2.c
diff options
context:
space:
mode:
Diffstat (limited to '3/11_floating_point/54_funct2.c')
-rw-r--r--3/11_floating_point/54_funct2.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/3/11_floating_point/54_funct2.c b/3/11_floating_point/54_funct2.c
new file mode 100644
index 0000000..66c26c8
--- /dev/null
+++ b/3/11_floating_point/54_funct2.c
@@ -0,0 +1,16 @@
+double funct2(double w, int x, float y, long z)
+{
+ return x*y - w/z;
+}
+
+// double funct2(double w, int x, float y, long z)
+// w in xmm0, x in edi, y in xmm1, z in rsi
+// funct2:
+// vcvtsi2ss %edi, %xmm2, %xmm2 // convert int to float
+// vmulss %xmm1, %xmm2, %xmm1 // xmm1<- x*y, multiply sencond and third float
+// vunpcklps %xmm1, %xmm1, %xmm1 // do convert float to double?
+// vcvtps2pd %xmm1, %xmm2 // do convert float to double?
+// vcvtsi2sdq %rsi, %xmm1, %xmm1 // xmm1 <- z, convert long to double?
+// vdivsd %xmm1, %xmm0, %xmm0 // xmm0<- w/z
+// vsubsd %xmm0, %xmm2, %xmm0 // xmm0<- (x*y) - w/z
+// ret