Consider multi-width ops in IR or automatic strength-reduction in the optimizer
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
Currently we primarily rely on the synthesis tool to optimize multi-width ops such as additions, multiplications, and comparators.
We should consider moving said optimizer earlier so our delay estimation can more accurately estimate the cost of a piece of code.
Consider the cost of a comparison
```
let x: u32 = ;
let y : u5 =
let z = if x < y as u32 { u32:10 } else { u32:5 };
```
Our estimator will consider the cost of the comparsion as a 32-bit comparison (ie. u32 bit subtract). Rather than a a cheaper 5-bit subtract and a 27 bit or tree.
A wrinkle to this is that this may add to the work the synthesizer datapath optimizer will need to do -- we'll need to experiment with how much is done by XLS and how much is left to the backend tools.
Contributor guide
Assessment
This issue has not been assessed yet.