Re:Popcount CPU instruction
by lifthrasiir on Monday September 09, 2019 @03:26AM
(#20915940)
That kind of thing is actually fully general, and called the scalar evolution (SCEV) analysis. LLVM for example has a full engine [1] for solving all sort of polynomial recurrences, so you can solve, say, sum i^2 with clang too: https://godbolt.org/z/-nHe78
[1] https://github.com/llvm-mirror/llvm/blob/master/lib/Analysis...