xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/config/arc/driver-arc.c (revision d90047b5d07facf36e6c01dcc0bded8997ce9cc2)
1 /* Subroutines for the gcc driver.
2    Copyright (C) 2016-2017 Free Software Foundation, Inc.
3    Contributed by Claudiu Zissulescu <claziss@synopsys.com>
4 
5    This file is part of GCC.
6 
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.
11 
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.
16 
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/>.  */
20 
21 #include "config.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "tm.h"
25 
26 /* Returns command line parameters to pass to as.  */
27 
28 const char*
29 arc_cpu_to_as (int argc, const char **argv)
30 {
31   const char *name = NULL;
32   const arc_cpu_t *arc_selected_cpu;
33 
34   /* No argument, check what is the default cpu.  */
35   if (argc == 0)
36     {
37       arc_selected_cpu = &arc_cpu_types[(int) TARGET_CPU_DEFAULT];
38     }
39   else
40     {
41       name = argv[0];
42       for (arc_selected_cpu = arc_cpu_types; arc_selected_cpu->name;
43 	   arc_selected_cpu++)
44 	{
45 	  if (strcmp (arc_selected_cpu->name, name) == 0)
46 	    break;
47 	}
48     }
49 
50   switch (arc_selected_cpu->arch_info->arch_id)
51     {
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 ();
79     }
80   return NULL;
81 }
82