public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][GCC][AArch64] Have empty HWCAPs string ignored during native feature detection
@ 2018-12-18 13:36 Tamar Christina
  2019-01-10 16:57 ` Kyrill Tkachov
  0 siblings, 1 reply; 14+ messages in thread
From: Tamar Christina @ 2018-12-18 13:36 UTC (permalink / raw)
  To: gcc-patches; +Cc: nd, James Greenhalgh, Richard Earnshaw, Marcus Shawcroft

[-- Attachment #1: Type: text/plain, Size: 910 bytes --]

Hi All,

This patch makes the feature detection code for AArch64 GCC not add features
automatically when the feature had no hwcaps string to match against.

This means that -mcpu=native no longer adds feature flags such as +profile.
The behavior wasn't noticed before because at the time +profile was added a bug
was preventing any feature bits from being added by native detections.

Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.

Ok for trunk?

Thanks,
Tamar

gcc/ChangeLog:

2018-12-18  Tamar Christina  <tamar.christina@arm.com>

	PR target/88530
	* config/aarch64/aarch64-option-extensions.def: Document it.
	* config/aarch64/driver-aarch64.c (host_detect_local_cpu): Skip feature
	if empty hwcaps.

gcc/testsuite/ChangeLog:

2018-12-18  Tamar Christina  <tamar.christina@arm.com>

	PR target/88530
	* gcc.target/aarch64/options_set_10.c: New test.

-- 

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: rb10438.patch --]
[-- Type: text/x-diff; name="rb10438.patch", Size: 2211 bytes --]

diff --git a/gcc/config/aarch64/aarch64-option-extensions.def b/gcc/config/aarch64/aarch64-option-extensions.def
index cdf04e2d5fcccb8b9a32af8f83501ce23212bbab..323e642af2e87c2d463681c3a3efbaeff2ede018 100644
--- a/gcc/config/aarch64/aarch64-option-extensions.def
+++ b/gcc/config/aarch64/aarch64-option-extensions.def
@@ -43,7 +43,8 @@
    the extension (for example, the 'crypto' extension depends on four
    entries: aes, pmull, sha1, sha2 being present).  In that case this field
    should contain a space (" ") separated list of the strings in 'Features'
-   that are required.  Their order is not important.  */
+   that are required.  Their order is not important.  An empty string means
+   do not detect this feature during auto detection.  */
 
 /* Enabling "fp" just enables "fp".
    Disabling "fp" also disables "simd", "crypto", "fp16", "aes", "sha2",
diff --git a/gcc/config/aarch64/driver-aarch64.c b/gcc/config/aarch64/driver-aarch64.c
index 98f9d7959506338bd6a8524500a168cc22ef5396..4f386dbf5fc29cc54ff85e062d0b9cd146fa00e8 100644
--- a/gcc/config/aarch64/driver-aarch64.c
+++ b/gcc/config/aarch64/driver-aarch64.c
@@ -253,6 +253,12 @@ host_detect_local_cpu (int argc, const char **argv)
 	      char *p = NULL;
 	      char *feat_string
 		= concat (aarch64_extensions[i].feat_string, NULL);
+
+	      /* If the feature contains no HWCAPS string then ignore it for the
+		 auto detection.  */
+	      if (strlen (feat_string) == 0)
+		continue;
+
 	      bool enabled = true;
 
 	      /* This may be a multi-token feature string.  We need
diff --git a/gcc/testsuite/gcc.target/aarch64/options_set_10.c b/gcc/testsuite/gcc.target/aarch64/options_set_10.c
new file mode 100644
index 0000000000000000000000000000000000000000..5ffe83c199165dd4129814674297056bdf27cd83
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/options_set_10.c
@@ -0,0 +1,11 @@
+/* { dg-do compile { target "aarch64*-*-linux*" } } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main ()
+{
+  return 0;
+}
+
+/* { dg-final { scan-assembler-not {\.arch .+\+profile.*} } } */
+
+ /* Check that an empty feature string is not detected during mcpu=native.  */


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

end of thread, other threads:[~2019-03-04 13:43 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-18 13:36 [PATCH][GCC][AArch64] Have empty HWCAPs string ignored during native feature detection Tamar Christina
2019-01-10 16:57 ` Kyrill Tkachov
2019-01-23 16:28   ` Jakub Jelinek
2019-01-30 14:10     ` Tamar Christina
2019-01-30 14:24       ` Jakub Jelinek
2019-01-30 15:10         ` Tamar Christina
2019-02-07 10:43           ` Tamar Christina
2019-02-27 13:26             ` Tamar Christina
2019-02-27 18:43             ` James Greenhalgh
2019-02-27 18:44               ` Tamar Christina
2019-03-04 13:32                 ` Christophe Lyon
2019-03-04 13:36                   ` Tamar Christina
2019-03-04 13:38                   ` Jakub Jelinek
2019-03-04 13:43                     ` Tamar Christina

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