This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR81175, make gather builtins pure


On Fri, Jun 23, 2017 at 02:54:35PM +0200, Richard Biener wrote:
> 2017-06-23  Richard Biener  <rguenther@suse.de>
> 
> 	PR target/81175
> 	* config/i386/i386.c (struct builtin_isa): Add pure_p member.
> 	(def_builtin2): Initialize pure_p.
> 	(ix86_add_new_builtins): Honor pure_p.
> 	(def_builtin_pure): New function.
> 	(ix86_init_mmx_sse_builtins): Use def_builtin_pure for all
> 	gather builtins.

> *************** ix86_init_mmx_sse_builtins (void)
> *** 31985,32002 ****
>   	       IX86_BUILTIN_SCATTERALTDIV16SI);
>   
>     /* AVX512PF */
> !   def_builtin (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfdpd",
> ! 	       VOID_FTYPE_QI_V8SI_PCVOID_INT_INT,
> ! 	       IX86_BUILTIN_GATHERPFDPD);
> !   def_builtin (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfdps",
> ! 	       VOID_FTYPE_HI_V16SI_PCVOID_INT_INT,
> ! 	       IX86_BUILTIN_GATHERPFDPS);
> !   def_builtin (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfqpd",
> ! 	       VOID_FTYPE_QI_V8DI_PCVOID_INT_INT,
> ! 	       IX86_BUILTIN_GATHERPFQPD);
> !   def_builtin (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfqps",
> ! 	       VOID_FTYPE_QI_V8DI_PCVOID_INT_INT,
> ! 	       IX86_BUILTIN_GATHERPFQPS);
>     def_builtin (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_scatterpfdpd",
>   	       VOID_FTYPE_QI_V8SI_PCVOID_INT_INT,
>   	       IX86_BUILTIN_SCATTERPFDPD);
> --- 32004,32021 ----
>   	       IX86_BUILTIN_SCATTERALTDIV16SI);
>   
>     /* AVX512PF */
> !   def_builtin_pure (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfdpd",
> ! 		    VOID_FTYPE_QI_V8SI_PCVOID_INT_INT,
> ! 		    IX86_BUILTIN_GATHERPFDPD);
> !   def_builtin_pure (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfdps",
> ! 		    VOID_FTYPE_HI_V16SI_PCVOID_INT_INT,
> ! 		    IX86_BUILTIN_GATHERPFDPS);
> !   def_builtin_pure (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfqpd",
> ! 		    VOID_FTYPE_QI_V8DI_PCVOID_INT_INT,
> ! 		    IX86_BUILTIN_GATHERPFQPD);
> !   def_builtin_pure (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfqps",
> ! 		    VOID_FTYPE_QI_V8DI_PCVOID_INT_INT,
> ! 		    IX86_BUILTIN_GATHERPFQPS);
>     def_builtin (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_scatterpfdpd",
>   	       VOID_FTYPE_QI_V8SI_PCVOID_INT_INT,
>   	       IX86_BUILTIN_SCATTERPFDPD);

The above hunk looks wrong and regresses
+FAIL: gcc.target/i386/avx512pf-vgatherpf0dpd-1.c scan-assembler-times vgatherpf0dpd[ \\\\t]+[^{\\n]*{%k[1-7]}(?:\\n|[ \\\\t]+#) 2
+FAIL: gcc.target/i386/avx512pf-vgatherpf0dps-1.c scan-assembler-times vgatherpf0dps[ \\\\t]+[^{\\n]*{%k[1-7]}(?:\\n|[ \\\\t]+#) 2
+FAIL: gcc.target/i386/avx512pf-vgatherpf0qpd-1.c scan-assembler-times vgatherpf0qpd[ \\\\t]+[^{\\n]*{%k[1-7]}(?:\\n|[ \\\\t]+#) 2
+FAIL: gcc.target/i386/avx512pf-vgatherpf0qps-1.c scan-assembler-times vgatherpf0qps[ \\\\t]+[^{\\n]*{%k[1-7]}(?:\\n|[ \\\\t]+#) 2
+FAIL: gcc.target/i386/avx512pf-vgatherpf1dpd-1.c scan-assembler-times vgatherpf1dpd[ \\\\t]+[^{\\n]*{%k[1-7]}(?:\\n|[ \\\\t]+#) 2
+FAIL: gcc.target/i386/avx512pf-vgatherpf1dps-1.c scan-assembler-times vgatherpf1dps[ \\\\t]+[^{\\n]*{%k[1-7]}(?:\\n|[ \\\\t]+#) 2
+FAIL: gcc.target/i386/avx512pf-vgatherpf1qpd-1.c scan-assembler-times vgatherpf1qpd[ \\\\t]+[^{\\n]*{%k[1-7]}(?:\\n|[ \\\\t]+#) 2
+FAIL: gcc.target/i386/avx512pf-vgatherpf1qps-1.c scan-assembler-times vgatherpf1qps[ \\\\t]+[^{\\n]*{%k[1-7]}(?:\\n|[ \\\\t]+#) 2
The prefetch intrinsics can't be pure, after all they return void, so
as pure are always optimized away.

Ok for trunk if it passes bootstrap/regtest?

2017-06-27  Jakub Jelinek  <jakub@redhat.com>

	PR target/81175
	* config/i386/i386.c (ix86_init_mmx_sse_builtins): Use def_builtin
	rather than def_builtin_pure for __builtin_ia32_gatherpf*.

--- gcc/config/i386/i386.c.jj	2017-06-27 09:16:09.000000000 +0200
+++ gcc/config/i386/i386.c	2017-06-27 11:47:21.610627628 +0200
@@ -32886,18 +32886,18 @@ ix86_init_mmx_sse_builtins (void)
 	       IX86_BUILTIN_SCATTERALTDIV16SI);
 
   /* AVX512PF */
-  def_builtin_pure (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfdpd",
-		    VOID_FTYPE_QI_V8SI_PCVOID_INT_INT,
-		    IX86_BUILTIN_GATHERPFDPD);
-  def_builtin_pure (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfdps",
-		    VOID_FTYPE_HI_V16SI_PCVOID_INT_INT,
-		    IX86_BUILTIN_GATHERPFDPS);
-  def_builtin_pure (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfqpd",
-		    VOID_FTYPE_QI_V8DI_PCVOID_INT_INT,
-		    IX86_BUILTIN_GATHERPFQPD);
-  def_builtin_pure (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfqps",
-		    VOID_FTYPE_QI_V8DI_PCVOID_INT_INT,
-		    IX86_BUILTIN_GATHERPFQPS);
+  def_builtin (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfdpd",
+	       VOID_FTYPE_QI_V8SI_PCVOID_INT_INT,
+	       IX86_BUILTIN_GATHERPFDPD);
+  def_builtin (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfdps",
+	       VOID_FTYPE_HI_V16SI_PCVOID_INT_INT,
+	       IX86_BUILTIN_GATHERPFDPS);
+  def_builtin (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfqpd",
+	       VOID_FTYPE_QI_V8DI_PCVOID_INT_INT,
+	       IX86_BUILTIN_GATHERPFQPD);
+  def_builtin (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfqps",
+	       VOID_FTYPE_QI_V8DI_PCVOID_INT_INT,
+	       IX86_BUILTIN_GATHERPFQPS);
   def_builtin (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_scatterpfdpd",
 	       VOID_FTYPE_QI_V8SI_PCVOID_INT_INT,
 	       IX86_BUILTIN_SCATTERPFDPD);


	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]