dialect: (riscv) add folding patterns for shift ops#5656
dialect: (riscv) add folding patterns for shift ops#5656osmanyasar05 wants to merge 6 commits intoxdslproject:mainfrom
Conversation
|
I think there are multiple ways that we can add this function. We can either make py_operation a static method and pass both operands as arguments, or make it an instance method and only pass the register operand, not the immediate. I followed #5497 here. What do you think @superlopuh ? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5656 +/- ##
==========================================
- Coverage 86.25% 86.25% -0.01%
==========================================
Files 403 403
Lines 56852 56864 +12
Branches 6556 6567 +11
==========================================
+ Hits 49038 49047 +9
Misses 6283 6283
- Partials 1531 1534 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
added new test cases to ensure correctness of srai and slli with signed numbers. they work as intended. |
superlopuh
left a comment
There was a problem hiding this comment.
This is looking great! Can you please add tests for the new ops, and probably also new tests for the ops that already had the pattern to show the difference in behaviour between the shifts that respect the sign bits and not?
I have added these tests to canonicalize.mlir. I believe these should cover what you requested? Logical and arithmetic shifting of -1. |
This PR adds constant folding patterns to shift operations Slli and Srli.