diff --git a/README.md b/README.md index d15d4b8..ca3520a 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ compiler writers generate better code and documents the complexity of x86. * oversized immediates - `81C0 01000000` instead of `83C0 01` (ADD EAX, 1) * strength-reduce AND with immediate to movzbl -* suboptimal no-ops +* ~~suboptimal no-ops~~, see [#7](https://github.com/gaul/x86lint/issues/7) - multiple `90` instead of a single `60 90`, etc. * suboptimal zero register - MOV EAX, 0 instead of XOR EAX, EAX diff --git a/x86lint.c b/x86lint.c index 030dcf4..acca2c5 100644 --- a/x86lint.c +++ b/x86lint.c @@ -552,6 +552,8 @@ int check_instructions(const uint8_t *inst, size_t len) ++errors; } + // TODO: Disabled due to false positives from CMOV sequences. See #7. + /* result = check_mov_zero(&xedd); if (!result) { printf("suboptimal zero register at offset: %zu\n", offset); @@ -560,6 +562,7 @@ int check_instructions(const uint8_t *inst, size_t len) printf("\n"); ++errors; } + */ result = check_implicit_register(&xedd); if (!result) { diff --git a/x86lint_test.c b/x86lint_test.c index b336505..189c10f 100644 --- a/x86lint_test.c +++ b/x86lint_test.c @@ -253,7 +253,10 @@ int main(int argc, char *argv[]) 0x48, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // mov rax, 0 0x05, 0x80, 0x00, 0x00, 0x00, // add eax, 0x80 0x40, 0xc9, // leave + // TODO: Disabled due to false positives from CMOV sequences. See #7. + /* 0xB8, 0x00, 0x00, 0x00, 0x00, // mov eax, 0 + */ 0x81, 0xC0, 0x00, 0x01, 0x00, 0x00, // add eax, 0x100 0x05, 0x01, 0x00, 0x00, 0x00, // add eax, 1 0xc1, 0xd0, 0x01, // rcl eax, 1 @@ -261,7 +264,7 @@ int main(int argc, char *argv[]) 0x67, 0x0f, 0xc1, 0x18, // xadd [eax], ebx 0xf0, 0x87, 0x07, // lock xchg [eax], ebx }; - int expected = 11; + int expected = 10; int actual = check_instructions(inst, sizeof(inst)); if (actual != expected) { printf("Expected %d errors, actual: %d\n", expected, actual);