translate: fcom and more
[ia32rtools.git] / tests / ops.expect.c
CommitLineData
3947cf24 1int sub_test()
2{
3 u32 eax;
4 u32 ebx;
5 u32 ecx;
6 u32 edx;
7 u32 esi;
8 u32 edi;
9 u32 cond_z;
622eb2ef 10 u64 tmp64;
3947cf24 11
12 ebx = 0x10000;
13 esi = 0x20000;
14 edi = 0x30000;
15 ecx = 0x0a;
16
17loop:
18 LOBYTE(eax) = *(u8 *)esi; esi += 1; // lods
19 LOBYTE(eax) = *(u8 *)(ebx + LOBYTE(eax)); // xlat
20 *(u8 *)edi = eax; edi += 1; // stos
21 LOWORD(eax) = *(u16 *)esi; esi += 2; // lods
22 LOWORD(eax) = -(s16)(u16)eax;
23 *(u16 *)edi = eax; edi += 2; // stos
24 eax = *(u32 *)esi; esi += 4; // lods
25 *(u32 *)edi = eax; edi += 4; // stos
26 *(u8 *)edi = *(u8 *)esi; edi += 1; esi += 1; // movs
27 cond_z = (*(u16 *)esi == *(u16 *)edi); esi += 2; edi += 2; // cmps
28 cond_z = ((u8)eax == *(u8 *)edi); edi += 1; // scas
29 if (--ecx != 0)
30 goto loop; // loop
31 *(u8 *)edi = eax; edi -= 1; // stos
32 *(u16 *)edi = eax; edi -= 2; // stos
33 *(u32 *)edi = eax; edi -= 4; // stos
34 edx = (s32)eax >> 31; // cdq
35 eax = ecx ? __builtin_ffs(ecx) - 1 : 0; // bsf
622eb2ef 36 tmp64 = ((u64)edx << 32) | eax;
37 tmp64 = (s64)tmp64 <<= LOBYTE(ecx);
38 edx = tmp64 >> 32; eax = tmp64; // allshl
39 tmp64 = ((u64)edx << 32) | eax;
40 tmp64 = (s64)tmp64 >>= LOBYTE(ecx);
41 edx = tmp64 >> 32; eax = tmp64; // allshr
42 eax = __builtin_bswap32(eax);
3947cf24 43 eax = 1;
44 return eax;
45}
46