translate: initial float support
[ia32rtools.git] / tests / x87.expect.c
diff --git a/tests/x87.expect.c b/tests/x87.expect.c
new file mode 100644 (file)
index 0000000..d114f10
--- /dev/null
@@ -0,0 +1,27 @@
+int sub_test(int a1, int a2)
+{
+  union { u32 d[8]; u8 b[32]; double q[4]; } sf;
+  u32 eax;
+  u32 edx;
+  double f_st0;
+  double f_st1;
+
+  f_st0 = (double)(s32)sf.d[0];  // var_20 fild
+  f_st0 /= (double)(s32)a1;  // arg_0
+  f_st0 *= *((double *)(u32)&sf.q[1]);  // var_18
+  f_st1 = f_st0;
+  f_st0 = (double)(s32)sf.d[0];  // var_20 fild
+  f_st1 /= f_st0;
+  f_st0 = f_st1 + f_st0;
+  f_st1 = f_st0;
+  f_st0 = 1.0;
+  f_st0 = *((double *)(u32)&sf.q[1]) / f_st0;  // var_18
+  f_st1 = f_st0;
+  f_st0 = f_st1;  // fld
+  *((double *)(u32)&sf.q[1]) = f_st0;
+  f_st0 = f_st1;  // var_18 fst
+  *((float *)(u32)&sf.d[0]) = f_st0;  // var_20 fst
+  eax = (s32)f_st0;  // ftol
+  return eax;
+}
+