[enhancement] recognise array shift loop pattern
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
### What's hard to do? (limit 100 words)
Expressing a zero-filled array shift in DSLX (for loop with result[i] = if i < shift { false } else { data[i-shift] }) produces one dynamic array lookup per output element instead of a vector shift. For bool[8] that's 8 variable-index selects plus guard logic, rather than: assign out = data << shift;
### Current best alternative workaround (limit 100 words)
User would have to use packed bits[8] instead of bool[8] for data, or std::convert_to_bools_lsb0(std::convert_to_bits_msb0(array_rev(data)) << shift) to preserve types.
### Your view of the "best case XLS enhancement" (limit 100 words)
Writing the natural array-loop shift should produce the same hardware as the packed data << shift: one vector shift.
Contributor guide
Research direction
Start by reproducing the DSLX bool[8] zero-filled array-shift loop described in the issue and compare it with the packed bits[8] shift workaround. Identify the compiler entry point that recognizes array-loop patterns and verify that the completed change produces hardware equivalent to one vector shift rather than per-element dynamic selects.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100