[PATCH] [i386, libgcc] PR 82196 -mcall-ms2sysv-xlogues emits wrong AVX/SSE MOV

Daniel Santos daniel.santos@pobox.com
Thu Sep 21 22:12:00 GMT 2017


On 09/21/2017 11:14 AM, Rainer Orth wrote:
> Hi Daniel,
>
>> On 09/19/2017 01:58 AM, Jakub Jelinek wrote:
>>> What can be done in libgcc is detect in configure whether the assembler
>>> supports AVX, and if not, provide some alternative (e.g. because the insns
>>> are always the same, you could just code them as .byte or something similar).
>>>
>>> Say like:
>>> --- i386-asm.h	2017-09-18 18:34:30.917126996 +0200
>>> +++ i386-asm.h	2017-09-19 08:56:58.829559038 +0200
>>> @@ -70,6 +70,7 @@ ASMNAME(fn):
>>>  #ifdef MS2SYSV_STUB_AVX
>>>  # define MS2SYSV_STUB_PREFIX __avx_
>>>  # define MOVAPS vmovaps
>>> +# define BYTE .byte
>>>  #elif defined(MS2SYSV_STUB_SSE)
>>>  # define MS2SYSV_STUB_PREFIX __sse_
>>>  # define MOVAPS movaps
>>> @@ -84,7 +85,8 @@ ASMNAME(fn):
>>>  	FUNC_END(PASTE2(MS2SYSV_STUB_PREFIX, base_name))
>>>  
>>>  /* Save SSE registers 6-15. off is the offset of rax to get to xmm6.  */
>>> -# define SSE_SAVE		   \
>>> +# ifdef HAVE_AS_AVX
>> I'm not exactly an autotools expert, but libtim defines HAVE_AS_AVX from
>> libitm/acinclude.m4 -- of course I need it in libgcc.  Similarly, gcc
>> has a nice generic gcc_GAS_CHECK_FEATURE macro in gcc/acinclude.m4 which
>> it uses for all of its HAVE_AS_* macro tests defined in
>> gcc/configure.ac.  I can just copy, paste and edit what's in libitm, but
>> I find that rather distasteful.  Is there a cleaner way to do this?  Can
>> I suck gcc_GAS_CHECK_FEATURE and it's deps out of gcc/acinclude.m4 and
>> put it somewhere central, like config/as.m4?  The upside would be the
>> ability to make HAVE_AS_* macros in other sub-projects more uniform.
> This might be an option as a followup: less code duplication is
> certainly a good thing ;-)
>
>> Alternatively, I can just do the copy and paste and deal with it -- it's
>> not that much code. :)
> However, given that the above will take some time and testing and your
> patch has broken macOS bootstrap, I'd go this route now to unbreak the
> tree ASAP.
>
> 	Rainer

A very good point!  So libgcc doesn't use a config.in. :(  So what about
committing my patch as is with HAVE_AS_AVX never defined and the avx
version of the stubs always being built via the .byte directives so that
the build is un-broken, and then figure out how (and where) to add
HAVE_AS_AVX afterwards?  I would still prefer to run a full bootstrap,
but updating an already build bootstrap is good and the tests should
hopefully be fixed on Solaris as well.

Thanks,
Daniel


-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr82196-fixup.diff
Type: text/x-patch
Size: 5237 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170921/39a1ebd8/attachment.bin>


More information about the Gcc-patches mailing list