| 1 |
# Copyright (C) 2007-2025 Free Software Foundation, Inc. |
| 2 |
|
| 3 |
# This program is free software; you can redistribute it and/or modify |
| 4 |
# it under the terms of the GNU General Public License as published by |
| 5 |
# the Free Software Foundation; either version 3 of the License, or |
| 6 |
# (at your option) any later version. |
| 7 |
# |
| 8 |
# This program is distributed in the hope that it will be useful, |
| 9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
# GNU General Public License for more details. |
| 12 |
# |
| 13 |
# You should have received a copy of the GNU General Public License |
| 14 |
# along with GCC; see the file COPYING3. If not see |
| 15 |
# <http://www.gnu.org/licenses/>. |
| 16 |
|
| 17 |
# GCC testsuite that uses the `dg.exp' driver. |
| 18 |
|
| 19 |
# Exit immediately if this isn't an arc target. |
| 20 |
if ![istarget arc*-*-*] then { |
| 21 |
return |
| 22 |
} |
| 23 |
|
| 24 |
# Load support procs. |
| 25 |
load_lib gcc-dg.exp |
| 26 |
|
| 27 |
# Return 1 if this is a compiler supporting ARCv2 EM as default processor |
| 28 |
proc check_effective_target_arcem { } { |
| 29 |
return [check_no_compiler_messages arcem assembly { |
| 30 |
#if !defined(__ARCEM__) |
| 31 |
#error No ARC EM |
| 32 |
#endif |
| 33 |
}] |
| 34 |
} |
| 35 |
|
| 36 |
# Return 1 if we compile for ARC700 |
| 37 |
proc check_effective_target_arc700 { } { |
| 38 |
return [check_no_compiler_messages arc700 assembly { |
| 39 |
#if !defined(__ARC700__) |
| 40 |
#error No ARC 700 |
| 41 |
#endif |
| 42 |
}] |
| 43 |
} |
| 44 |
|
| 45 |
# Return 1 if we compile for ARC6xx |
| 46 |
proc check_effective_target_arc6xx { } { |
| 47 |
return [check_no_compiler_messages arc6xx assembly { |
| 48 |
#if !defined(__ARC600__) && !defined(__ARC601__) |
| 49 |
#error No ARC 6xx |
| 50 |
#endif |
| 51 |
}] |
| 52 |
} |
| 53 |
|
| 54 |
# Return 1 if we have mpy |
| 55 |
proc check_effective_target_arcmpy { } { |
| 56 |
return [check_no_compiler_messages arcmpy assembly { |
| 57 |
#if !defined(__ARC_MPY__) |
| 58 |
#error No MPY |
| 59 |
#endif |
| 60 |
}] |
| 61 |
} |
| 62 |
|
| 63 |
# Return 1 if this is a compiler supporting ARC HS as default processor |
| 64 |
proc check_effective_target_archs { } { |
| 65 |
return [check_no_compiler_messages archs assembly { |
| 66 |
#if !defined(__ARCHS__) |
| 67 |
#error No ARC HS |
| 68 |
#endif |
| 69 |
}] |
| 70 |
} |
| 71 |
|
| 72 |
proc check_cl { flags } { |
| 73 |
return [check_no_compiler_messages check_$flags assembly { |
| 74 |
#if !defined(__arc__) |
| 75 |
#error Extra mcpu options |
| 76 |
#endif |
| 77 |
} "$flags"] |
| 78 |
} |
| 79 |
|
| 80 |
# Return 1 if there are no extra mcpu options given via command line |
| 81 |
proc check_effective_target_clmcpu { } { |
| 82 |
if { [check_cl "-mcpu=arc700"] |
| 83 |
&& [check_cl "-mcpu=arcem" ] } { |
| 84 |
return 1 |
| 85 |
} |
| 86 |
return 0 |
| 87 |
} |
| 88 |
|
| 89 |
proc check_effective_target_barrelshifter { } { |
| 90 |
return [check_no_compiler_messages barrelshifter assembly { |
| 91 |
#if !defined(__ARC_BARREL_SHIFTER__) |
| 92 |
#error No barrel shifter for this confi |
| 93 |
#endif |
| 94 |
}] |
| 95 |
} |
| 96 |
|
| 97 |
#return 1 if we have code density option on. |
| 98 |
proc check_effective_target_codedensity { } { |
| 99 |
return [check_no_compiler_messages codedensity assembly { |
| 100 |
#if !defined(__ARC_CODE_DENSITY__) |
| 101 |
#error No code density option for this config |
| 102 |
#endif |
| 103 |
}] |
| 104 |
} |
| 105 |
|
| 106 |
|
| 107 |
#return 1 if we use ARCv2 Accumulator registers |
| 108 |
proc check_effective_target_accregs { } { |
| 109 |
return [check_no_compiler_messages accregs assembly { |
| 110 |
#if !defined(__ARC_MPY_DMPY__) \ |
| 111 |
&& !defined(__ARC_MPY_MACD__) && !defined(__ARC_MPY_QMACW__) |
| 112 |
#error No accumulator available for this config |
| 113 |
#endif |
| 114 |
}] |
| 115 |
} |
| 116 |
|
| 117 |
proc check_effective_target_dpfp { } { |
| 118 |
return [check_no_compiler_messages dpfp assembly { |
| 119 |
#if !defined(__ARC_FPX_DP__) && !defined(__ARC_FPU_ASSIST__) |
| 120 |
#error No FPX available for this config |
| 121 |
#endif |
| 122 |
}] |
| 123 |
} |
| 124 |
|
| 125 |
# Return 1 if this is a compiler supporting LL64 option. |
| 126 |
proc check_effective_target_ll64 { } { |
| 127 |
return [check_no_compiler_messages ll64 assembly { |
| 128 |
#if !defined(__ARC_LL64__) |
| 129 |
#error No ARC LL64 |
| 130 |
#endif |
| 131 |
}] |
| 132 |
} |
| 133 |
|
| 134 |
# If a testcase doesn't have special options, use these. |
| 135 |
global DEFAULT_CFLAGS |
| 136 |
if ![info exists DEFAULT_CFLAGS] then { |
| 137 |
set DEFAULT_CFLAGS " -ansi -pedantic-errors" |
| 138 |
} |
| 139 |
|
| 140 |
# Initialize `dg'. |
| 141 |
dg-init |
| 142 |
|
| 143 |
# Main loop. |
| 144 |
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{\[cS\],cpp}]] \ |
| 145 |
"" $DEFAULT_CFLAGS |
| 146 |
|
| 147 |
# All done. |
| 148 |
dg-finish |