Get division on x86/AMD64 a closer approximation of what is correct

This commit is contained in:
Jeremiah Orians 2019-11-29 12:55:55 -05:00
parent 30a09a592b
commit 64a3a1b674
No known key found for this signature in database
GPG Key ID: 5410E91C14959E87
5 changed files with 23 additions and 21 deletions

View File

@ -737,8 +737,8 @@ void additive_expr_stub()
arithmetic_recursion(postfix_expr, "ADD_ebx_to_eax\n", "ADD_ebx_to_eax\n", "+", additive_expr_stub);
arithmetic_recursion(postfix_expr, "SUBTRACT_eax_from_ebx_into_ebx\nMOVE_ebx_to_eax\n", "SUBTRACT_eax_from_ebx_into_ebx\nMOVE_ebx_to_eax\n", "-", additive_expr_stub);
arithmetic_recursion(postfix_expr, "MULTIPLYS_eax_by_ebx_into_eax\n", "MULTIPLY_eax_by_ebx_into_eax\n", "*", additive_expr_stub);
arithmetic_recursion(postfix_expr, "XCHG_eax_ebx\nLOAD_IMMEDIATE_edx %0\nDIVIDES_eax_by_ebx_into_eax\n", "XCHG_eax_ebx\nLOAD_IMMEDIATE_edx %0\nDIVIDE_eax_by_ebx_into_eax\n", "/", additive_expr_stub);
arithmetic_recursion(postfix_expr, "XCHG_eax_ebx\nLOAD_IMMEDIATE_edx %0\nMODULUSS_eax_from_ebx_into_ebx\nMOVE_edx_to_eax\n", "XCHG_eax_ebx\nLOAD_IMMEDIATE_edx %0\nMODULUS_eax_from_ebx_into_ebx\nMOVE_edx_to_eax\n", "%", additive_expr_stub);
arithmetic_recursion(postfix_expr, "XCHG_eax_ebx\nCDTQ\nDIVIDES_eax_by_ebx_into_eax\n", "XCHG_eax_ebx\nLOAD_IMMEDIATE_edx %0\nDIVIDE_eax_by_ebx_into_eax\n", "/", additive_expr_stub);
arithmetic_recursion(postfix_expr, "XCHG_eax_ebx\nCDTQ\nMODULUSS_eax_from_ebx_into_ebx\nMOVE_edx_to_eax\n", "XCHG_eax_ebx\nCDTQ\nMODULUS_eax_from_ebx_into_ebx\nMOVE_edx_to_eax\n", "%", additive_expr_stub);
arithmetic_recursion(postfix_expr, "COPY_eax_to_ecx\nCOPY_ebx_to_eax\nSAL_eax_cl\n", "COPY_eax_to_ecx\nCOPY_ebx_to_eax\nSAL_eax_cl\n", "<<", additive_expr_stub);
arithmetic_recursion(postfix_expr, "COPY_eax_to_ecx\nCOPY_ebx_to_eax\nSAR_eax_cl\n", "COPY_eax_to_ecx\nCOPY_ebx_to_eax\nSAR_eax_cl\n", ">>", additive_expr_stub);
}
@ -747,8 +747,8 @@ void additive_expr_stub()
arithmetic_recursion(postfix_expr, "ADD_rbx_to_rax\n", "ADD_rbx_to_rax\n", "+", additive_expr_stub);
arithmetic_recursion(postfix_expr, "SUBTRACT_rax_from_rbx_into_rbx\nMOVE_rbx_to_rax\n", "SUBTRACT_rax_from_rbx_into_rbx\nMOVE_rbx_to_rax\n", "-", additive_expr_stub);
arithmetic_recursion(postfix_expr, "MULTIPLYS_rax_by_rbx_into_rax\n", "MULTIPLY_rax_by_rbx_into_rax\n", "*", additive_expr_stub);
arithmetic_recursion(postfix_expr, "XCHG_rax_rbx\nLOAD_IMMEDIATE_rdx %0\nDIVIDES_rax_by_rbx_into_rax\n", "XCHG_rax_rbx\nLOAD_IMMEDIATE_rdx %0\nDIVIDE_rax_by_rbx_into_rax\n", "/", additive_expr_stub);
arithmetic_recursion(postfix_expr, "XCHG_rax_rbx\nLOAD_IMMEDIATE_rdx %0\nMODULUSS_rax_from_rbx_into_rbx\nMOVE_rdx_to_rax\n", "XCHG_rax_rbx\nLOAD_IMMEDIATE_rdx %0\nMODULUS_rax_from_rbx_into_rbx\nMOVE_rdx_to_rax\n", "%", additive_expr_stub);
arithmetic_recursion(postfix_expr, "XCHG_rax_rbx\nCQTO\nDIVIDES_rax_by_rbx_into_rax\n", "XCHG_rax_rbx\nLOAD_IMMEDIATE_rdx %0\nDIVIDE_rax_by_rbx_into_rax\n", "/", additive_expr_stub);
arithmetic_recursion(postfix_expr, "XCHG_rax_rbx\nCQTO\nMODULUSS_rax_from_rbx_into_rbx\nMOVE_rdx_to_rax\n", "XCHG_rax_rbx\nCQTO\nMODULUS_rax_from_rbx_into_rbx\nMOVE_rdx_to_rax\n", "%", additive_expr_stub);
arithmetic_recursion(postfix_expr, "COPY_rax_to_rcx\nCOPY_rbx_to_rax\nSAL_rax_cl\n", "COPY_rax_to_rcx\nCOPY_rbx_to_rax\nSAL_rax_cl\n", "<<", additive_expr_stub);
arithmetic_recursion(postfix_expr, "COPY_rax_to_rcx\nCOPY_rbx_to_rax\nSAR_rax_cl\n", "COPY_rax_to_rcx\nCOPY_rbx_to_rax\nSAR_rax_cl\n", ">>", additive_expr_stub);
}

View File

@ -32,6 +32,7 @@ DEFINE COPY_rbx_to_rdi 4889DF
DEFINE COPY_rdi_to_rbp 4889FD
DEFINE COPY_rsp_to_rbp 4889E5
DEFINE COPY_RSP_to_RDI 4889E7
DEFINE CQTO 4899
DEFINE DIVIDE_rax_by_rbx_into_rax 48F7FB
DEFINE DIVIDES_rax_by_rbx_into_rax 48F7F3
DEFINE JUMP E9

View File

@ -34,6 +34,7 @@ DEFINE COPY_edi_to_ebp 89fd
DEFINE COPY_esp_to_ebp 89E5
DEFINE COPY_esp_to_ecx 89E1
DEFINE COPY_esp_to_edi 89E7
DEFINE CDTQ 99
DEFINE DIVIDE_eax_by_ebx_into_eax F7FB
DEFINE DIVIDES_eax_by_ebx_into_eax F7F3
DEFINE INT_80 CD80

View File

@ -53,10 +53,10 @@ a0ae067746e7a2b01d33950da1cf640e12c3a70a045ab331ea2025af59dec9af test/results/t
1154f39f25dcd6d914e9a542306f95280926baf985d011b2152c7ea0b87ab42d test/results/test10-knight-native-binary
c1b5a2a3cd46c5e95e5540e871c2a916e028684ca80f51c001ef489342e27625 test/results/test10-knight-posix-binary
b3e13d54aab689137628fb9c4487bfd8288f9bd18bef8fe756577c8d2dce1f1f test/results/test10-x86-binary
e6b0b70497950f9ce46b3e75e31f4ba0ac23d16075d735d40f33f7c80e86c535 test/results/test100-amd64-binary
256ddb2d0dd6968af9461c814089ddd8ddc62125f14b061f3a52b1c2de753f87 test/results/test100-armv7l-binary
9bf9ffddf01ea313f92f3f8cc3f7987c2303582eff469bf140c6bb287741effa test/results/test100-knight-posix-binary
724fd8d3c47712ac572623292f54e84d96186a32e9ea62ab445b621075212531 test/results/test100-x86-binary
f0335de446051beeed5428a21137c62bf9ee61f84e66722ee730cb2549f4cbf9 test/results/test100-amd64-binary
04ca0dcaea76641c221646b5b69d22c3fdc595b57778d515a91e698f385a19d6 test/results/test100-armv7l-binary
dd3e83e71ca4044443d011ccf2601fd8cdce60e1b2452769e1725df3db066038 test/results/test100-knight-posix-binary
56dd73c995c3b165753784fcf36f3c0d6c55ccbc2c7ee9bdcfb91c6cc7421a0e test/results/test100-x86-binary
34e6d535e30ef8826a4ad1a4d08b76cfa370c54595599ad3be784b64c9cd8ec5 test/results/test11-amd64-binary
893695e6f300a0fe055fad935a56abd549bba70d1d39c535a680f41bbb73f117 test/results/test11-armv7l-binary
955b564d2c89abf2cfc6c80d766cd11479d146b828dec69e654b0958a62d5e6e test/results/test11-knight-native-binary
@ -89,15 +89,15 @@ edbb413c0a1e97e57c08192190c37345759e05356394d1c9f43b2eb205b65769 test/results/t
25c03ca09cee551b898245f91106e78a551ddb09e55dc5d36138e7f3955be47d test/results/test17-knight-native-binary
fae9fbfc8a37c06dbc363b7bcb48eae27fbebc8a6abf715fd7617b01a1699866 test/results/test17-knight-posix-binary
56a83f34aa57b10efdea636135491043d8c8b09dc09b451b58c27801ca82990e test/results/test17-x86-binary
1bbf386052ba9265cb89d078ac19cde1fd3170c0644f3a30f355ebba7f0ee739 test/results/test18-amd64-binary
7e38dd8213d8602480dd4912e0c25ee59c85427e69a5792f8b2cf109ec3ee8fd test/results/test18-amd64-binary
a72e9d90e28aa70ba0877a89f224a8469e066958e76c3eec1abcf3b63275ba55 test/results/test18-armv7l-binary
6aed160d00be97a25b0784a295fac4f5cd982b5f11db88a0a9ccfd8fcb648336 test/results/test18-knight-native-binary
a349ede620824075e13967da7fd820fb6c470983797c1623658d9c7412411923 test/results/test18-knight-posix-binary
56f791e86536757d48990b870590c878c825f718c29af9628c02e73bfd6144ff test/results/test18-x86-binary
b0f1ff749f0ddc405af86db73cc3419f2778b264900ff736314baceac9908f69 test/results/test19-amd64-binary
a5d415b35a87e48e1a23de44562790139335841c4a42f16c36b34079e169d7e6 test/results/test18-x86-binary
694316a1b38e9191bcfa35d1fe58deabdc6c580cd3f18f0c7912e4bcf1bcaea0 test/results/test19-amd64-binary
1960ba445f1196db351d957ffc7848b7457c0cc377331d072797bd25dcc5fe11 test/results/test19-armv7l-binary
6ce1194d10113b7e43f60d31221852c7742b8e19a0ce14f75a0005907266d128 test/results/test19-knight-posix-binary
29902ee95385060d61eee2a6474375c95f156ada2ece6b6cce763e89ef1d4bde test/results/test19-x86-binary
c5283a342fe434a4bf96dbc5635f95015ae693d24b0a22118ff5e110e770bcc2 test/results/test19-x86-binary
15950e38bab2603bfcb369b9a4941abfc2e37b7cbbd2cf9b22ebfc9aab46d5ad test/results/test20-amd64-binary
80612ce05a2e43fceb34139577be98794505cd324ff5bc84ba004a21828b5f86 test/results/test20-armv7l-binary
7ae1ba10ff6b6bf34148945ee44b9461aa6d1a16094e77fdf34b76e9a360a5b2 test/results/test20-knight-native-binary
@ -107,24 +107,24 @@ b80de35e17d341cda9cd280437acb6b217841e18a5b01faf86ca461f6bf0d246 test/results/t
23ad3fc1acc3741e32964e6ebcc206716a6d8ba9fabf4ffa872a382621b7b2a9 test/results/test21-armv7l-binary
3247980035c27673a914a6568fdc4075fe721bf1e1006a19886d1ece529187cb test/results/test21-knight-posix-binary
f5d6430d6fade0d4acdaeda1662d9bfdeff881a75e2c877dc738f3485ddb4e63 test/results/test21-x86-binary
fb8c7ef0a5d511efa02fd77e6f8cd55d88554737c4914e1aaa423fef94dad6e7 test/results/test22-amd64-binary
cc46cc20aedb9014ffd0b43514b519d0ac624f719c143cfc723330b9ff58b5ec test/results/test22-amd64-binary
8a2dbf66b8c89c4be1bb3b03ffe2e5a6a3a3b0a0991e88d381f672b13d159e9d test/results/test22-armv7l-binary
308cbf387fd7c78c180e456683295ef85a69675678299114ebe6a9eb1c37fc82 test/results/test22-knight-posix-binary
c2b54fabc592104ab0b26389191f47ba29ea0d4fc216e8fb28b314582134f532 test/results/test22-x86-binary
81d9c5764a3e1433f8ca99a551da0e6b9959f6d1d39e94c56d91fb5513ff5887 test/results/test23-amd64-binary
bc5690d7d3a94085cae5c37d0dfe3c6d393275b988bdc2091108ef51ad2141cf test/results/test22-x86-binary
bb6d97773fdc2e2253d1df47cb00d46b171379c1eaa39bc44bf7ded28aa78d2d test/results/test23-amd64-binary
8dfe0e371dec2a71448b1034b30534b6fcf8b08efa87fb0700718577173f7988 test/results/test23-armv7l-binary
304a07a1de7332e43f0ee8c0ff8104dee6906e32b18cd7d3088dcdc187456b40 test/results/test23-knight-posix-binary
b3b6ec4e0c27d0f763dbf81401d829cdb110f048f18ba461081739d533d778e3 test/results/test23-x86-binary
161deab9f025c649e91ed2b6ff0704c3d5d127892d6866ad91f628c6b8f491b9 test/results/test23-x86-binary
44d06216e0bf9c2f8dfcb6684f6f6c0c0276f73c78c36a96454be84c8dc066af test/results/test24-amd64-binary
2c78c4dd802d801109f4deaa760bc8fa2331d035c36caf22b9cd74a060532167 test/results/test24-armv7l-binary
8502002b30ac65df6444119d065a514cb0f51894a32f695ce4bc470b3f108bb9 test/results/test24-knight-posix-binary
adb392ddd4f3daab1a9afc1eb0bf00cb388a6c45db7754f8455f39757e7f62f6 test/results/test24-x86-binary
0aabcf5b94f95de30a69aa9e41cb5d2c50a17bf8a0efd4f39eef8df07c8111e3 test/results/test25-amd64-binary
68c7b81d0a03cb149a7f7a1cfbaafd8f0f5e1ee44c345278d05decd137e7c8cb test/results/test25-amd64-binary
32413f9e44359d121301b36dcda32890ba49cd67e4e9caefe98f8117be4ce224 test/results/test25-armv7l-binary
82c956e3a040d34f6328bd5f22d53c02696500806a6a27b41c8f654143827c5c test/results/test25-x86-binary
4789d259acb33098d3280b74c845ef703a09107f90856e1849401aa2ba352d23 test/results/test26-amd64-binary
81c5d1f587f2f97f042f6dbe080aab0142eb3ebba77f06db5b3f8606966263b0 test/results/test25-x86-binary
a482f22f0e4ea273ad4fa0fe8fca4778fd48e4e7bfcfd2c79555e0da3d6058ec test/results/test26-amd64-binary
6b59f96ccead5c9541a9c3e4be5ec154e96914c548662a1ace5b0d68ef16c215 test/results/test26-armv7l-binary
5e49db8b34f658113a06f38e26691bc78ef27ba11698d407cf304ab3c2342f5b test/results/test26-x86-binary
8049bd1a3f0fab041ddb8ef58b3976e6ccc9d2ae1f5ee6e3a3fa6b5f9a7de501 test/results/test26-x86-binary
717c42e1a1a91ef5b67ce298bc92a148418a5dec6761a358a52b22a01f16c928 test/results/test99-amd64-binary
4e759b212b087824f7b0f14c5147272c9984c4a4d00074b2fd771c3d004c9aec test/results/test99-armv7l-binary
dcc61bc8c785d59b2bdf61c97eb6fac877410cde5b8d46e53907ad569020b004 test/results/test99-knight-native-binary

View File

@ -1 +1 @@
2920e77d7f257741943e804ccadd44bc2a91494f0840cbe22756343511787412 test/test100/proof
59600f9625ed7a9608b41d3deeac923152d387813e37237b6e327960dc0d17c9 test/test100/proof