ZJIT: Parse opt_and into HIR
This commit is contained in:
parent
4a2480e79a
commit
1c43f7e966
Notes:
git
2025-06-09 13:37:09 +00:00
@ -219,6 +219,13 @@ class TestZJIT < Test::Unit::TestCase
|
|||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_opt_and
|
||||||
|
assert_compiles('[1, [3, 2, 1]]', <<~RUBY, insns: [:opt_and])
|
||||||
|
def test(x, y) = x & y
|
||||||
|
return test(0b1101, 3), test([3, 2, 1, 4], [8, 1, 2, 3])
|
||||||
|
RUBY
|
||||||
|
end
|
||||||
|
|
||||||
def test_opt_ge
|
def test_opt_ge
|
||||||
assert_compiles '[false, true, true]', %q{
|
assert_compiles '[false, true, true]', %q{
|
||||||
def test(a, b) = a >= b
|
def test(a, b) = a >= b
|
||||||
|
@ -2377,6 +2377,7 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
|
|||||||
YARVINSN_opt_aref |
|
YARVINSN_opt_aref |
|
||||||
YARVINSN_opt_empty_p |
|
YARVINSN_opt_empty_p |
|
||||||
YARVINSN_opt_succ |
|
YARVINSN_opt_succ |
|
||||||
|
YARVINSN_opt_and |
|
||||||
YARVINSN_opt_send_without_block => {
|
YARVINSN_opt_send_without_block => {
|
||||||
let cd: *const rb_call_data = get_arg(pc, 0).as_ptr();
|
let cd: *const rb_call_data = get_arg(pc, 0).as_ptr();
|
||||||
let call_info = unsafe { rb_get_call_data_ci(cd) };
|
let call_info = unsafe { rb_get_call_data_ci(cd) };
|
||||||
@ -3837,6 +3838,19 @@ mod tests {
|
|||||||
Return v4
|
Return v4
|
||||||
"#]]);
|
"#]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn opt_and() {
|
||||||
|
eval("
|
||||||
|
def test(x, y) = x & y
|
||||||
|
");
|
||||||
|
assert_method_hir_with_opcode("test", YARVINSN_opt_and, expect![[r#"
|
||||||
|
fn test:
|
||||||
|
bb0(v0:BasicObject, v1:BasicObject, v2:BasicObject):
|
||||||
|
v5:BasicObject = SendWithoutBlock v1, :&, v2
|
||||||
|
Return v5
|
||||||
|
"#]]);
|
||||||
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_branchnil() {
|
fn test_branchnil() {
|
||||||
eval("
|
eval("
|
||||||
|
Loading…
x
Reference in New Issue
Block a user