Mercurial > hg > CbC > CbC_gcc
comparison gcc/config/riscv/riscv-c.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* RISC-V-specific code for C family languages. | 1 /* RISC-V-specific code for C family languages. |
2 Copyright (C) 2011-2017 Free Software Foundation, Inc. | 2 Copyright (C) 2011-2018 Free Software Foundation, Inc. |
3 Contributed by Andrew Waterman (andrew@sifive.com). | 3 Contributed by Andrew Waterman (andrew@sifive.com). |
4 | 4 |
5 This file is part of GCC. | 5 This file is part of GCC. |
6 | 6 |
7 GCC is free software; you can redistribute it and/or modify | 7 GCC is free software; you can redistribute it and/or modify |
16 | 16 |
17 You should have received a copy of the GNU General Public License | 17 You should have received a copy of the GNU General Public License |
18 along with GCC; see the file COPYING3. If not see | 18 along with GCC; see the file COPYING3. If not see |
19 <http://www.gnu.org/licenses/>. */ | 19 <http://www.gnu.org/licenses/>. */ |
20 | 20 |
21 #define IN_TARGET_CODE 1 | |
22 | |
21 #include "config.h" | 23 #include "config.h" |
22 #include "system.h" | 24 #include "system.h" |
23 #include "coretypes.h" | 25 #include "coretypes.h" |
24 #include "tm.h" | 26 #include "tm.h" |
25 #include "c-family/c-common.h" | 27 #include "c-family/c-common.h" |
31 | 33 |
32 void | 34 void |
33 riscv_cpu_cpp_builtins (cpp_reader *pfile) | 35 riscv_cpu_cpp_builtins (cpp_reader *pfile) |
34 { | 36 { |
35 builtin_define ("__riscv"); | 37 builtin_define ("__riscv"); |
36 | 38 |
37 if (TARGET_RVC) | 39 if (TARGET_RVC) |
38 builtin_define ("__riscv_compressed"); | 40 builtin_define ("__riscv_compressed"); |
39 | 41 |
42 if (TARGET_RVE) | |
43 builtin_define ("__riscv_32e"); | |
44 | |
40 if (TARGET_ATOMIC) | 45 if (TARGET_ATOMIC) |
41 builtin_define ("__riscv_atomic"); | 46 builtin_define ("__riscv_atomic"); |
42 | 47 |
43 if (TARGET_MUL) | 48 if (TARGET_MUL) |
44 builtin_define ("__riscv_mul"); | 49 builtin_define ("__riscv_mul"); |
45 if (TARGET_DIV) | 50 if (TARGET_DIV) |
46 builtin_define ("__riscv_div"); | 51 builtin_define ("__riscv_div"); |
47 if (TARGET_DIV && TARGET_MUL) | 52 if (TARGET_DIV && TARGET_MUL) |
48 builtin_define ("__riscv_muldiv"); | 53 builtin_define ("__riscv_muldiv"); |
49 | 54 |
50 builtin_define_with_int_value ("__riscv_xlen", UNITS_PER_WORD * 8); | 55 builtin_define_with_int_value ("__riscv_xlen", UNITS_PER_WORD * 8); |
51 if (TARGET_HARD_FLOAT) | 56 if (TARGET_HARD_FLOAT) |
52 builtin_define_with_int_value ("__riscv_flen", UNITS_PER_FP_REG * 8); | 57 builtin_define_with_int_value ("__riscv_flen", UNITS_PER_FP_REG * 8); |
53 | 58 |
54 if (TARGET_HARD_FLOAT && TARGET_FDIV) | 59 if (TARGET_HARD_FLOAT && TARGET_FDIV) |
55 { | 60 { |
56 builtin_define ("__riscv_fdiv"); | 61 builtin_define ("__riscv_fdiv"); |
57 builtin_define ("__riscv_fsqrt"); | 62 builtin_define ("__riscv_fsqrt"); |
58 } | 63 } |
59 | 64 |
60 switch (riscv_abi) | 65 switch (riscv_abi) |
61 { | 66 { |
67 case ABI_ILP32E: | |
68 builtin_define ("__riscv_abi_rve"); | |
69 gcc_fallthrough (); | |
70 | |
62 case ABI_ILP32: | 71 case ABI_ILP32: |
63 case ABI_LP64: | 72 case ABI_LP64: |
64 builtin_define ("__riscv_float_abi_soft"); | 73 builtin_define ("__riscv_float_abi_soft"); |
65 break; | 74 break; |
66 | 75 |
67 case ABI_ILP32F: | 76 case ABI_ILP32F: |
68 case ABI_LP64F: | 77 case ABI_LP64F: |
69 builtin_define ("__riscv_float_abi_single"); | 78 builtin_define ("__riscv_float_abi_single"); |
70 break; | 79 break; |
71 | 80 |
72 case ABI_ILP32D: | 81 case ABI_ILP32D: |
73 case ABI_LP64D: | 82 case ABI_LP64D: |
74 builtin_define ("__riscv_float_abi_double"); | 83 builtin_define ("__riscv_float_abi_double"); |
75 break; | 84 break; |
76 } | 85 } |
77 | 86 |
78 switch (riscv_cmodel) | 87 switch (riscv_cmodel) |
79 { | 88 { |
80 case CM_MEDLOW: | 89 case CM_MEDLOW: |
81 builtin_define ("__riscv_cmodel_medlow"); | 90 builtin_define ("__riscv_cmodel_medlow"); |
82 break; | 91 break; |
83 | 92 |
84 case CM_MEDANY: | 93 case CM_MEDANY: |
85 builtin_define ("__riscv_cmodel_medany"); | 94 builtin_define ("__riscv_cmodel_medany"); |
86 break; | 95 break; |
87 | 96 |
88 case CM_PIC: | 97 case CM_PIC: |
89 builtin_define ("__riscv_cmodel_pic"); | 98 builtin_define ("__riscv_cmodel_pic"); |
90 break; | 99 break; |
91 } | 100 } |
92 } | 101 } |