Re: [PATCH v10 2/5] powerpc/vdso: Prepare for switching VDSO to generic C implementation.
From: Segher Boessenkool
Date: Wed Aug 05 2020 - 15:03:45 EST
On Wed, Aug 05, 2020 at 04:40:16PM +0000, Christophe Leroy wrote:
> >It cannot optimise it because it does not know shift < 32. The code
> >below is incorrect for shift equal to 32, fwiw.
> Is there a way to tell it ?
Sure, for example the &31 should work (but it doesn't, with the GCC
version you used -- which version is that?)
> >What does the compiler do for just
> >static __always_inline u64 vdso_shift_ns(u64 ns, unsigned long shift)
> > return ns >> (shift & 31);
I cannot make heads or tails of all that branch spaghetti, sorry.
> 73c: 55 8c 06 fe clrlwi r12,r12,27
> 740: 7f c8 f0 14 addc r30,r8,r30
> 744: 7c c6 4a 14 add r6,r6,r9
> 748: 7c c6 e1 14 adde r6,r6,r28
> 74c: 34 6c ff e0 addic. r3,r12,-32
> 750: 41 80 00 70 blt 7c0 <__c_kernel_clock_gettime+0x114>
This branch is always true. Hrm.