From c4e18b1c3e26a9afeb3438f6173742ac5cb1fece Mon Sep 17 00:00:00 2001 From: Geoffrey Keating Date: Thu, 14 Oct 2004 22:30:47 +0000 Subject: [PATCH] darwin.h (ASM_SPEC): Delete. 2004-10-14 Geoffrey Keating * config/rs6000/darwin.h (ASM_SPEC): Delete. (TARGET_ASM_FILE_START): Define. * config/darwin.h (ASM_SPEC): Define. * config/rs6000/t-darwin (TARGET_LIBGCC2_CFLAGS): Don't supply -mlong-double-128, it's the default. Update comment about reason for force_cpusubtype_ALL. * config/rs6000/darwin-vecsave.asm: Supply .machine. * config/rs6000/darwin-world.asm: Likewise. * config/rs6000/rs6000.c (rs6000_darwin_file_start): New. (symbolic_operand): Delete #if 0ed code. Index: testsuite/ChangeLog 2004-10-14 Geoffrey Keating * gcc.dg/darwin-misaligned.c: Don't supply -force_cpusubtype_ALL. * gcc.dg/macho-lo-sum.c: Likewise. From-SVN: r89059 --- gcc/ChangeLog | 13 ++++ gcc/config/darwin.h | 3 + gcc/config/rs6000/darwin-vecsave.asm | 1 + gcc/config/rs6000/darwin-world.asm | 1 + gcc/config/rs6000/darwin.h | 13 ++-- gcc/config/rs6000/rs6000.c | 81 ++++++++++++++++-------- gcc/config/rs6000/t-darwin | 8 +-- gcc/testsuite/ChangeLog | 5 ++ gcc/testsuite/gcc.dg/darwin-misaligned.c | 2 +- gcc/testsuite/gcc.dg/macho-lo-sum.c | 2 +- 10 files changed, 86 insertions(+), 43 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8f4d0337949..2475f9f2c27 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2004-10-14 Geoffrey Keating + + * config/rs6000/darwin.h (ASM_SPEC): Delete. + (TARGET_ASM_FILE_START): Define. + * config/darwin.h (ASM_SPEC): Define. + * config/rs6000/t-darwin (TARGET_LIBGCC2_CFLAGS): Don't supply + -mlong-double-128, it's the default. Update comment about reason + for force_cpusubtype_ALL. + * config/rs6000/darwin-vecsave.asm: Supply .machine. + * config/rs6000/darwin-world.asm: Likewise. + * config/rs6000/rs6000.c (rs6000_darwin_file_start): New. + (symbolic_operand): Delete #if 0ed code. + 2004-10-14 Andrew Pinski * stmt.c (add_case_node): Make sure that we have integer diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 0fd84739d08..029342878f6 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -330,6 +330,9 @@ extern const char *darwin_fix_and_continue_switch; to put anything in ENDFILE_SPEC. */ /* #define ENDFILE_SPEC "" */ +/* Default Darwin ASM_SPEC, very simple. */ +#define ASM_SPEC "-arch %(darwin_arch)" + /* We use Dbx symbol format. */ #define DBX_DEBUGGING_INFO 1 diff --git a/gcc/config/rs6000/darwin-vecsave.asm b/gcc/config/rs6000/darwin-vecsave.asm index 58ec8eaa1a3..b060c36830b 100644 --- a/gcc/config/rs6000/darwin-vecsave.asm +++ b/gcc/config/rs6000/darwin-vecsave.asm @@ -41,6 +41,7 @@ (4 bytes) to do the operation; for Vector regs, 2 instructions are required (8 bytes.). */ + .machine ppc7400 .text .align 2 diff --git a/gcc/config/rs6000/darwin-world.asm b/gcc/config/rs6000/darwin-world.asm index 630cabcfeb6..1af21d55375 100644 --- a/gcc/config/rs6000/darwin-world.asm +++ b/gcc/config/rs6000/darwin-world.asm @@ -34,6 +34,7 @@ * executable file might be covered by the GNU General Public License. */ + .machine ppc7400 .data .align 2 diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h index 6e341fde4fb..7f499792bd3 100644 --- a/gcc/config/rs6000/darwin.h +++ b/gcc/config/rs6000/darwin.h @@ -132,19 +132,14 @@ do { \ %{static: %{Zdynamic: %e conflicting code gen style switches are used}}\ %{!static:%{!mdynamic-no-pic:-fPIC}}" -/* It's virtually impossible to predict all the possible combinations - of -mcpu and -maltivec and whatnot, so just supply - -force_cpusubtype_ALL if any are seen. Radar 3492132 against the - assembler is asking for a .machine directive so we could get this - really right. */ -#define ASM_SPEC "-arch ppc \ - %{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL} \ - %{!Zforce_cpusubtype_ALL:%{maltivec|mcpu=*|mpowerpc64:-force_cpusubtype_ALL}}" - #undef SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS \ { "darwin_arch", "ppc" }, +/* Output a .machine directive. */ +#undef TARGET_ASM_FILE_START +#define TARGET_ASM_FILE_START rs6000_darwin_file_start + /* The "-faltivec" option should have been called "-maltivec" all along. -ffix-and-continue and -findirect-data is for compatibility for old compilers. */ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 14240f5b3fa..3026e59c0be 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -754,6 +754,7 @@ static void macho_branch_islands (void); static void add_compiler_branch_island (tree, tree, int); static int no_previous_def (tree function_name); static tree get_prev_label (tree function_name); +static void rs6000_darwin_file_start (void); #endif static tree rs6000_build_builtin_va_list (void); @@ -1713,6 +1714,7 @@ rs6000_file_start (void) putc ('\n', file); } } + /* Return nonzero if this function is known to have a null epilogue. */ @@ -16859,32 +16861,6 @@ rs6000_fatal_bad_address (rtx op) #if TARGET_MACHO -#if 0 -/* Returns 1 if OP is either a symbol reference or a sum of a symbol - reference and a constant. */ - -int -symbolic_operand (rtx op) -{ - switch (GET_CODE (op)) - { - case SYMBOL_REF: - case LABEL_REF: - return 1; - case CONST: - op = XEXP (op, 0); - return (GET_CODE (op) == SYMBOL_REF || - (GET_CODE (XEXP (op, 0)) == SYMBOL_REF - || GET_CODE (XEXP (op, 0)) == LABEL_REF) - && GET_CODE (XEXP (op, 1)) == CONST_INT); - default: - return 0; - } -} -#endif - -#if TARGET_MACHO - static tree branch_island_list = 0; /* Remember to generate a branch island for far calls to the given @@ -17060,8 +17036,6 @@ output_call (rtx insn, rtx *operands, int dest_operand_number, return buf; } -#endif /* TARGET_MACHO */ - /* Generate PIC and indirect symbol stubs. */ void @@ -17197,6 +17171,57 @@ toc_section (void) { } +/* Output a .machine directive for the Darwin assembler, and call + the generic start_file routine. */ + +static void +rs6000_darwin_file_start (void) +{ + static const struct + { + const char *arg; + const char *name; + int if_set; + } mapping[] = { + { "970", "ppc970", MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64 }, + { "power4", "ppc970", 0 }, + { "G5", "ppc970", 0 }, + { "7450", "ppc7450", 0 }, + { "7400", "ppc7400", MASK_ALTIVEC }, + { "G4", "ppc7400", 0 }, + { "750", "ppc750", 0 }, + { "740", "ppc750", 0 }, + { "G3", "ppc750", 0 }, + { "604e", "ppc604e", 0 }, + { "604", "ppc604", 0 }, + { "603e", "ppc603", 0 }, + { "603", "ppc603", 0 }, + { "601", "ppc601", 0 }, + { NULL, "ppc", 0 } }; + const char *cpu_id = ""; + size_t i; + + rs6000_file_start(); + + /* Determine the argument to -mcpu=. Default to G3 if not specified. */ + for (i = 0; i < ARRAY_SIZE (rs6000_select); i++) + if (rs6000_select[i].set_arch_p && rs6000_select[i].string + && rs6000_select[i].string[0] != '\0') + cpu_id = rs6000_select[i].string; + + /* Look through the mapping array. Pick the first name that either + matches the argument, has a bit set in IF_SET that is also set + in the target flags, or has a NULL name. */ + + i = 0; + while (mapping[i].arg != NULL + && strcmp (mapping[i].arg, cpu_id) != 0 + && (mapping[i].if_set & target_flags) == 0) + i++; + + fprintf (asm_out_file, "\t.machine %s\n", mapping[i].name); +} + #endif /* TARGET_MACHO */ #if TARGET_ELF diff --git a/gcc/config/rs6000/t-darwin b/gcc/config/rs6000/t-darwin index f38adb92a33..3e890884129 100644 --- a/gcc/config/rs6000/t-darwin +++ b/gcc/config/rs6000/t-darwin @@ -7,7 +7,7 @@ LIB2FUNCS_STATIC_EXTRA = \ $(srcdir)/config/rs6000/darwin-vecsave.asm \ $(srcdir)/config/rs6000/darwin-world.asm -# Enable AltiVec instructions when assembling the aforementioned .asm files. -# For libgcc, we always want 128-bit long double, since a libgcc built with -# that will work without it. -TARGET_LIBGCC2_CFLAGS = -mlong-double-128 -Wa,-force_cpusubtype_ALL +# The .asm files above are designed to run on all processors, +# even though they use AltiVec instructions. -Wa is used because +# -force_cpusubtype_ALL doesn't work with -dynamiclib. +TARGET_LIBGCC2_CFLAGS = -Wa,-force_cpusubtype_ALL diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e4544974e55..f0ff7e39b90 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-10-14 Geoffrey Keating + + * gcc.dg/darwin-misaligned.c: Don't supply -force_cpusubtype_ALL. + * gcc.dg/macho-lo-sum.c: Likewise. + 2004-10-14 Joseph S. Myers * gcc.dg/ppc-spe64-1.c: New test. diff --git a/gcc/testsuite/gcc.dg/darwin-misaligned.c b/gcc/testsuite/gcc.dg/darwin-misaligned.c index 5b89f574b76..9e53b7b2224 100644 --- a/gcc/testsuite/gcc.dg/darwin-misaligned.c +++ b/gcc/testsuite/gcc.dg/darwin-misaligned.c @@ -1,5 +1,5 @@ /* { dg-do compile { target powerpc*-*-darwin* } } */ -/* { dg-options "-O2 -force_cpusubtype_ALL -mpowerpc64" } */ +/* { dg-options "-O2 -mpowerpc64" } */ typedef struct Nlm_rect { short sh1; diff --git a/gcc/testsuite/gcc.dg/macho-lo-sum.c b/gcc/testsuite/gcc.dg/macho-lo-sum.c index 094b9607685..9e0b8656c23 100644 --- a/gcc/testsuite/gcc.dg/macho-lo-sum.c +++ b/gcc/testsuite/gcc.dg/macho-lo-sum.c @@ -1,5 +1,5 @@ /* { dg-do compile { target powerpc*-*-darwin* } } */ -/* { dg-options "-O2 -force_cpusubtype_ALL -mpowerpc64 -mdynamic-no-pic" } */ +/* { dg-options "-O2 -mpowerpc64 -mdynamic-no-pic" } */ long long knight_attacks[64]; long long InitializeAttackBoards(void); -- 2.30.2