lkml.org 
[lkml]   [2016]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -v2] x86/hweight: Get rid of the special calling convention
On Tue, May 10, 2016 at 06:53:18PM +0200, Borislav Petkov wrote:
> static __always_inline unsigned int __arch_hweight32(unsigned int w)
> {
> - unsigned int res = 0;
> + unsigned int res;
>
> - asm (ALTERNATIVE("call __sw_hweight32", POPCNT32, X86_FEATURE_POPCNT)
> - : "="REG_OUT (res)
> - : REG_IN (w));
> + if (likely(static_cpu_has(X86_FEATURE_POPCNT))) {
> + /* popcnt %eax, %eax */
> + asm volatile(POPCNT32
> + : "="REG_OUT (res)
> + : REG_IN (w));
>
> - return res;
> + return res;
> + }
> + return __sw_hweight32(w);
> }

So what was wrong with using the normal thunk_*.S wrappers for the
calls? That would allow you to use the alternative() stuff which does
generate smaller code.

\
 
 \ /
  Last update: 2016-05-10 19:41    [W:0.169 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site