lkml.org 
[lkml]   [2012]   [Aug]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 46/74] x86, lto: Disable fancy hweight optimizations for LTO
> By moving this last line first you can avoid modifying the other two lines.

Ok.

>
> >--- a/arch/x86/include/asm/arch_hweight.h
> >+++ b/arch/x86/include/asm/arch_hweight.h
> >@@ -25,9 +25,14 @@ static inline unsigned int __arch_hweight32(unsigned int w)
> >{
> > unsigned int res = 0;
> >
> >+#ifdef CONFIG_LTO
> >+ res = __sw_hweight32(w);
> >+#else
> >+
> > asm (ALTERNATIVE("call __sw_hweight32", POPCNT32, X86_FEATURE_POPCNT)
> > : "="REG_OUT (res)
> > : REG_IN (w));
> >+#endif
>
> Isn't this a little to harsh? Rather than not using popcnt at all, why don't you just add
> the necessary clobbers to the asm() in the LTO case?

gcc lacks the means to declare that a asm uses an external symbol
currently. Ok we could make it visible. But there's no way to make the
special calling convention work anyways, at least not without someone
changing gcc to allow to declare this per function.

I'm not sure the optimization is really worth it anyways, hweight should
be uncommon.

-Andi

--
ak@linux.intel.com -- Speaking for myself only.


\
 
 \ /
  Last update: 2012-08-19 17:41    [W:0.325 / U:1.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site