public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, i386] Fix alignment check for AVX-512 masked store
@ 2015-12-02 13:53 Ilya Enkovich
  2015-12-04 13:46 ` Kirill Yukhin
  0 siblings, 1 reply; 2+ messages in thread
From: Ilya Enkovich @ 2015-12-02 13:53 UTC (permalink / raw)
  To: gcc-patches

Hi,

This patch fixes wrong alignment check in <avx512>_store<mode>_mask
pattern.  Currently we check a register operand instead of a memory
one.  This fixes segfault on 481.wrf compiled at -O3 for KNL target.
I bootstrapped and tested this patch on x86_64-unknown-linux-gnu.

I got a bunch of new failures:

FAIL: gcc.target/i386/avx512vl-vmovapd-1.c scan-assembler-times vmovapd[ \\t]+[^{\n]*%xmm[0-9]+[^\n]*\\){%k[1-7]}(?:\n|[ \\t]+#) 1
FAIL: gcc.target/i386/avx512vl-vmovapd-1.c scan-assembler-times vmovapd[ \\t]+[^{\n]*%xmm[0-9]+[^\n]*\\){%k[1-7]}(?:\n|[ \\t]+#) 1
FAIL: gcc.target/i386/avx512vl-vmovapd-1.c scan-assembler-times vmovapd[ \\t]+[^{\n]*%ymm[0-9]+[^\n]*\\){%k[1-7]}(?:\n|[ \\t]+#) 1
FAIL: gcc.target/i386/avx512vl-vmovapd-1.c scan-assembler-times vmovapd[ \\t]+[^{\n]*%ymm[0-9]+[^\n]*\\){%k[1-7]}(?:\n|[ \\t]+#) 1
FAIL: gcc.target/i386/avx512vl-vmovaps-1.c scan-assembler-times vmovaps[ \\t]+[^{\n]*%xmm[0-9]+[^\n]*\\){%k[1-7]}(?:\n|[ \\t]+#) 1
FAIL: gcc.target/i386/avx512vl-vmovaps-1.c scan-assembler-times vmovaps[ \\t]+[^{\n]*%xmm[0-9]+[^\n]*\\){%k[1-7]}(?:\n|[ \\t]+#) 1
FAIL: gcc.target/i386/avx512vl-vmovaps-1.c scan-assembler-times vmovaps[ \\t]+[^{\n]*%ymm[0-9]+[^\n]*\\){%k[1-7]}(?:\n|[ \\t]+#) 1
FAIL: gcc.target/i386/avx512vl-vmovaps-1.c scan-assembler-times vmovaps[ \\t]+[^{\n]*%ymm[0-9]+[^\n]*\\){%k[1-7]}(?:\n|[ \\t]+#) 1

With patch applied test generates vmovup[sd] because memory
references don't have proper alignment set.  Since this is
another bug and it's actually a performance one, I think
this patch should go to trunk.

Thanks,
Ilya
--
gcc/

2015-12-02  Ilya Enkovich  <enkovich.gnu@gmail.com>

	* config/i386/sse.md (<avx512>_store<mode>_mask): Fix
	operand checked for alignment.


diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index e7b517a..d65ed0c 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -1051,7 +1051,7 @@
       sse_suffix = "<ssescalarsize>";
     }
 
-  if (misaligned_operand (operands[1], <MODE>mode))
+  if (misaligned_operand (operands[0], <MODE>mode))
     align = "u";
   else
     align = "a";

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH, i386] Fix alignment check for AVX-512 masked store
  2015-12-02 13:53 [PATCH, i386] Fix alignment check for AVX-512 masked store Ilya Enkovich
@ 2015-12-04 13:46 ` Kirill Yukhin
  0 siblings, 0 replies; 2+ messages in thread
From: Kirill Yukhin @ 2015-12-04 13:46 UTC (permalink / raw)
  To: Ilya Enkovich; +Cc: GCC Patches, Uros Bizjak

Hi Ilya,
On 02 Dec 16:51, Ilya Enkovich wrote:
> Hi,
> 
> This patch fixes wrong alignment check in <avx512>_store<mode>_mask
> pattern.  Currently we check a register operand instead of a memory
> one.  This fixes segfault on 481.wrf compiled at -O3 for KNL target.
> I bootstrapped and tested this patch on x86_64-unknown-linux-gnu.
> 
> I got a bunch of new failures:
> 
> FAIL: gcc.target/i386/avx512vl-vmovapd-1.c scan-assembler-times vmovapd[ \\t]+[^{\n]*%xmm[0-9]+[^\n]*\\){%k[1-7]}(?:\n|[ \\t]+#) 1
> FAIL: gcc.target/i386/avx512vl-vmovapd-1.c scan-assembler-times vmovapd[ \\t]+[^{\n]*%xmm[0-9]+[^\n]*\\){%k[1-7]}(?:\n|[ \\t]+#) 1
> FAIL: gcc.target/i386/avx512vl-vmovapd-1.c scan-assembler-times vmovapd[ \\t]+[^{\n]*%ymm[0-9]+[^\n]*\\){%k[1-7]}(?:\n|[ \\t]+#) 1
> FAIL: gcc.target/i386/avx512vl-vmovapd-1.c scan-assembler-times vmovapd[ \\t]+[^{\n]*%ymm[0-9]+[^\n]*\\){%k[1-7]}(?:\n|[ \\t]+#) 1
> FAIL: gcc.target/i386/avx512vl-vmovaps-1.c scan-assembler-times vmovaps[ \\t]+[^{\n]*%xmm[0-9]+[^\n]*\\){%k[1-7]}(?:\n|[ \\t]+#) 1
> FAIL: gcc.target/i386/avx512vl-vmovaps-1.c scan-assembler-times vmovaps[ \\t]+[^{\n]*%xmm[0-9]+[^\n]*\\){%k[1-7]}(?:\n|[ \\t]+#) 1
> FAIL: gcc.target/i386/avx512vl-vmovaps-1.c scan-assembler-times vmovaps[ \\t]+[^{\n]*%ymm[0-9]+[^\n]*\\){%k[1-7]}(?:\n|[ \\t]+#) 1
> FAIL: gcc.target/i386/avx512vl-vmovaps-1.c scan-assembler-times vmovaps[ \\t]+[^{\n]*%ymm[0-9]+[^\n]*\\){%k[1-7]}(?:\n|[ \\t]+#) 1
> 
> With patch applied test generates vmovup[sd] because memory
> references don't have proper alignment set.  Since this is
> another bug and it's actually a performance one, I think
> this patch should go to trunk.

Your patch definetely fixes stability issue.
New fails are performance issues.

OK for main trunk. Pls, file regression bug in Bugzilla against new fails.

--
Thanks, K


> 
> Thanks,
> Ilya
> --
> gcc/
> 
> 2015-12-02  Ilya Enkovich  <enkovich.gnu@gmail.com>
> 
> 	* config/i386/sse.md (<avx512>_store<mode>_mask): Fix
> 	operand checked for alignment.
> 
> 
> diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
> index e7b517a..d65ed0c 100644
> --- a/gcc/config/i386/sse.md
> +++ b/gcc/config/i386/sse.md
> @@ -1051,7 +1051,7 @@
>        sse_suffix = "<ssescalarsize>";
>      }
>  
> -  if (misaligned_operand (operands[1], <MODE>mode))
> +  if (misaligned_operand (operands[0], <MODE>mode))
>      align = "u";
>    else
>      align = "a";

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-04 13:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-02 13:53 [PATCH, i386] Fix alignment check for AVX-512 masked store Ilya Enkovich
2015-12-04 13:46 ` Kirill Yukhin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).