Patchwork [AArch64] Fix the generation of .arch and .cpu assembly directives

login
register
mail settings
Submitter Yufeng Zhang
Date April 10, 2013, 2:44 p.m.
Message ID <51657AB0.3010801@arm.com>
Download mbox | patch
Permalink /patch/235403/
State New
Headers show

Comments

Yufeng Zhang - April 10, 2013, 2:44 p.m.
Hi,

This patch changes the compiler to correctly generate .arch and .cpu 
assembly directives in order to support the inline assembly of
instructions that are part of a feature, e.g. crypto.

OK for the trunk?

Thanks,
Yufeng


gcc/

         * config/aarch64/aarch64.c (aarch64_print_extension): New function.
         (aarch64_start_file): Use the new function.
Marcus Shawcroft - April 10, 2013, 3:04 p.m.
On 10/04/13 15:44, Yufeng Zhang wrote:
> Hi,
>
> This patch changes the compiler to correctly generate .arch and .cpu
> assembly directives in order to support the inline assembly of
> instructions that are part of a feature, e.g. crypto.
>
> OK for the trunk?
>
> Thanks,
> Yufeng
>
>
> gcc/
>
>           * config/aarch64/aarch64.c (aarch64_print_extension): New function.
>           (aarch64_start_file): Use the new function.
>

OK
Marcus Shawcroft - April 22, 2013, 2:43 p.m.
Yufeng, please back port this patch to 4.8.

Thanks
/Marcus

On 10 April 2013 15:44, Yufeng Zhang <Yufeng.Zhang@arm.com> wrote:
> Hi,
>
> This patch changes the compiler to correctly generate .arch and .cpu
> assembly directives in order to support the inline assembly of
> instructions that are part of a feature, e.g. crypto.
>
> OK for the trunk?
>
> Thanks,
> Yufeng
>
>
> gcc/
>
>         * config/aarch64/aarch64.c (aarch64_print_extension): New function.
>         (aarch64_start_file): Use the new function.
Yufeng Zhang - April 22, 2013, 5:01 p.m.
On 04/22/13 15:43, Marcus Shawcroft wrote:
> Yufeng, please back port this patch to 4.8.

Done in r198146.

Yufeng

Patch

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 827b8df..49016c1 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -7080,12 +7080,30 @@  aarch64_split_atomic_op (enum rtx_code code, rtx old_out, rtx new_out, rtx mem,
 }
 
 static void
+aarch64_print_extension (void)
+{
+  const struct aarch64_option_extension *opt = NULL;
+
+  for (opt = all_extensions; opt->name != NULL; opt++)
+    if ((aarch64_isa_flags & opt->flags_on) == opt->flags_on)
+      asm_fprintf (asm_out_file, "+%s", opt->name);
+
+  asm_fprintf (asm_out_file, "\n");
+}
+
+static void
 aarch64_start_file (void)
 {
   if (selected_arch)
-    asm_fprintf (asm_out_file, "\t.arch %s\n", selected_arch->name);
+    {
+      asm_fprintf (asm_out_file, "\t.arch %s", selected_arch->name);
+      aarch64_print_extension ();
+    }
   else if (selected_cpu)
-    asm_fprintf (asm_out_file, "\t.cpu %s\n", selected_cpu->name);
+    {
+      asm_fprintf (asm_out_file, "\t.cpu %s", selected_cpu->name);
+      aarch64_print_extension ();
+    }
   default_file_start();
 }