ctlz pattern

Does anyone know some simple c/c++ code or .ll code which will cause this ctlz pattern to be emitted?



Are you looking for something other than calling __builtin_clz from c++ or calling @llvm.ctlz.* instrinsic from IR?

I don’t think we have anything that will auto converting a loop to ctlz or anything like that. We only seem to have a detection for popcount loops.

1 Like

That’s good enough. Thanks. On Mips16 I don’t have an instruction for that so I think I need to ask that it be expanded, so I will try that tomorrow but I will need a small test case to put it back.