translate: more float stuff
[ia32rtools.git] / tests / x87.expect.c
CommitLineData
d4a985bd 1int sub_test(int a1, int a2)
2{
16057ce1 3 union { u32 d[8]; u16 w[16]; u8 b[32]; double q[4]; } sf;
d4a985bd 4 u32 eax;
5 u32 edx;
6 double f_st0;
7 double f_st1;
16057ce1 8 u16 f_sw;
30620174 9 double fs_1;
10 double fs_3;
16057ce1 11 u32 cond_z;
d4a985bd 12
13 f_st0 = (double)(s32)sf.d[0]; // var_20 fild
14 f_st0 /= (double)(s32)a1; // arg_0
2c31fb4c 15 f_st0 *= sf.q[1]; // var_18
fe18df39 16 f_st1 = f_st0; f_st0 = (double)(s32)sf.d[0]; // var_20 fild
d4a985bd 17 f_st1 /= f_st0;
18 f_st0 = f_st1 + f_st0;
2c31fb4c 19 f_st1 = f_st0; f_st0 = sf.q[1]; // var_18 fld
30620174 20 fs_3 = f_st0; f_st0 = f_st1; // fst
21 fs_1 = f_st0; // fst
22 f_st0 = pow(fs_1, fs_3);
2c31fb4c 23 f_sw = f_st0 <= sf.q[1] ? 0x4100 : 0; // var_18 z_chk_det
16057ce1 24 eax = 0;
25 LOWORD(eax) = f_sw;
26 cond_z = ((u8)((u8)(eax >> 8) & 0x41) == 0);
27 eax = 0;
28 LOBYTE(eax) = (cond_z);
fe18df39 29 f_st1 = f_st0; f_st0 = 1.0;
2c31fb4c 30 f_st0 = sf.q[1] / f_st0; // var_18
fe18df39 31 { double t = f_st0; f_st0 = f_st1; f_st1 = t; } // fxch
32 f_st0 = -f_st0;
33 f_st0 = f_st1;
622eb2ef 34 f_st1 = f_st0; // fld st
8c83cc48 35 f_st0 = f_st1 * log2(f_st0); // fyl2x
fe18df39 36 f_st1 = f_st0; // fld st
16057ce1 37 sf.d[0] = (s32)f_st0; f_st0 = f_st1; // var_20 fist
2c31fb4c 38 sf.q[1] = f_st0; // var_18 fst
d4a985bd 39 eax = (s32)f_st0; // ftol
40 return eax;
41}
42