summaryrefslogtreecommitdiff
path: root/ujit_asm.c
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2021-03-03 18:06:49 -0500
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:30 -0400
commiteccf4bcd91c2f10b156f07187267040f866e6a0f (patch)
tree1a92de2dc774b2af96aad076da0e6e98852e0124 /ujit_asm.c
parent8302eb57b0492a5ebd021536f0f3a00b95694bf8 (diff)
downloadruby-eccf4bcd91c2f10b156f07187267040f866e6a0f.tar.gz
uJIT: support 64 bit operands for TEST. Use it to check for zero
It's one byte shorter than `cmp reg64, 0`. To illustrate: ``` 48 83 f9 00 cmp rcx, 0x0 48 85 c9 test rcx, rcx ```
Diffstat (limited to 'ujit_asm.c')
-rw-r--r--ujit_asm.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/ujit_asm.c b/ujit_asm.c
index 3eea61cf69..939f238b0e 100644
--- a/ujit_asm.c
+++ b/ujit_asm.c
@@ -1609,10 +1609,8 @@ void test(codeblock_t* cb, x86opnd_t rm_opnd, x86opnd_t test_opnd)
}
else
{
- // For now, 32-bit operands only
assert (test_opnd.num_bits == rm_opnd.num_bits);
- assert (test_opnd.num_bits == 32);
- cb_write_rm(cb, false, false, test_opnd, rm_opnd, 0xFF, 1, 0x85);
+ cb_write_rm(cb, false, rm_opnd.num_bits == 64, test_opnd, rm_opnd, 0xFF, 1, 0x85);
}
}