]> git.ipfire.org Git - thirdparty/gcc.git/commit
rs6000: Consider explicitly set options in target option parsing [PR115713]
authorKewen Lin <linkw@linux.ibm.com>
Tue, 23 Jul 2024 05:48:00 +0000 (00:48 -0500)
committerKewen Lin <linkw@gcc.gnu.org>
Tue, 23 Jul 2024 05:50:59 +0000 (00:50 -0500)
commite6db8848d956f5e712dd621d33630b799ff60a72
tree8f29ce43546b2517f5687d5ab6884e62b171896a
parent04da747a063850333b062e48d0531debe314dff9
rs6000: Consider explicitly set options in target option parsing [PR115713]

In rs6000_inner_target_options, when enabling VSX we enable
altivec and disable -mavoid-indexed-addresses implicitly,
but it doesn't consider the case that the options altivec
and avoid-indexed-addresses can be explicitly disabled.  As
the test case in PR115713#c1 shows, with target attribute
"no-altivec,vsx", it results in that VSX unexpectedly set
altivec flag and there isn't an expected error.

This patch is to avoid the automatic enablement when they
are explicitly specified.  With this change, an existing
test case ppc-target-4.c also requires an adjustment by
specifying explicit altivec in target attribute (since it
requires altivec feature and command line is specifying
no-altivec).

PR target/115713

gcc/ChangeLog:

* config/rs6000/rs6000.cc (rs6000_inner_target_options): Avoid to
enable altivec or disable avoid-indexed-addresses automatically
when they get specified explicitly.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/pr115713-1.c: New test.
* gcc.target/powerpc/ppc-target-4.c: Adjust by specifying altivec
in target attribute.
gcc/config/rs6000/rs6000.cc
gcc/testsuite/gcc.target/powerpc/ppc-target-4.c
gcc/testsuite/gcc.target/powerpc/pr115713-1.c [new file with mode: 0644]