https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82418

Dennis Lubert <plasmahh at gmx dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |plasmahh at gmx dot net

--- Comment #5 from Dennis Lubert <plasmahh at gmx dot net> ---
Was about to open a bug for this very same thing myself.

I came from another route, noticing that our own implementation of /100 

uint32_t divx( uint32_t r)
{
    uint32_t u = r * 1374389535uLL;
    u >>= 5u;
    return u;
}

produces 

  imull   $1374389535, %edi, %eax
        shrl    $5, %eax
        ret

whereas the code generated by gcc above is (depending on actual circumstances)
making our int to string function run 13-15% slower.

I was hoping I could reduce the use of magic numbers and instead use readable
code.

For some reason clang moves edi to eax and then calls imul, whereas the above
divx directly uses edi, this might be worth adding too.

Reply via email to