> We have a few instances of the open-coded iterative div/mod loop, used
It's not a "dummy" asm, it actually does something: it tells the
compiler that it has to iterate the loop exactly as written, and
not do something else. I.e., exactly the behaviour we want here.
What a terrible function name.
...and now the "meat" of this function isn't inline anymore. If we
cared about not doing a divide here, you'll have to explain why
taking this trivial loop out of line is a good idea.
You removed the unlikely() here. Why?
You changed "+r" to "+rm" here. Why? Also, "rm" is an x86-ism,
and this is generic code (it does work here, but why is it better
than "r"?)
Does this need to be exported?
Can I suggest an alternative approach? Define a macro (with a
good, descriptive name!) for just the asm("" : "+r"(x)), and use
that. Much smaller patch, much clearer code, and doesn't result
in different (and worse) code generation, so it's a much safer
change.
Segher
--