Skip to content
Snippets Groups Projects
Commit 654cd743 authored by H.J. Lu's avatar H.J. Lu
Browse files

x86: Add -mmove-max=bits and -mstore-max=bits

Add -mmove-max=bits and -mstore-max=bits to enable 256-bit/512-bit move
and store, independent of -mprefer-vector-width=bits:

1. Add X86_TUNE_AVX512_MOVE_BY_PIECES and X86_TUNE_AVX512_STORE_BY_PIECES
which are enabled for Intel Sapphire Rapids processor.
2. Add -mmove-max=bits to set the maximum number of bits can be moved from
memory to memory efficiently.  The default value is derived from
X86_TUNE_AVX512_MOVE_BY_PIECES, X86_TUNE_AVX256_MOVE_BY_PIECES, and the
preferred vector width.
3. Add -mstore-max=bits to set the maximum number of bits can be stored to
memory efficiently.  The default value is derived from
X86_TUNE_AVX512_STORE_BY_PIECES, X86_TUNE_AVX256_STORE_BY_PIECES and the
preferred vector width.

gcc/

	PR target/103269
	* config/i386/i386-expand.c (ix86_expand_builtin): Pass PVW_NONE
	and PVW_NONE to ix86_target_string.
	* config/i386/i386-options.c (ix86_target_string): Add arguments
	for move_max and store_max.
	(ix86_target_string::add_vector_width): New lambda.
	(ix86_debug_options): Pass ix86_move_max and ix86_store_max to
	ix86_target_string.
	(ix86_function_specific_print): Pass ptr->x_ix86_move_max and
	ptr->x_ix86_store_max to ix86_target_string.
	(ix86_valid_target_attribute_tree): Handle x_ix86_move_max and
	x_ix86_store_max.
	(ix86_option_override_internal): Set the default x_ix86_move_max
	and x_ix86_store_max.
	* config/i386/i386-options.h (ix86_target_string): Add
	prefer_vector_width and prefer_vector_width.
	* config/i386/i386.h (TARGET_AVX256_MOVE_BY_PIECES): Removed.
	(TARGET_AVX256_STORE_BY_PIECES): Likewise.
	(MOVE_MAX): Use 64 if ix86_move_max or ix86_store_max ==
	PVW_AVX512.  Use 32 if ix86_move_max or ix86_store_max >=
	PVW_AVX256.
	(STORE_MAX_PIECES): Use 64 if ix86_store_max == PVW_AVX512.
	Use 32 if ix86_store_max >= PVW_AVX256.
	* config/i386/i386.opt: Add -mmove-max=bits and -mstore-max=bits.
	* config/i386/x86-tune.def (X86_TUNE_AVX512_MOVE_BY_PIECES): New.
	(X86_TUNE_AVX512_STORE_BY_PIECES): Likewise.
	* doc/invoke.texi: Document -mmove-max=bits and -mstore-max=bits.

gcc/testsuite/

	PR target/103269
	* gcc.target/i386/pieces-memcpy-17.c: New test.
	* gcc.target/i386/pieces-memcpy-18.c: Likewise.
	* gcc.target/i386/pieces-memcpy-19.c: Likewise.
	* gcc.target/i386/pieces-memcpy-20.c: Likewise.
	* gcc.target/i386/pieces-memcpy-21.c: Likewise.
	* gcc.target/i386/pieces-memset-45.c: Likewise.
	* gcc.target/i386/pieces-memset-46.c: Likewise.
	* gcc.target/i386/pieces-memset-47.c: Likewise.
	* gcc.target/i386/pieces-memset-48.c: Likewise.
	* gcc.target/i386/pieces-memset-49.c: Likewise.
parent 987baa74
No related branches found
No related tags found
Loading
Showing
with 276 additions and 18 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment