Skip to content

Conversation

@ChrisDodd
Copy link
Contributor

  • swap operands to Add when left is a constant.

@fruffy fruffy added the core Topics concerning the core segments of the compiler (frontend, midend, parser) label May 17, 2025
@ChrisDodd ChrisDodd force-pushed the cdodd-strengthreduction branch 4 times, most recently from fc7cd4a to 808daf6 Compare June 4, 2025 03:14
@ChrisDodd ChrisDodd requested review from asl and fruffy June 4, 2025 03:14
@ChrisDodd
Copy link
Contributor Author

I extended this to other commutative operators (mul and binary and/or/xor), as well as addiing the missing support for AddSat and SubSat.

@ChrisDodd ChrisDodd force-pushed the cdodd-strengthreduction branch from 808daf6 to e7ae6e7 Compare June 4, 2025 03:46
@fruffy
Copy link
Collaborator

fruffy commented Jun 21, 2025

The P4Testgen tests are likely failing because some expressions are reordered. The tests are in backends/p4tools/modules/testgen/targets/bmv2/test/small-step/binary.cpp

@ChrisDodd ChrisDodd force-pushed the cdodd-strengthreduction branch 3 times, most recently from f006029 to fed3233 Compare June 30, 2025 02:07
@ChrisDodd ChrisDodd force-pushed the cdodd-strengthreduction branch from fed3233 to 83d789c Compare July 2, 2025 03:35
@ChrisDodd ChrisDodd force-pushed the cdodd-strengthreduction branch from 83d789c to 390eeb2 Compare July 10, 2025 00:40
@ChrisDodd ChrisDodd force-pushed the cdodd-strengthreduction branch 2 times, most recently from a240720 to f1e4a65 Compare July 22, 2025 02:38
- swap operands to commutative ops when left is a constant.
- add support for AddSat and SubSat

Signed-off-by: Chris Dodd <[email protected]>
- use Sub instead of Add so it won't be swapped by StrengthReduction

Signed-off-by: Chris Dodd <[email protected]>
@ChrisDodd ChrisDodd added this pull request to the merge queue Aug 18, 2025
Merged via the queue into p4lang:main with commit 6ffebd7 Aug 18, 2025
20 checks passed
@ChrisDodd ChrisDodd deleted the cdodd-strengthreduction branch August 18, 2025 22:03
jhavrane pushed a commit to jhavrane/p4c that referenced this pull request Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Topics concerning the core segments of the compiler (frontend, midend, parser)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants