Subject: Re: [PATCH v7 0/1] refs.c: SSE4.2 optimizations for check_refname_component

From: David Turner <[email-masked]>
Date: Thu, 12 Jun 2014 21:18:33 -0400

On Tue, 2014-06-10 at 08:04 +0200, Johannes Sixt wrote:
> Am 6/10/2014 1:05, schrieb Junio C Hamano:
> > Junio C Hamano <[email-masked]> writes:
> > 
> >> David Turner <[email-masked]> writes:
> >>
> >>> Since Junio has picked up the first patch from previous versions of
> >>> this series, I'm just going to send the second (SSE) one.  I decided
> >>> not to s/NO_SSE42/!HAVE_SSE42/ because it looks like git mostly uses
> >>> the former convention (for instance, that's what GIT_PARSE_WITH
> >>> generates).
> >>
> >> Yeah but NO_FROTZ is used only when FROTZ is something everybody is
> >> expected to have (e.g. it's in posix, people ought to have it, but
> >> we do support those who don't), isn't it?  For a very arch specific
> >> stuff like sse42, I'd feel better to make it purely opt-in by
> >> forcing people to explicitly say HAVE_SSE42 to enable it.
> > 
> > Just FYI: I am getting
> > 
> > compat/cpuid.h:8:12: error: 'processor_supports_sse42' defined but
> > not used [-Werror=unused-function]
> > cc1: all warnings being treated as errors
> > 
> > while building 'pu'; I'll have to rebuild 'pu' without this patch
> > before I can push the day's result out.
> 
> And I get this when I compile on Windows with msysgit:
> 
>     CC abspath.o
> In file included from git-compat-util.h:694,
>                  from cache.h:4,
>                  from abspath.c:1:
> compat/cpuid.h: In function 'processor_supports_sse42':
> compat/cpuid.h:11: warning: implicit declaration of function '__cpuid'
> abspath.c: At top level:
> compat/cpuid.h:8: warning: 'processor_supports_sse42' defined but not used
> abspath.c: In function 'processor_supports_sse42':
> compat/cpuid.h:11: warning: 'eax' is used uninitialized in this function
> compat/cpuid.h:11: warning: 'ebx' is used uninitialized in this function
> compat/cpuid.h:11: warning: 'ecx' is used uninitialized in this function
> compat/cpuid.h:11: warning: 'edx' is used uninitialized in this function
> 
> Perhaps our gcc is too old?

It is too old for my patch because it doesn't support ifunc (and I
suspect that no version of GCC for Windows supports ifunc).  But that
does not seem to be what is going on in your error message.  Instead,
when we #include <cpuid.h>, we get compat/cpuid.h rather than the
system's cpuid.h.  When I rename compat/cpuid.h to something else (and
adjust the code accordingly), and add a check for gcc 4.5+ and for
Windows before using ifunc, then everything works.

So tomorrow, I'm going to send a new patch (which also fixes the
warnings Junio reported) which I've tested on Windows, GNU/Linux, and
Mac OS X. 

I'm testing on a Windows 8 VM from modern.ie with msysgit's
"netinstaller" -- is that a reasonable test environment?