On 2/7/20 11:28 AM, Jakub Jelinek wrote:
> On Fri, Feb 07, 2020 at 10:57:22AM +0000, JonY wrote:
>>>> Is this patch testing still required? I just got back from traveling.
>>>
>>> Yes, our reading of the MS ABI docs show that xmm16-31 are to be call used
>>> (not preserved over calls), while in gcc they are currently handled as
>>> preserved across the calls.
> 
> The other parts are I guess mainly about SEH.  Consider e.g.
> void
> foo (void)
> {
>   register double x __asm ("xmm14");
>   register double y __asm ("xmm18");
>   asm ("" : "=x" (x));
>   asm ("" : "=v" (y));
>   x += y;
>   y += x;
>   asm ("" : : "x" (x));
>   asm ("" : : "v" (y));
> }
> looking at cross-compiler output, with -O2 -mavx512f this emits
>       .file   "abcdeq.c"
>       .text
>       .align 16
>       .globl  foo
>       .def    foo;    .scl    2;      .type   32;     .endef
>       .seh_proc       foo
> foo:
>       subq    $40, %rsp
>       .seh_stackalloc 40
>       vmovaps %xmm14, (%rsp)
>       .seh_savexmm    %xmm14, 0
>       vmovaps %xmm18, 16(%rsp)
>       .seh_savexmm    %xmm18, 16
>       .seh_endprologue
>       vaddsd  %xmm18, %xmm14, %xmm14
>       vaddsd  %xmm18, %xmm14, %xmm18
>       vmovaps (%rsp), %xmm14
>       vmovaps 16(%rsp), %xmm18
>       addq    $40, %rsp
>       ret
>       .seh_endproc
>       .ident  "GCC: (GNU) 10.0.1 20200207 (experimental)"
> Does whatever assembler mingw64 uses even assemble this (I mean the
> .seh_savexmm %xmm16, 16 could be problematic)?''

It does not, I just checked with the master branch of binutils.

> I can find e.g.
> https://stackoverflow.com/questions/43152633/invalid-register-for-seh-savexmm-in-cygwin/43210527
> which then links to
> https://gcc.gnu.org/PR65782
> 
> So, I'd say we want to add PR target/65782 to the ChangeLog entry in the
> patch, and likely add a testcase like the above, so like below?
> 
> Have you tested the earlier version of the patch on mingw64 or cygwin?
> If yes, can you just test the testcase from the following patch, without and
> with the i386.h part and verify it FAILs without and PASSes with it?
> Just make check-gcc RUNTESTFLAGS=i386.exp=pr65782.c should do?
> If not, can you please test the whole patch?
> 

I did a -c test build with an older toolchain, it fails to compile
(invalid register for .seh_savexmm) while the latest gcc is passing,
both are using the same binutils version.

I guess that covers it?


> 2020-02-07  Uroš Bizjak  <ubiz...@gmail.com>
>           Jakub Jelinek  <ja...@redhat.com>
> 
>       PR target/65782
>       * config/i386/config/i386/i386.h (CALL_USED_REGISTERS): Make
>       xmm16-xmm31 call-used even in 64-bit ms-abi.
> 
>       * gcc.target/i386/pr65782.c: New test.
> 
> --- gcc/config/i386/config/i386/i386.h.jj     2020-01-22 10:19:24.199221986 
> +0100
> +++ gcc/config/i386/config/i386/i386.h        2020-02-04 12:09:12.338341003 
> +0100
> @@ -1128,9 +1128,9 @@ extern const char *host_detect_local_cpu
>  /*xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15*/            \
>       6,   6,    6,    6,    6,    6,    6,    6,             \
>  /*xmm16,xmm17,xmm18,xmm19,xmm20,xmm21,xmm22,xmm23*/          \
> -     6,    6,     6,    6,    6,    6,    6,    6,           \
> +     1,    1,     1,    1,    1,    1,    1,    1,           \
>  /*xmm24,xmm25,xmm26,xmm27,xmm28,xmm29,xmm30,xmm31*/          \
> -     6,    6,     6,    6,    6,    6,    6,    6,           \
> +     1,    1,     1,    1,    1,    1,    1,    1,           \
>   /* k0,  k1,  k2,  k3,  k4,  k5,  k6,  k7*/                  \
>       1,   1,   1,   1,   1,   1,   1,   1 }
>  
> --- gcc/testsuite/gcc.target/i386/pr65782.c.jj        2020-02-07 
> 12:21:09.472819018 +0100
> +++ gcc/testsuite/gcc.target/i386/pr65782.c   2020-02-07 12:24:06.820154495 
> +0100
> @@ -0,0 +1,16 @@
> +/* PR target/65782 */
> +/* { dg-do assemble { target { avx512vl && { ! ia32 } } } } */
> +/* { dg-options "-O2 -mavx512vl" } */
> +
> +void
> +foo (void)
> +{
> +  register double x __asm ("xmm14");
> +  register double y __asm ("xmm18");
> +  asm ("" : "=x" (x));
> +  asm ("" : "=v" (y));
> +  x += y;
> +  y += x;
> +  asm ("" : : "x" (x));
> +  asm ("" : : "v" (y));
> +}
> 
> 
>       Jakub
> 


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to