PR tree-optimization/82929
[official-gcc.git] / gcc / config / arc / driver-arc.c
blob0e13878ff732a0b4e825ceac4fa186b0bb73bdb4
1 /* Subroutines for the gcc driver.
2 Copyright (C) 2016-2017 Free Software Foundation, Inc.
3 Contributed by Claudiu Zissulescu <claziss@synopsys.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 #include "config.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "tm.h"
26 /* Returns command line parameters to pass to as. */
28 const char*
29 arc_cpu_to_as (int argc, const char **argv)
31 const char *name = NULL;
32 const arc_cpu_t *arc_selected_cpu;
34 /* No argument, check what is the default cpu. */
35 if (argc == 0)
37 arc_selected_cpu = &arc_cpu_types[(int) TARGET_CPU_DEFAULT];
39 else
41 name = argv[0];
42 for (arc_selected_cpu = arc_cpu_types; arc_selected_cpu->name;
43 arc_selected_cpu++)
45 if (strcmp (arc_selected_cpu->name, name) == 0)
46 break;
50 switch (arc_selected_cpu->arch_info->arch_id)
52 case BASE_ARCH_em:
53 if (arc_selected_cpu->flags & FL_CD)
54 name = "-mcode-density";
55 else
56 name = "";
57 if (arc_selected_cpu->flags & FL_FPUDA)
58 name = concat ("-mfpuda ", name, NULL);
59 if (arc_selected_cpu->flags & FL_SPFP)
60 name = concat ("-mspfp ", name, NULL);
61 if (arc_selected_cpu->flags & FL_DPFP)
62 name = concat ("-mdpfp ", name, NULL);
63 return concat ("-mcpu=arcem ", name, NULL);
64 case BASE_ARCH_hs:
65 return "-mcpu=archs";
66 case BASE_ARCH_700:
67 if (arc_selected_cpu->processor == PROCESSOR_nps400)
68 return "-mcpu=nps400 -mEA";
69 else
70 return "-mcpu=arc700 -mEA";
71 case BASE_ARCH_6xx:
72 if (arc_selected_cpu->flags & FL_MUL64)
73 return "-mcpu=arc600 -mmul64 -mnorm";
74 if (arc_selected_cpu->flags & FL_MUL32x16)
75 return "-mcpu=arc600 -mdsp-packa -mnorm";
76 return "-mcpu=arc600 -mnorm";
77 default:
78 gcc_unreachable ();
80 return NULL;