Skip to content

Understanding GCC mcpu option

Anton Kolesov edited this page Mar 23, 2016 · 10 revisions

GCC option -mcpu= represents not just a ARC CPU family (like ARC EM or ARC HS), but a particular CPU implementation with a defined set of optional instructions. Therefore particular -mcpu value selects not only a family, but also other -m GCC options.

ARC EM

Following tables 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

Those -mcpu values correspond to specific ARC EM templates that can be found in IPlibrary distribution. Note, however that GNU toolchain doesn't support some ARC features, like reduced register size or reduced register sets, therefore relationship between -mcpu values and IPlibrary templates are limited - they are compatible as far as GNU toolchain supports features of those IPlibrary templates.

  • -mcpu=em doesn't match any template - it is simply the most basic possible ARC EM, without any optional instructions.
  • -mcpu=em4 is a basic ARC EM core with only -mcode-density. It corresponds to those templates: em4_mini, em4_sensor, em4_ecc, em6_mini, em5d_mini, em5d_mini_v3, em5d_nrg, em7d_nrg, em9d_mini.
  • -mcpu=arcem doesn't target any particular - it is flag preserved for compatibility with old GNU toolchain versions, where -mcpu used to select only a CPU family, while optional features were enabled or disable by individual -m options.
  • -mcpu=em4_dmips is a full-features template, as far as integer operations are considered. It corresponds to those IPlibrary templates: 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_fpus is like em4_dmips but with single-precision floating point unit. Templates: em4_dmips_fpusp, em4_dmips_fpusp_v3, em5d_nrg_fpusp and em9d_nrg_fpusp.
  • -mcpu=em4_fpuda is like em4_fpus but wuth double-precision assist instructions. Templates: em4_dmips_fpuspdp and em4_dmips_fpuspdp_v3.

ARC HS

Following tables 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

Those -mcpu values correspond to specific ARC HS templates that can be found in IPlibrary distribution. Note, however that GNU toolchain doesn't support some ARC features, like reduced register size or reduced register sets, therefore relationship between -mcpu values and IPlibrary templates are limited - they are compatible as far as GNU toolchain supports features of those IPlibrary templates.

  • -mcpu=hs corresponds to a basic ARC HS with only atomic instructions enabled. It corresponds to templates hs34_base, hs36_base and hs38_base.
  • -mcpu=hs34 is like hs but with a standard hardware multiplier. Templates: hs34, hs36 and hs38.
  • -mcpu=archs is a generic CPU, which corresponds to the default configuration in old GCC.
  • -mcpu=hs38 is a fully featured ARC HS, corresponding to hs38_full template.
  • -mcpu=hs38_linux is a fully featured ARC HS with double-precision FPU. It corresponds to template hs38_slf_full.

ARC 600 and ARC 700

Following tables 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

Clone this wiki locally