]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
aarch64: allow adding/removing just feature flags via .arch_extension
authorJan Beulich <jbeulich@novell.com>
Tue, 18 Nov 2014 13:08:28 +0000 (14:08 +0100)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 23 Aug 2017 21:42:07 +0000 (18:42 -0300)
Rather than requiring to always also set/change the base architecture,
allow just en-/disabling of architecture extensions, matching what ARM
has.

Change-Id: Ibef421216db84a1e90679141be1153fdc115c6d0

gas/ChangeLog
gas/config/tc-aarch64.c
gas/testsuite/ChangeLog
gas/testsuite/gas/aarch64/crc32-directive.d [new file with mode: 0644]
gas/testsuite/gas/aarch64/crc32.s
gas/testsuite/gas/aarch64/crypto-directive.d [new file with mode: 0644]
gas/testsuite/gas/aarch64/crypto.s

index 1547815e996401cc25cb77c30d6c48e7d16c2652..bb2d5b5a387dad92edddb8ca10a7bd6b166e5a79 100644 (file)
@@ -1,3 +1,12 @@
+2014-11-18  Jan Beulich  <jbeulich@suse.com>
+
+       * config/tc-aarch64.c (s_aarch64_arch_extension): New.
+       (md_pseudo_table): Add arch_extension.
+       (aarch64_parse_features): New parameter "ext_only". Handle it.
+       (aarch64_parse_cpu, aarch64_parse_arch, s_aarch64_cpu,
+       s_aarch64_arch): Pass FALSE as new third argument of
+       aarch64_parse_features().
+
 2015-01-07  Jan Beulich <jbeulich@suse.com>
 
        * config/tc-arm.c (struct arm_option_extension_value_table):
index 0e587646d9327b53c8f1f340e518d9f3441970a6..de93546d5d7160a4a9e779c96068c35836fd2b6b 100644 (file)
@@ -1917,6 +1917,7 @@ s_tlsdesccall (int ignored ATTRIBUTE_UNUSED)
 
 static void s_aarch64_arch (int);
 static void s_aarch64_cpu (int);
+static void s_aarch64_arch_extension (int);
 
 /* This table describes all the machine specific pseudo-ops the assembler
    has to support.  The fields are:
@@ -1934,6 +1935,7 @@ const pseudo_typeS md_pseudo_table[] = {
   {"pool", s_ltorg, 0},
   {"cpu", s_aarch64_cpu, 0},
   {"arch", s_aarch64_arch, 0},
+  {"arch_extension", s_aarch64_arch_extension, 0},
   {"inst", s_aarch64_inst, 0},
 #ifdef OBJ_ELF
   {"tlsdesccall", s_tlsdesccall, 0},
@@ -7240,7 +7242,8 @@ struct aarch64_long_option_table
 };
 
 static int
-aarch64_parse_features (char *str, const aarch64_feature_set **opt_p)
+aarch64_parse_features (char *str, const aarch64_feature_set **opt_p,
+                       bfd_boolean ext_only)
 {
   /* We insist on extensions being added before being removed.  We achieve
      this by using the ADDING_VALUE variable to indicate whether we are
@@ -7256,17 +7259,19 @@ aarch64_parse_features (char *str, const aarch64_feature_set **opt_p)
   while (str != NULL && *str != 0)
     {
       const struct aarch64_option_cpu_value_table *opt;
-      char *ext;
+      char *ext = NULL;
       int optlen;
 
-      if (*str != '+')
+      if (!ext_only)
        {
-         as_bad (_("invalid architectural extension"));
-         return 0;
-       }
+         if (*str != '+')
+           {
+             as_bad (_("invalid architectural extension"));
+             return 0;
+           }
 
-      str++;
-      ext = strchr (str, '+');
+         ext = strchr (++str, '+');
+       }
 
       if (ext != NULL)
        optlen = ext - str;
@@ -7346,7 +7351,7 @@ aarch64_parse_cpu (char *str)
       {
        mcpu_cpu_opt = &opt->value;
        if (ext != NULL)
-         return aarch64_parse_features (ext, &mcpu_cpu_opt);
+         return aarch64_parse_features (ext, &mcpu_cpu_opt, FALSE);
 
        return 1;
       }
@@ -7378,7 +7383,7 @@ aarch64_parse_arch (char *str)
       {
        march_cpu_opt = &opt->value;
        if (ext != NULL)
-         return aarch64_parse_features (ext, &march_cpu_opt);
+         return aarch64_parse_features (ext, &march_cpu_opt, FALSE);
 
        return 1;
       }
@@ -7561,7 +7566,7 @@ s_aarch64_cpu (int ignored ATTRIBUTE_UNUSED)
       {
        mcpu_cpu_opt = &opt->value;
        if (ext != NULL)
-         if (!aarch64_parse_features (ext, &mcpu_cpu_opt))
+         if (!aarch64_parse_features (ext, &mcpu_cpu_opt, FALSE))
            return;
 
        cpu_variant = *mcpu_cpu_opt;
@@ -7607,7 +7612,7 @@ s_aarch64_arch (int ignored ATTRIBUTE_UNUSED)
       {
        mcpu_cpu_opt = &opt->value;
        if (ext != NULL)
-         if (!aarch64_parse_features (ext, &mcpu_cpu_opt))
+         if (!aarch64_parse_features (ext, &mcpu_cpu_opt, FALSE))
            return;
 
        cpu_variant = *mcpu_cpu_opt;
@@ -7622,6 +7627,28 @@ s_aarch64_arch (int ignored ATTRIBUTE_UNUSED)
   ignore_rest_of_line ();
 }
 
+/* Parse a .arch_extension directive.  */
+
+static void
+s_aarch64_arch_extension (int ignored ATTRIBUTE_UNUSED)
+{
+  char saved_char;
+  char *ext = input_line_pointer;;
+
+  while (*input_line_pointer && !ISSPACE (*input_line_pointer))
+    input_line_pointer++;
+  saved_char = *input_line_pointer;
+  *input_line_pointer = 0;
+
+  if (!aarch64_parse_features (ext, &mcpu_cpu_opt, TRUE))
+    return;
+
+  cpu_variant = *mcpu_cpu_opt;
+
+  *input_line_pointer = saved_char;
+  demand_empty_rest_of_line ();
+}
+
 /* Copy symbol information.  */
 
 void
index 9a1d5710aa5aab9e60a4e3a185e0a1b973ce50f9..0ad0f7f975aa0553f40f1085554335db8cb0f617 100644 (file)
@@ -1,3 +1,10 @@
+2014-11-18  Jan Beulich  <jbeulich@suse.com>
+
+       * gas/aarch64/crc32-directive.d: New.
+       * gas/aarch64/crypto-directive.d: New.
+       * gas/aarch64/crc32.s: Adjust to allow for directive use.
+       * gas/aarch64/crypto.s: Likewise.
+
 2015-03-10  Renlin Li  <renlin.li@arm.com>
 
        * gas/aarch64/ldst-reg-uns-imm.d: Adjust expected output.
diff --git a/gas/testsuite/gas/aarch64/crc32-directive.d b/gas/testsuite/gas/aarch64/crc32-directive.d
new file mode 100644 (file)
index 0000000..5f90755
--- /dev/null
@@ -0,0 +1,17 @@
+#objdump: -dr
+#as: --defsym DIRECTIVE=1
+#source: crc32.s
+
+.*:     file format .*
+
+Disassembly of section \.text:
+
+0000000000000000 <.*>:
+   0:  1acf40e3        crc32b  w3, w7, w15
+   4:  1ac345e7        crc32h  w7, w15, w3
+   8:  1ac7486f        crc32w  w15, w3, w7
+   c:  9acf4ce3        crc32x  w3, w7, x15
+  10:  1acf50e3        crc32cb w3, w7, w15
+  14:  1ac355e7        crc32ch w7, w15, w3
+  18:  1ac7586f        crc32cw w15, w3, w7
+  1c:  9acf5ce3        crc32cx w3, w7, x15
index 621d3ccd1a2f492ef3d704891a802aacab021f40..c5fe2975628dfa317ab4c3a5a6c7b7b2bc47092f 100644 (file)
 
 
        .text
+       .ifdef DIRECTIVE
+       .arch_extension crc
+       .endif
+
        crc32b  w3, w7, w15
        crc32h  w7, w15, w3
        crc32w  w15, w3, w7
@@ -29,3 +33,5 @@
        crc32ch w7, w15, w3
        crc32cw w15, w3, w7
        crc32cx w3, w7, x15
+
+       .arch_extension nocrc
diff --git a/gas/testsuite/gas/aarch64/crypto-directive.d b/gas/testsuite/gas/aarch64/crypto-directive.d
new file mode 100644 (file)
index 0000000..9fa0671
--- /dev/null
@@ -0,0 +1,27 @@
+#objdump: -dr
+#as: --defsym DIRECTIVE=1
+#source: crypto.s
+
+.*:     file format .*
+
+Disassembly of section \.text:
+
+0000000000000000 <.*>:
+   0:  4e284be7        aese    v7.16b, v31.16b
+   4:  4e285be7        aesd    v7.16b, v31.16b
+   8:  4e286be7        aesmc   v7.16b, v31.16b
+   c:  4e287be7        aesimc  v7.16b, v31.16b
+  10:  5e280be7        sha1h   s7, s31
+  14:  5e281be7        sha1su1 v7.4s, v31.4s
+  18:  5e282be7        sha256su0       v7.4s, v31.4s
+  1c:  5e1f01e7        sha1c   q7, s15, v31.4s
+  20:  5e1f11e7        sha1p   q7, s15, v31.4s
+  24:  5e1f21e7        sha1m   q7, s15, v31.4s
+  28:  5e1f31e7        sha1su0 v7.4s, v15.4s, v31.4s
+  2c:  5e1f41e7        sha256h q7, q15, v31.4s
+  30:  5e1f51e7        sha256h2        q7, q15, v31.4s
+  34:  5e1f61e7        sha256su1       v7.4s, v15.4s, v31.4s
+  38:  0e3fe1e7        pmull   v7.8h, v15.8b, v31.8b
+  3c:  0effe1e7        pmull   v7.1q, v15.1d, v31.1d
+  40:  4e3fe1e7        pmull2  v7.8h, v15.16b, v31.16b
+  44:  4effe1e7        pmull2  v7.1q, v15.2d, v31.2d
index 01cb954b4dff034a2712998b223c30faf33c5843..9e7e9d46f54770053d51cf9565732ad8399ffe0c 100644 (file)
 
 
        .text
+       .ifdef DIRECTIVE
+       .arch_extension crypto
+       .endif
+
        aese    v7.16b, v31.16b
        aesd    v7.16b, v31.16b
        aesmc   v7.16b, v31.16b
@@ -42,3 +46,5 @@
        pmull   v7.1q, v15.1d, v31.1d
        pmull2  v7.8h, v15.16b, v31.16b
        pmull2  v7.1q, v15.2d, v31.2d
+
+       .arch_extension nocrypto