public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Support -m[no-]gather -m[no-]scatter to enable/disable vectorization for all gather/scatter instructions.
@ 2023-08-10  1:11 liuhongt
  2023-08-10  1:47 ` Xi Ruoyao
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: liuhongt @ 2023-08-10  1:11 UTC (permalink / raw)
  To: gcc-patches; +Cc: richard.guenther, ubizjak, hubicka

Currently we have 3 different independent tunes for gather
"use_gather,use_gather_2parts,use_gather_4parts",
similar for scatter, there're
"use_scatter,use_scatter_2parts,use_scatter_4parts"

The patch support 2 standardizing options to enable/disable
vectorization for all gather/scatter instructions. The options is
interpreted by driver to 3 tunes.

bootstrapped and regtested on x86_64-pc-linux-gnu.
Ok for trunk?

gcc/ChangeLog:

	* config/i386/i386.h (DRIVER_SELF_SPECS): Add
	GATHER_SCATTER_DRIVER_SELF_SPECS.
	(GATHER_SCATTER_DRIVER_SELF_SPECS): New macro.
	* config/i386/i386.opt (mgather): New option.
	(mscatter): Ditto.
---
 gcc/config/i386/i386.h   | 12 +++++++++++-
 gcc/config/i386/i386.opt |  8 ++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index ef342fcee9b..d9ac2c29bde 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -565,7 +565,17 @@ extern GTY(()) tree x86_mfence;
 # define SUBTARGET_DRIVER_SELF_SPECS ""
 #endif
 
-#define DRIVER_SELF_SPECS SUBTARGET_DRIVER_SELF_SPECS
+#ifndef GATHER_SCATTER_DRIVER_SELF_SPECS
+# define GATHER_SCATTER_DRIVER_SELF_SPECS \
+  "%{mno-gather:-mtune-ctrl=^use_gather_2parts,^use_gather_4parts,^use_gather} \
+   %{mgather:-mtune-ctrl=use_gather_2parts,use_gather_4parts,use_gather} \
+   %{mno-scatter:-mtune-ctrl=^use_scatter_2parts,^use_scatter_4parts,^use_scatter} \
+   %{mscatter:-mtune-ctrl=use_scatter_2parts,use_scatter_4parts,use_scatter}"
+#endif
+
+#define DRIVER_SELF_SPECS \
+  SUBTARGET_DRIVER_SELF_SPECS " " \
+  GATHER_SCATTER_DRIVER_SELF_SPECS
 
 /* -march=native handling only makes sense with compiler running on
    an x86 or x86_64 chip.  If changing this condition, also change
diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
index ddb7f110aa2..99948644a8d 100644
--- a/gcc/config/i386/i386.opt
+++ b/gcc/config/i386/i386.opt
@@ -424,6 +424,14 @@ mdaz-ftz
 Target
 Set the FTZ and DAZ Flags.
 
+mgather
+Target
+Enable vectorization for gather instruction.
+
+mscatter
+Target
+Enable vectorization for scatter instruction.
+
 mpreferred-stack-boundary=
 Target RejectNegative Joined UInteger Var(ix86_preferred_stack_boundary_arg)
 Attempt to keep stack aligned to this power of 2.
-- 
2.31.1


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

end of thread, other threads:[~2023-08-16  7:29 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-10  1:11 [PATCH] Support -m[no-]gather -m[no-]scatter to enable/disable vectorization for all gather/scatter instructions liuhongt
2023-08-10  1:47 ` Xi Ruoyao
2023-08-10  1:52   ` Liu, Hongtao
2023-08-10  6:04 ` Uros Bizjak
2023-08-10  6:12   ` Hongtao Liu
2023-08-10  7:39 ` Richard Biener
2023-08-10  7:42   ` Uros Bizjak
2023-08-10  7:47     ` Richard Biener
2023-08-10  7:55       ` Hongtao Liu
2023-08-10  8:07         ` Hongtao Liu
2023-08-10  9:16           ` Hongtao Liu
2023-08-10 11:12             ` Richard Biener
2023-08-10 13:23               ` Hongtao Liu
2023-08-11  6:01                 ` [PATCH V2] " liuhongt
2023-08-14  2:40                   ` Hongtao Liu
2023-08-16  7:37                     ` Hongtao Liu
2023-08-10 11:11         ` [PATCH] " Richard Biener
2023-08-10 12:05       ` Jan Hubicka

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).