summaryrefslogtreecommitdiff
path: root/yjit_asm.c
diff options
context:
space:
mode:
authorMaxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>2021-05-11 16:33:28 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:35 -0400
commit5c2f74fc32951fc038dca465985a4859c517ef47 (patch)
tree8a5c59397131a6beb8c934ccd2f09588ac621e43 /yjit_asm.c
parent54fe43b45ce65f0e2cde4d4e950303893a721ebd (diff)
Fix encoding of test x86 instruction
Diffstat (limited to 'yjit_asm.c')
-rw-r--r--yjit_asm.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/yjit_asm.c b/yjit_asm.c
index c47e1fd274..76fc3bf8db 100644
--- a/yjit_asm.c
+++ b/yjit_asm.c
@@ -1664,7 +1664,15 @@ void test(codeblock_t* cb, x86opnd_t rm_opnd, x86opnd_t test_opnd)
else
{
assert (test_opnd.num_bits == rm_opnd.num_bits);
- cb_write_rm(cb, false, rm_opnd.num_bits == 64, test_opnd, rm_opnd, 0xFF, 1, 0x85);
+
+ if (rm_opnd.num_bits == 8)
+ {
+ cb_write_rm(cb, false, false, test_opnd, rm_opnd, 0xFF, 1, 0x84);
+ }
+ else
+ {
+ cb_write_rm(cb, rm_opnd.num_bits == 16, rm_opnd.num_bits == 64, test_opnd, rm_opnd, 0xFF, 1, 0x85);
+ }
}
}