-
Notifications
You must be signed in to change notification settings - Fork 49
Understanding GCC mcpu option
Please see our documentation site for the latest version of this page.
The GCC option -mcpu= for ARC does not only designate the ARC CPU family (ARC
EM, HS, 600 or 700), but also enables the corresponding set of optional
instructions defined for the selected configuration. Therefore a particular
-mcpu value selects not only a family, but also other -m<something> GCC
options for ARC.
Value of -mcpu= option not only sets various other -m<something> options to
particular values, but also selects a specific standard library build which was
done for this particular core configuration. It is possible to override
selection of hardware extensions by passing individual -m<something> options
to compiler after the -mcpu= option, however standard library build used
for linkage still will be the one matching -mcpu= value. Therefore, for
example, option combination -mcpu=em4 -mno-code-density will generate code
that doesn't use code density instructions, however it will be linked with
standard library that has been built with just -mcpu=em4, which uses code
density instructions - therefore final application still may use code density
instructions. That's why TCF generator, for example, analyzes hardware features
present in the configured processor and selects -mcpu= value that is the best
match for this configuration.
The following table summarize what options are set by each of the possible -mcpu
values for ARC EM.
| -mcpu= | -mcode-density | -mnorm | -mswap | -mbarrel-shifter | -mdiv-rem | -mmpy-option | -mfpu |
|---|---|---|---|---|---|---|---|
| em | none | ||||||
| em4 | Y | none | |||||
| arcem | Y | Y | wlh1 | ||||
| em4_dmips | Y | Y | Y | Y | Y | wlh1 | |
| em4_fpus | Y | Y | Y | Y | Y | wlh1 | fpus |
| em4_fpuda | Y | Y | Y | Y | Y | wlh1 | fpuda |
The above -mcpu values correspond to specific ARC EM Processor templates presented
in the ARChitect tool. It should be noted however that some ARC features are not currently
supported in the GNU toolchain, for example DSP instruction support, reduced register size and
reduced register sets. Relationship between -mcpu values above and ARC EM Processor templates
in ARChitect tool are limited to options listed in the table. Tables will be updated as support
for more options get added to the GNU toolchain.
-
-mcpu=emdoesn't correspond to any specific template, it simply defines the base ARC EM configuration without any optional instructions. -
-mcpu=em4is a base ARC EM core configuration with-mcode-densityoption. It corresponds to the following ARC EM templates in ARChitect: em4_mini, em4_sensor, em4_ecc, em6_mini, em5d_mini, em5d_mini_v3, em5d_nrg, em7d_nrg, em9d_mini. Note, however, that thoseminitemplates has a reduced core register file, which is not supported by the GNU toolchain, so application compiled with such TCF or-mcpu=em4will not run on an nSIM using this TCF - it is requried to addnsim_isa_rgf_num_regs=32to nSIM options. -
-mcpu=arcemdoesn't correspond to any specific template, it is legacy flag preserved for compatibility with older GNU toolchain versions, where-mcpuused to select only a CPU family, while optional features were enabled or disable by individual-m<something>options. -
-mcpu=em4_dmipsis a full-featured ARC EM configuration for integer operations. It corresponds to the following ARC EM templates in ARChitect: em4_dmips, em4_rtos, em6_dmips, em4_dmips_v3, em4_parity, em6_dmips_v3, em6_gp, em5d_voice_audio, em5d_nrg_v3, em7d_nrg_v3, em7d_voice_audio, em9d_nrg, em9d_voice_audio, em11d_nrg and em11d_voice_audio. -
-mcpu=em4_fpusis likeem4_dmipsbut with additional support for single-precision floating point unit. It corresponds to the following ARC EM templates in ARChitect: em4_dmips_fpusp, em4_dmips_fpusp_v3, em5d_nrg_fpusp and em9d_nrg_fpusp. -
-mcpu=em4_fpudais likeem4_fpusbut with additional support for double-precision assist instructions. It corresponds to the following ARC EM templates in ARChitect: em4_dmips_fpuspdp and em4_dmips_fpuspdp_v3.
The following table summarize what options are set by each of the possible -mcpu
values for ARC HS.
| -mcpu= | -mdiv-rem | -matomic | -mll64 | -mmpy-option | -mfpu |
|---|---|---|---|---|---|
| hs | Y | none | |||
| hs34 | Y | mpy | |||
| archs | Y | Y | Y | mpy | |
| hs38 | Y | Y | Y | plus_qmacw | |
| hs38_linux | Y | Y | Y | plus_qmacw | fpud_all |
| hs4x | Y | Y | Y | plus_qmacw | |
| hs4xd | Y | Y | Y | plus_qmacw |
The above -mcpu values correspond to specific ARC HS Processor templates presented
in the ARChitect tool. It should be noted however that some ARC features are not currently
supported in the GNU toolchain, for example reduced register size and
reduced register sets. Relationship between -mcpu values above and ARC HS Processor
templates in ARChitect tool are limited to options listed in the table. Tables will be
updated as support for more options get added to the GNU toolchain.
-
-mcpu=hscorresponds to a basic ARC HS with only atomic instructions enabled. It corresponds to the following ARC HS templates in ARChitect: hs34_base, hs36_base and hs38_base. -
-mcpu=hs34is likehsbut with with additional support for standard hardware multiplier. It corresponds to the following ARC HS templates in ARChitect: hs34, hs36 and hs38. -
-mcpu=archsis a generic CPU, which corresponds to the default configuration in older GNU toolchain versions. -
-mcpu=hs38is a fully featured ARC HS. It corresponds to the following ARC HS templates in ARChitect: hs38_full -
-mcpu=hs38_linuxis a fully featured ARC HS with additional support for double-precision FPU. It corresponds to the following ARC HS templates in ARChitect: hs38_slc_full. -
-mcpu=hs4xis likehs38but employs a different scheduler to take advantage of the delayed multiplier unit, and double integer pipes. -
-mcpu=hs4xdis likehs4xwith a tuned scheduler for this cpu.
The following table summarize what options are set by each of the possible -mcpu
values for ARC 600 and ARC 700.
| -mcpu | -mnorm | -mswap | -mbarrel-shifter | multiplier |
|---|---|---|---|---|
| arc700 | Y | Y | Y | -mmpy |
| arc600 | Y | |||
| arc600_norm | Y | Y | ||
| arc600_mul64 | Y | Y | -mmul64 | |
| arc600_mul32x16 | Y | Y | -mmul32x16 | |
| arc601 | ||||
| arc601_norm | Y | |||
| arc601_mul64 | Y | -mmul64 | ||
| arc601_mul32x16 | Y | -mmul32x16 |