Open Validark opened 1 week ago
@llvm/issue-subscribers-backend-risc-v
Author: Niles Salter (Validark)
Does this pattern exist in some real-world applications (e.g., some trivial string-processing implementations)?
Does this pattern exist in some real-world applications (e.g., some trivial string-processing implementations)?
These are standard SWAR operations. SWAR is used for:
I use these exact routines in my Accelerated Zig Parser for use on the Sifive-u74 and other machines which lack vectors (although the sifive-u74 also lacks the fancy bit-manipulation instructions too). Note that I hope that one day I can remove the SWAR routines from my code and let the compiler translate my vector code to the SWAR routines I have hand-coded today. However, the very fact that orc.b
exists at all is evidence that the RISC-V designers thought there could/should be machines with the B
bit-manipulation extension without the V
vector extension (which seems to contradict the fact that they designed the vector extension to work without adding mask registers for "ease of implementation" for low-end hardware). Also the fact that orc.b
exists indicates that the RISC-V designers thought real-world applications could use it.
Godbolt link
The following functions can all use, or should be directly translated to, the orc.b instruction: