diff options
author | Takashi Kokubun <[email protected]> | 2025-03-11 08:59:46 -0700 |
---|---|---|
committer | Takashi Kokubun <[email protected]> | 2025-04-18 21:52:59 +0900 |
commit | a7f8beee84f0e59e152214d41976f559f5f79e42 (patch) | |
tree | 6b61401e52ef1faa04eeb8dcc99095d6284b922b /test/ruby/test_zjit.rb | |
parent | 17ff0bc8d7ad32740f10e8b194ab9c15405f7867 (diff) |
Implement all basic Fixnum instructions (https://github.com/Shopify/zjit/pull/50)
* Implement all basic Fixnum instructions
* Use opnd! macro for other instructions as well
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13131
Diffstat (limited to 'test/ruby/test_zjit.rb')
-rw-r--r-- | test/ruby/test_zjit.rb | 58 |
1 files changed, 49 insertions, 9 deletions
diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb index 6479d7380e..4c4e837c10 100644 --- a/test/ruby/test_zjit.rb +++ b/test/ruby/test_zjit.rb @@ -73,19 +73,59 @@ class TestZJIT < Test::Unit::TestCase }, call_threshold: 2 end - def test_less_than_true - assert_compiles 'true', %q{ - def test(a, b) = a < b - test(2, 5) - test(2, 5) + def test_opt_mult + assert_compiles '6', %q{ + def test(a, b) = a * b + test(1, 2) # profile opt_mult + test(2, 3) + }, call_threshold: 2 + end + + def test_opt_eq + assert_compiles '[true, false]', %q{ + def test(a, b) = a == b + test(0, 2) # profile opt_eq + [test(1, 1), test(0, 1)] }, call_threshold: 2 end - def test_less_than_false - assert_compiles '[false, false]', %q{ + def test_opt_neq + assert_compiles '[false, true]', %q{ + def test(a, b) = a != b + test(0, 2) # profile opt_neq + [test(1, 1), test(0, 1)] + }, call_threshold: 2 + end + + def test_opt_lt + assert_compiles '[true, false, false]', %q{ def test(a, b) = a < b - test(5, 2) - [test(5, 2), test(2, 2)] + test(2, 3) # profile opt_lt + [test(0, 1), test(0, 0), test(1, 0)] + }, call_threshold: 2 + end + + def test_opt_le + assert_compiles '[true, true, false]', %q{ + def test(a, b) = a <= b + test(2, 3) # profile opt_le + [test(0, 1), test(0, 0), test(1, 0)] + }, call_threshold: 2 + end + + def test_opt_gt + assert_compiles '[false, false, true]', %q{ + def test(a, b) = a > b + test(2, 3) # profile opt_gt + [test(0, 1), test(0, 0), test(1, 0)] + }, call_threshold: 2 + end + + def test_opt_ge + assert_compiles '[false, true, true]', %q{ + def test(a, b) = a >= b + test(2, 3) # profile opt_ge + [test(0, 1), test(0, 0), test(1, 0)] }, call_threshold: 2 end |