On Fri, Jan 17, 2014 at 10:58 PM, Alan Modra <amo...@gmail.com> wrote: > This patch cures PR59828 by translating all the -mcpu options at once, > in order, to their equivalent assembler -m options by using a new spec > function. In the process this removes some duplication. > > All the rhs of -mcpu= options from the command line can be extracted > with %{mcpu=*:%*}, and then passed to a spec function. The new > function was mostly already there in driver-rs6000.c to support > -mcpu=native. However, the new spec function must be called for > non-native configurations, so it's necessary to split driver-rs6000.c > into two files, one for native support, the other always compiled in. > > I deliberately omitted converting over aix42.h, aix51.h and aix52.h > because ASM_CPU_SPEC in those files translates -mcpu to different > assembly options than the aix -mcpu=native support. Presumably the > assembler on older versions of aix doesn't understand the newer > options.. > > Bootstrapped and regression tested powerpc64-linux natively, and > x86_64-linux to powerpc64-linux cross. OK to apply? > > PR target/59828 > * config/rs6000/driver-rs6000.c (asm_names): Add entries for "native". > (translate_cpu_to_asm): New function. > Move everything else to.. > * config/rs6000/driver-nat-rs6000.c: ..here. New file. > (host_detect_local_cpu): Make use of translate_cpu_to_asm. > * config/rs6000/rs6000.h (ASM_CPU_SPEC): Likewise. > (translate_cpu_to_asm): Declare. > (EXTRA_SPEC_FUNCTIONS): Add translate_cpu_to_asm. > * config/rs6000/x-rs6000: Adjust for renamed file. > * config/rs6000/t-rs6000: Add driver-rs6000.o rule. > * config/rs6000/aix53.h (ASM_CPU_SPEC): Use translate_cpu_to_asm. > * config/rs6000/aix61.h (ASM_CPU_SPEC): Likewise. > * config.gcc (extra_gcc_objs): Add driver-rs6000.o. > * config.host (host_extra_gcc_objs): Remove driver-rs6000.o, add > driver-nat-rs6000.o.
Alan, ASM_CPU_SPEC is too fragile a mechanism. I would much prefer to expand on the ".machine" directive that I added to rs6000_file_start(). The initial implementation explicitly avoids .machine when -mcpu= or --with-cpu= is present as a conservative start. It seems much better to select a .machine directive based on the actual target ISA flag bits enabled than translating CPU command line options to ASM options. Patches to replace ASM_CPU_SPEC with .machine and expand functionality for AIX are welcome. Thanks, David