[llvm] [LoopIdiomRecognizer] Implement CRC recognition (PR #79295)

Joe Faulls via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 29 02:44:41 PST 2024


joe-img wrote:

Hi both and thanks for the comments. Sorry, I am working on this PR, I've just had some higher priority items.

> pdivstep(i8 dividend, i8 divisor, i32 nsteps). This intrinsic returns the result of performing nsteps steps in the polynomial divison of dividend by the divisor

So the return value is the quotient? Doesn't that complicate the expression of CRC? What we need for CRC is surely something like `premstep` instead?

> Actual loop could be using reverse representation, but we can express it by combining with bitreverse intrinsics.

Would it be easier to have a bit reversed variation of the intrinsic? We'd have to identify these bitreverse intrinsics upon expansion anyway. It would just avoid having to insert and then recognize it.


In general I think this is a good plan, and was the original vision. If this whole plan is approved, would the first MR be just recognition and creation of the division intrinsic? I.E strip the table based lookup from this MR and emit intrinsic but would error in the backend.

https://github.com/llvm/llvm-project/pull/79295


More information about the llvm-commits mailing list