Skip to content
Snippets Groups Projects
Commit 19fdb9f3 authored by Maciej W. Rozycki's avatar Maciej W. Rozycki
Browse files

Alpha: Always respect -mbwx, -mcix, -mfix, -mmax, and their inverse

Contrary to user documentation the `-mbwx', `-mcix', `-mfix', `-mmax'
feature options and their inverse forms are ignored whenever `-mcpu='
option is in effect, either by having been given explicitly or where
configured as the default such as with the `alphaev56-linux-gnu' target.
In the latter case there is no way to change the settings these options
are supposed to tweak other than with `-mcpu=' and the settings cannot
be individually controlled, making all the feature options permanently
inactive.

It seems a regression from commit 7816bea0 ("config.gcc: Reorganize
--with-cpu logic.") back in 2003, which replaced the setting of the
default feature mask with the setting of the default CPU across a few
targets, and the complementing logic in the Alpha backend wasn't updated
accordingly.

Fix this by making the individual feature options take precedence over
`-mcpu='.  Add test cases to verify this is the case, and to cover the
defaults as well for the boundary cases.

This has a drawback where the order of the options is ignored between
`-mcpu=' and these individual options, so e.g. `-mno-bwx -mcpu=ev6' will
keep the BWX feature disabled even though `-mcpu=ev6' comes later in the
command line.  This may affect some scenarios involving user overrides
such as with CFLAGS passed to `configure' and `make' invocations.  I do
believe it has been our practice anyway for more finegrained options to
override group options regardless of their relative order on the command
line and in any case using `-mcpu=ev6 -mbwx' as the override will do the
right thing if required, canceling any previous `-mno-bwx'.

This has been spotted with `alphaev56-linux-gnu' target verification and
a recently added test case:

FAIL: gcc.target/alpha/stwx0.c   -O1   scan-assembler-times \\sldq_u\\s 2
FAIL: gcc.target/alpha/stwx0.c   -O1   scan-assembler-times \\smskwh\\s 1
FAIL: gcc.target/alpha/stwx0.c   -O1   scan-assembler-times \\smskwl\\s 1
FAIL: gcc.target/alpha/stwx0.c   -O1   scan-assembler-times \\sstq_u\\s 2

(and similarly for the remaining optimization levels covered) which this
fix has addressed.

	gcc/
	* config/alpha/alpha.cc (alpha_option_override): Ignore CPU
	flags corresponding to features the enabling or disabling of
	which has been requested with an individual feature option.

	gcc/testsuite/
	* gcc.target/alpha/target-bwx-1.c: New file.
	* gcc.target/alpha/target-bwx-2.c: New file.
	* gcc.target/alpha/target-bwx-3.c: New file.
	* gcc.target/alpha/target-bwx-4.c: New file.
	* gcc.target/alpha/target-cix-1.c: New file.
	* gcc.target/alpha/target-cix-2.c: New file.
	* gcc.target/alpha/target-cix-3.c: New file.
	* gcc.target/alpha/target-cix-4.c: New file.
	* gcc.target/alpha/target-fix-1.c: New file.
	* gcc.target/alpha/target-fix-2.c: New file.
	* gcc.target/alpha/target-fix-3.c: New file.
	* gcc.target/alpha/target-fix-4.c: New file.
	* gcc.target/alpha/target-max-1.c: New file.
	* gcc.target/alpha/target-max-2.c: New file.
	* gcc.target/alpha/target-max-3.c: New file.
	* gcc.target/alpha/target-max-4.c: New file.
parent 3cf0e6ab
No related branches found
No related tags found
No related merge requests found
Showing
with 99 additions and 2 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