X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Fops.expect.c;fp=tests%2Fops.expect.c;h=3b59db124d666a61ceaf70aa3396021301ebb4fb;hb=3947cf245e051c129e15fda46120c93154b804c4;hp=0000000000000000000000000000000000000000;hpb=851f9b7d78b364c14175a509af885d145a094ec0;p=ia32rtools.git diff --git a/tests/ops.expect.c b/tests/ops.expect.c new file mode 100644 index 0000000..3b59db1 --- /dev/null +++ b/tests/ops.expect.c @@ -0,0 +1,38 @@ +int sub_test() +{ + u32 eax; + u32 ebx; + u32 ecx; + u32 edx; + u32 esi; + u32 edi; + u32 cond_z; + + ebx = 0x10000; + esi = 0x20000; + edi = 0x30000; + ecx = 0x0a; + +loop: + LOBYTE(eax) = *(u8 *)esi; esi += 1; // lods + LOBYTE(eax) = *(u8 *)(ebx + LOBYTE(eax)); // xlat + *(u8 *)edi = eax; edi += 1; // stos + LOWORD(eax) = *(u16 *)esi; esi += 2; // lods + LOWORD(eax) = -(s16)(u16)eax; + *(u16 *)edi = eax; edi += 2; // stos + eax = *(u32 *)esi; esi += 4; // lods + *(u32 *)edi = eax; edi += 4; // stos + *(u8 *)edi = *(u8 *)esi; edi += 1; esi += 1; // movs + cond_z = (*(u16 *)esi == *(u16 *)edi); esi += 2; edi += 2; // cmps + cond_z = ((u8)eax == *(u8 *)edi); edi += 1; // scas + if (--ecx != 0) + goto loop; // loop + *(u8 *)edi = eax; edi -= 1; // stos + *(u16 *)edi = eax; edi -= 2; // stos + *(u32 *)edi = eax; edi -= 4; // stos + edx = (s32)eax >> 31; // cdq + eax = ecx ? __builtin_ffs(ecx) - 1 : 0; // bsf + eax = 1; + return eax; +} +