Re: [GIT PULL] x86/build changes for v4.17

From: Arnd Bergmann
Date: Wed Apr 04 2018 - 17:11:44 EST


On Wed, Apr 4, 2018 at 10:58 PM, Matthias Kaehlcke <mka@xxxxxxxxxxxx> wrote:
> El Wed, Apr 04, 2018 at 10:33:19PM +0200 Arnd Bergmann ha dit:
>>
>> In most cases, this is used to implement a fast-path for a helper
>> function, so not doing it the same way as gcc just results in
>> slower execution, but I assume we also have code that behaves
>> differently on clang compared to gcc because of this.
>
> I think I didn't come (knowingly) across that one yet. Could you point
> me to an instance that could be used as an example in a bug report?

This code

#include <linux/math64.h>
int f(u64 u)
{
return div_u64(u, 100000);
}

results in a call to __do_div64() on 32-bit arm using clang, but
gets optimized into a set of multiply+shift on gcc.

The same thing should happen on x86, but haven't tried it
because of the 'asm goto' build failure in linux-next with clang.

Arnd