Skip to content

Add new logical comparators for and, or and xor + negations #1494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
May 1, 2025

Conversation

Robbepop
Copy link
Member

@Robbepop Robbepop commented May 1, 2025

Implements #1483.

  • This PR also generalizes op-fusion of i32.eqz to also work with i32.eq with a zero lhs or rhs immediate.
  • Furthermore this PR adds an op-fusion for i32.ne with a zero lhs or rhs immediate.
    • Usually this results in a no-op if preceeded by another logical compare instruction. But bitwise instructions such as bitand, bitor and bitxor are converted into their logical variants instead.

ToDo

  • Rename i{32,64}.{and,or,xor} -> i{32,64}.bit{and,or,xor}: bitwise versions
  • Add new instructions:
    • i32.{and,or,xor,nand,nor,xnor}: logical versions for i32
    • i64.{and,or,xor,nand,nor,xnor}: logical versions for i64
    • branch_i32.{nand,nor,xnor}: new cmp+branch instructions for i32
    • branch_i64.{and,or,xor,nand,nor,xnor}: new cmp+branch instructions for i64
  • Update missing translation tests
    • cmp+br translation tests

Copy link

codecov bot commented May 1, 2025

Codecov Report

Attention: Patch coverage is 42.96875% with 146 lines in your changes missing coverage. Please review.

Project coverage is 71.44%. Comparing base (0ed3714) to head (8ecca97).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/wasmi/src/engine/executor/instrs.rs 10.98% 81 Missing ⚠️
crates/wasmi/src/engine/translator/comparator.rs 68.18% 28 Missing ⚠️
crates/wasmi/src/engine/translator/visit.rs 35.29% 22 Missing ⚠️
crates/wasmi/src/engine/executor/instrs/branch.rs 0.00% 12 Missing ⚠️
...rates/wasmi/src/engine/translator/instr_encoder.rs 90.32% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1494      +/-   ##
==========================================
- Coverage   71.65%   71.44%   -0.22%     
==========================================
  Files         175      175              
  Lines       16149    16301     +152     
==========================================
+ Hits        11572    11646      +74     
- Misses       4577     4655      +78     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Robbepop Robbepop changed the title Add new logical comparators for and, or and xor Add new logical comparators for and, or and xor + negations May 1, 2025
@Robbepop Robbepop merged commit e015648 into main May 1, 2025
17 of 19 checks passed
@Robbepop Robbepop deleted the rf-add-new-logical-comparators branch May 1, 2025 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant