+2019-02-28 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.
+
2019-02-28 Jakub Jelinek <jakub@redhat.com>
PR c/89520
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",
{
for (i = 0; i < num_exts; i++)
{
- char *p = NULL;
- char *feat_string
- = concat (aarch64_extensions[i].feat_string, NULL);
+ const char *p = aarch64_extensions[i].feat_string;
+
+ /* If the feature contains no HWCAPS string then ignore it for the
+ auto detection. */
+ if (*p == '\0')
+ continue;
+
bool enabled = true;
/* This may be a multi-token feature string. We need
- to match all parts, which could be in any order.
- If this isn't a multi-token feature string, strtok is
- just going to return a pointer to feat_string. */
- p = strtok (feat_string, " ");
- while (p != NULL)
+ to match all parts, which could be in any order. */
+ size_t len = strlen (buf);
+ do
{
- if (strstr (buf, p) == NULL)
+ const char *end = strchr (p, ' ');
+ if (end == NULL)
+ end = strchr (p, '\0');
+ if (memmem (buf, len, p, end - p) == NULL)
{
/* Failed to match this token. Turn off the
features we'd otherwise enable. */
enabled = false;
break;
}
- p = strtok (NULL, " ");
+ if (*end == '\0')
+ break;
+ p = end + 1;
}
+ while (1);
if (enabled)
extension_flags |= aarch64_extensions[i].flag;
not_found:
{
/* If detection fails we ignore the option.
- Clean up and return empty string. */
+ Clean up and return NULL. */
if (f)
fclose (f);
- return "";
+ return NULL;
}
}
--- /dev/null
+/* { 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. */