This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [AArch64] Break -mcpu tie between the compiler and assembler


On Wed, Aug 19, 2015 at 11:39 PM, James Greenhalgh
<james.greenhalgh@arm.com> wrote:
>
> Hi,
>
> This patch has been sitting in my tree for a while - it comes in handy
> when trying out bootstrap or test with -mcpu values like -mcpu=cortex-a72
> with a system assmebler which trails trunk binutils.
>
> Essentially, we rewrite -mcpu=foo to a -march flag providing the same
> architecture revision and set of optional architecture features. There
> is no reason we should ever need the assembler to see a CPU name, it
> should only be interested in the architecture variant.
>
> While we're there I've long found this function too fragile and hard
> to grok in C. So I've rewritten it in C++ to use std::string rather than
> raw C strings. Making this work with extension strings requires a slight
> refactor to the existing extension printing code to pull it across to
> somewhere common.
>
> Note that this also stops us from having to pick through a big.LITTLE
> target to find and separate the core names - we can just look up the
> architecture of the whole target and use that.
>
> The new function does leak the allocation of a C string to hold the
> result, but looking at gcc.c:getenv_spec_function and
> gcc.c:replace_extension_spec_func this is the usual thing to do.
>
> This has been through an aarch64-none-linux-gnu bootstrap and test run,
> configured with --with-cpu=cortex-a72 , which my system assembler does
> not understand.
>
> Ok?

I like this since this helps me not having to have a newer assembler
for -mcpu=thunderx.  Though I still need it for LSE support in the
assembler.  Has anyone thought about adding a configure test for v8.1
(LSE and other) support and disabling those extensions (yes this is
the same issue on x86_64 with AVX)?

Thanks,
Andrew

>
> Thanks,
> James
>
> ---
> 2015-08-19  James Greenhalgh  <james.greenhalgh@arm.com>
>
>         * common/config/aarch64/aarch64-common.c
>         (AARCH64_CPU_NAME_LENGTH): Delete.
>         (aarch64_option_extension): New.
>         (all_extensions): Likewise.
>         (processor_name_to_arch): Likewise.
>         (arch_to_arch_name): Likewise.
>         (all_cores): New.
>         (all_architectures): Likewise.
>         (aarch64_get_extension_string_for_isa_flags): Likewise.
>         (aarch64_rewrite_selected_cpu): Change to rewrite CPU names to
>         architecture names.
>         * config/aarch64/aarch64-protos.h
>         (aarch64_get_extension_string_for_isa_flags): New.
>         * config/aarch64/aarch64.c (aarch64_print_extension): Delete.
>         (aarch64_option_print): Get the string to print from
>         aarch64_get_extension_string_for_isa_flags.
>         (aarch64_declare_function_name): Likewise.
>         * config/aarch64/aarch64.h (BIG_LITTLE_SPEC): Rename to...
>         (MCPU_TO_MARCH_SPEC): This.
>         (ASM_CPU_SPEC): Use it.
>         (BIG_LITTLE_SPEC_FUNCTIONS): Rename to...
>         (MCPU_TO_MARCH_SPEC_FUNCTIONS): ...This.
>         (EXTRA_SPEC_FUNCTIONS): Use it.
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]