Skip to content
Snippets Groups Projects
Commit 3be6813c authored by liuhongt's avatar liuhongt
Browse files

Make option mvzeroupper independent of optimization level.

pass_insert_vzeroupper is under condition

TARGET_AVX && TARGET_VZEROUPPER
&& flag_expensive_optimizations && !optimize_size

But the document of mvzeroupper doesn't mention the insertion
required -O2 and above, it may confuse users when they explicitly
use -Os -mvzeroupper.

------------
mvzeroupper
Target Mask(VZEROUPPER) Save
Generate vzeroupper instruction before a transfer of control flow out of
the function.
------------

The patch moves flag_expensive_optimizations && !optimize_size to
ix86_option_override_internal. It makes -mvzeroupper independent of
optimization level, but still keeps the behavior of architecture
tuning(emit_vzeroupper) unchanged.

gcc/ChangeLog:

	* config/i386/i386-features.cc (pass_insert_vzeroupper:gate):
	Move flag_expensive_optimizations && !optimize_size to ..
	* config/i386/i386-options.cc (ix86_option_override_internal):
	.. this, it makes -mvzeroupper independent of optimization
	level, but still keeps the behavior of architecture
	tuning(emit_vzeroupper) unchanged.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/avx-vzeroupper-29.c: New testcase.
	* gcc.target/i386/avx-vzeroupper-12.c: Adjust testcase.
	* gcc.target/i386/avx-vzeroupper-7.c: Ditto.
	* gcc.target/i386/avx-vzeroupper-9.c: Ditto.
parent 59c82332
No related branches found
No related tags found
No related merge requests found
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