The --with-cpu will allow riscv compilers to have a default mcpu flag.
Setting -mcpu or -march at compile time will override the configured
--with-cpu.
gcc/ChangeLog:
* config.gcc: Add cpu to supported configure options
* config/riscv/riscv.h (riscv_arch_help): Use --with-cpu during
compilation
* doc/install.texi: Mention in docs that --with-cpu is supported
;;
riscv*-*-*)
- supported_defaults="abi arch tune riscv_attribute isa_spec tls cmodel"
+ supported_defaults="abi arch cpu tune riscv_attribute isa_spec tls cmodel"
case "${target}" in
riscv-* | riscv32*) xlen=32 ;;
{ "riscv_arch_help", riscv_arch_help },
/* Support for a compile-time default CPU, et cetera. The rules are:
- --with-arch is ignored if -march or -mcpu is specified.
+ --with-arch and --with-cpu are ignored if -march or -mcpu is specified.
--with-abi is ignored if -mabi is specified.
--with-tune is ignored if -mtune or -mcpu is specified.
--with-isa-spec is ignored if -misa-spec is specified.
--with-tls is ignored if -mtls-dialect is specified.
- But using default -march/-mtune value if -mcpu don't have valid option. */
+ Uses default values if -mcpu doesn't have a valid option. */
#define OPTION_DEFAULT_SPECS \
{"tune", "%{!mtune=*:" \
" %{!mcpu=*:-mtune=%(VALUE)}" \
" %{mcpu=*:-mtune=%:riscv_default_mtune(%* %(VALUE))}}" }, \
+ {"cpu", "%{!march=*:%{!mcpu=*:%:riscv_expand_arch_from_cpu(%(VALUE))}}" }, \
{"arch", "%{!march=*|march=unset:" \
" %{!mcpu=*:-march=%(VALUE)}" \
" %{mcpu=*:%:riscv_expand_arch_from_cpu(%* %(VALUE))}}" }, \
Specify which cpu variant the compiler should generate code for by default.
@var{cpu} will be used as the default value of the @option{-mcpu=} switch.
This option is only supported on some targets, including ARC, ARM, i386, M68k,
-PowerPC, and SPARC@. It is mandatory for ARC@. The @option{--with-cpu-32} and
-@option{--with-cpu-64} options specify separate default CPUs for
-32-bit and 64-bit modes; these options are only supported for aarch64, i386,
-x86-64, PowerPC, and SPARC@.
+PowerPC, RISC-V, and SPARC@. It is mandatory for ARC@. The
+@option{--with-cpu-32} and @option{--with-cpu-64} options specify separate
+default CPUs for 32-bit and 64-bit modes; these options are only supported for
+aarch64, i386, x86-64, PowerPC, and SPARC@.
@item --with-schedule=@var{cpu}
@itemx --with-arch=@var{cpu}