Skip to content

Understanding GCC's Target Specific Options

Yuriy Kolerov edited this page Jun 16, 2023 · 16 revisions

Overview

In addition to the common options, GCC also supports a set of -m<value> target specific options. Each of them configures a particular feature or an extension. For example, -mno-code-density option disables generating code density instructions.

-mcpu=<core> selects a particular ISA and CPU family and enables/disables a set of other -m options. Each -mcpu value leads to linking with a prebuilt library which corresponds to this particular -mcpu=<value> and is built using this -mcpu=<value>.

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 a final application still may use code density instructions.

Table of Target Options

There are several configurations files in GCC's source tree which describe target options for all targets. All of them may be found in gcc/config/arc directory:

Here is a comparison table for all ARCv1 and ARCv2 CPU families.

Options ARC HS ARC EM ARC 700 ARC 600
-mbarrel-shifter Default Yes Default Yes
-mnorm Default Yes Default Yes
-mswap Default Yes Default Yes
-rf16 Yes Yes Yes Yes
-mfpu=<...> Yes Yes
-mmpy-option=<...> Yes Yes
-mcode-density Default Yes
-mdiv-rem Yes Yes
-matomic Default Yes
-mll64 Yes
-mspfp Yes Yes Yes
-mdpfp Yes Yes Yes
-msimd Yes Yes
-mmargonaut Yes Yes
-mea Yes
-mmul64 Yes
-mmul32x16 Yes

Floating Point Options for ARCv2

Here is a table which matches -mfpu= values to corresponding features for ARC EM and ARC HS as they defined in Architect.

-mfpu= Families -has_fpu -fpu_dp_option -fpu_div_option -fpu_fma_option -fpu_dp_assist
fpus EM, HS On
fpus_div EM, HS On On
fpus_fma EM, HS On On
fpus_all EM, HS On On On
fpud HS On On
fpud_div HS On On On
fpud_fma HS On On On
fpud_all HS On On On On
fpuda EM On On
fpuda_div EM On On On
fpuda_fma EM On On On
fpuda_all EM On On On On

Multiplication Options for ARCv2

Here is a table which matches -mmpy= values to corresponding features for ARC EM and ARC HS as they defined in Architect.

-mcpu= Aliases Architect option for ARC HS Architect option for ARC EM
0 none -mpy_option=none -mpy_option=none
1 w
2 wlh1, mpy -mpy_option=mpy -mpy_option=wlh1
3 wlh2 -mpy_option=wlh2
4 wlh3 -mpy_option=wlh3
5 wlh4 -mpy_option=wlh4
6 wlh5 -mpy_option=wlh5
7 plus_dmpy -mpy_option=plus_dmpy
8 plus_macd -mpy_option=plus_macd
9 plus_qmacw -mpy_option=plus_qmacw

Values of -mcpu for ARC HS3x and HS4x Families

-mcpu= -mdiv-rem -matomic -mll64 -mmpy-option= -mfpu=
hs Y
hs34 Y mpy
archs Y Y Y mpy
hs38 Y Y Y plus_qmacw
hs4x Y Y Y plus_qmacw
hs4xd Y Y Y plus_qmacw
hs38_linux Y Y Y plus_qmacw fpud_all

Values of -mcpu for ARC HS5x and ARC HS6x Families

-mcpu= -msimd -m128 -mll64
hs5x Y N/A
hs58 Y N/A Y
hs6x Y N/A
hs68 Y Y N/A

Values of -mcpu for ARC EM Family

-mcpu -mcode-density -mnorm -mswap -mbarrel-shifter -mdiv-rem -mmpy-option= -mfpu= -mrf16
em
em_mini Y
em4 Y
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
quarkse_em Y Y Y Y Y wlh2 quark

Values of -mcpu for ARC 600 and 700 Families

-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