On Thu, 2024-04-04 at 21:30 +0200, Niels Möller wrote:
If it's this macro,
C Convert an index for W[i] to the corresponding register define(`IV', `eval($1 + VW0)')
and the argument $1 is always a numerical expression, then I'd suggest deleting the definitions of VW0 - VW15 (with only a comment to document this register usage), and something like
define(`IV', `v`'eval($1 + 16)')
You could also consider moving the % 16 operation into this macro,
define(`IV', `v`'eval((($1) % 16) + 16)')
which should make it clear that it can't expand to a register outside of the intended v16-v31 range.
Thanks for the suggestion! I moved the "% 16" into that eval to clean up those load calls.
After a bit of fiddling with m4 though, it appears that this emits something like "v16" without applying the translation of v16 -> 16, causing the assembler to choke. I did manage to get it to work with a naive concatenation macro like this:
define(`CONCAT', `$1$2') define(`IV', `CONCAT(v, eval((($1) % 16) + 16))')
though I feel like there is a more elegant and clear solution. I have a v2 queued up, I can send if this is sufficient.
Thanks! - Eric