Skip to content

Commit e0e0b44

Browse files
ARM64 arch and feature options
1 parent e448259 commit e0e0b44

File tree

5 files changed

+74
-9
lines changed

5 files changed

+74
-9
lines changed

docs/build/reference/arch-arm64.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
---
22
description: "Learn more about: /arch (ARM64)"
33
title: "/arch (ARM64)"
4-
ms.date: 08/30/2022
4+
ms.date: 05/24/2024
55
---
66
# `/arch` (ARM64)
77

8-
Specifies the architecture for code generation on ARM64. For more information on **`/arch`** for other target architectures, see [`/arch` (x86)](arch-x86.md), [`/arch` (x64)](arch-x64.md), and [`/arch` (ARM)](arch-arm.md).
8+
Specifies the Arm A-Profile architecture extension for code generation on ARM64. For more information on **`/arch`** for other target architectures, see [`/arch` (x86)](arch-x86.md), [`/arch` (x64)](arch-x64.md), and [`/arch` (ARM)](arch-arm.md).
99

1010
## Syntax
1111

12-
> **`/arch:`**\[**`armv8.0`**-**`armv8.8`**]
12+
>**`/arch:<armv8.0|armv8.1|armv8.2|armv8.3|armv8.4|armv8.5|armv8.6|armv8.7|armv8.8|armv8.9>`**[[+feature]](feature-arm64.md)\
13+
>**`/arch:<armv9.0|armv9.1|armv9.2|armv9.3|armv9.4>`**[[+feature]](feature-arm64.md)
1314
1415
## Arguments
1516

16-
**`/arch:armv8.0`** through **`/arch:armv8.8`**\
17-
Optional. Specifies minimum CPU extension requirements for ARMv8.x-A. The default is **`/arch:armv8.0`**.
17+
**`/arch:armv8.x`**\
18+
Specifies the Armv8-A architecture, where **`x`** is a required extension value from **`0`** to **`9`**<sup>1</sup>. By default, the compiler uses the **`/arch:armv8.0`** behavior if no architecture is specified.
19+
20+
**`/arch:armv9.x`**<sup>2</sup>\
21+
Specifies the Armv9-A architecture, where **`x`** is a required extension value from **`0`** to **`4`**. By default, the compiler uses the **`/arch:armv8.0`** behavior if no architecture is specified.
1822

1923
## Remarks
2024

21-
You may specify a CPU extension requirement from Armv8.0-A through Armv8.8-A. However, depending on your version of Visual Studio, the compiler may not yet generate instructions from all feature sets required by the extension level you specify. For example, **`/arch:armv8.1`** allows the `_Interlocked*` intrinsic functions to use the appropriate atomic instruction that was introduced with the ARMv8.1 extension, FEAT_LSE, but compiler support requires Visual Studio 2022 version 17.2 or later.
25+
You may specify an ARM64 extension from Armv8.0-A through Armv8.9-A and Armv9.0-A through Armv9.4-A. Optionally, one or more architecture features can be enabled by appending a feature argument to the option<sup>3</sup>. For example, in order to target Armv8.0-A and enable feature FEAT_LSE, append feature argument **`lse`** so that the option becomes **`/arch:armv8.0+lse`**. For more information about available features and their requirements, see [`/feature` (ARM64)](feature-arm64.md)<sup>3</sup>.
26+
27+
> [!NOTE]
28+
> Depending on your version of Visual Studio, the compiler may not yet generate instructions from all feature sets required by the extension level you specify. For example, **`/arch:armv8.1`** allows the `*Interlocked*` intrinsic functions to use the appropriate atomic instruction that was introduced with the Armv8.1-A extension feature FEAT_LSE, but compiler support requires Visual Studio 2022 version 17.2 or later.
2229
2330
The `_M_ARM64` macro is defined by default when compiling for an ARM64 target. For more information, see [Predefined macros](../../preprocessor/predefined-macros.md).
2431

@@ -30,12 +37,16 @@ When you use [`/clr`](clr-common-language-runtime-compilation.md) to compile, **
3037

3138
1. Select the **Configuration Properties** > **C/C++** > **Command Line** property page.
3239

33-
1. In the **Additional options** box, add *`/arch:armv8.0`* or higher. Choose **OK** to save your changes.
40+
1. In the **Additional options** box, add *`/arch:armv8.0`* or replace `armv8.0` with a different ARM64 extension. Choose **OK** to save your changes.
3441

3542
### To set this compiler option programmatically
3643

3744
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.AdditionalOptions%2A>.
3845

46+
<sup>1</sup> Armv8-A architecture extension `armv8.9` is available starting in Visual Studio 2022 version 17.10.\
47+
<sup>2</sup> Armv9-A architecture extensions are available starting in Visual Studio 2022 version 17.10.\
48+
<sup>3</sup> ARM architecture feature enablement is available starting in Visual Studio 2022 version 17.10.
49+
3950
## See also
4051

4152
[`/arch` (Minimum CPU architecture)](arch-minimum-cpu-architecture.md)\

docs/build/reference/compiler-options-listed-alphabetically.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This table contains an alphabetical list of compiler options. For a list of comp
1616
| [`/?`](help-compiler-command-line-help.md) | Lists the compiler options. |
1717
| [`/AI<dir>`](ai-specify-metadata-directories.md) | Specifies a directory to search to resolve file references passed to the [`#using`](../../preprocessor/hash-using-directive-cpp.md) directive. |
1818
| [`/analyze`](analyze-code-analysis.md) | Enables code analysis. |
19-
| [`/arch:<IA32|SSE|SSE2|AVX|AVX2|AVX512>`](arch-x86.md) | Minimum CPU architecture requirements. IA32, SSE, and SSE2 are x86 only. |
19+
| [`/arch`](arch-minimum-cpu-architecture.md) | Minimum CPU architecture requirements. |
2020
| `/arm64EC` | Generate code compatible with the arm64EC ABI. |
2121
| [`/await`](await-enable-coroutine-support.md) | Enable coroutines (resumable functions) extensions. |
2222
| [`/await:strict`](await-enable-coroutine-support.md) | Enable standard C++20 coroutine support with earlier language versions. |
@@ -65,6 +65,7 @@ This table contains an alphabetical list of compiler options. For a list of comp
6565
| [`/FC`](fc-full-path-of-source-code-file-in-diagnostics.md) | Displays the full path of source code files passed to *cl.exe* in diagnostic text. |
6666
| [`/Fd`](fd-program-database-file-name.md) | Renames program database file. |
6767
| [`/Fe`](fe-name-exe-file.md) | Renames the executable file. |
68+
| [`/feature`](feature-arm64.md) | Enable architecture features.<sup>17.10</sup> |
6869
| [`/FI<file>`](fi-name-forced-include-file.md) | Preprocesses the specified include file. |
6970
| [`/Fi`](fi-preprocess-output-file-name.md) | Specifies the preprocessed output file name. |
7071
| [`/Fm`](fm-name-mapfile.md) | Creates a mapfile. |
@@ -257,6 +258,8 @@ This table contains an alphabetical list of compiler options. For a list of comp
257258
| [`/Zs`](zs-syntax-check-only.md) | Checks syntax only. |
258259
| [`/ZW`](zw-windows-runtime-compilation.md) | Produces an output file to run on the Windows Runtime. |
259260

261+
<sup>17.10</sup> This option is available starting in Visual Studio 2022 version 17.10.
262+
260263
## See also
261264

262265
[MSVC compiler options](compiler-options.md)\

docs/build/reference/compiler-options-listed-by-category.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This article contains a categorical list of compiler options. For an alphabetica
2828

2929
| Option | Purpose |
3030
|--|--|
31-
| [`/arch:<IA32|SSE|SSE2|AVX|AVX2|AVX512>`](arch-x86.md) | Minimum CPU architecture requirements. IA32, SSE, and SSE2 are x86 only. |
31+
| [`/arch`](arch-minimum-cpu-architecture.md) | Minimum CPU architecture requirements. |
3232
| [`/clr`](clr-common-language-runtime-compilation.md) | Produces an output file to run on the common language runtime. |
3333
| [`/clr:implicitKeepAlive-`](clr-common-language-runtime-compilation.md) | Turn off implicit emission of `System::GC::KeepAlive(this)`. |
3434
| [`/clr:initialAppDomain`](clr-common-language-runtime-compilation.md) | Enable initial AppDomain behavior of Visual C++ 2002. |
@@ -42,6 +42,7 @@ This article contains a categorical list of compiler options. For an alphabetica
4242
| [`/EHc`](eh-exception-handling-model.md) | `extern "C"` defaults to `nothrow`. |
4343
| [`/EHr`](eh-exception-handling-model.md) | Always generate `noexcept` runtime termination checks. |
4444
| [`/EHs`](eh-exception-handling-model.md) | Enable C++ exception handling (no SEH exceptions). |
45+
| [`/feature`](feature-arm64.md) | Enable architecture features.<sup>17.10</sup> |
4546
| [`/fp:contract`](fp-specify-floating-point-behavior.md) | Consider floating-point contractions when generating code. |
4647
| [`/fp:except[-]`](fp-specify-floating-point-behavior.md) | Consider floating-point exceptions when generating code. |
4748
| [`/fp:fast`](fp-specify-floating-point-behavior.md) | "fast" floating-point model; results are less predictable. |
@@ -325,6 +326,8 @@ Experimental options may only be supported by certain versions of the compiler.
325326
| [`/Ze`](za-ze-disable-language-extensions.md) | Deprecated. Enables language extensions. |
326327
| [`/Zg`](zg-generate-function-prototypes.md) | Removed in Visual Studio 2015. Generates function prototypes. |
327328

329+
<sup>17.10</sup> This option is available starting in Visual Studio 2022 version 17.10.
330+
328331
## See also
329332

330333
[C/C++ building reference](c-cpp-building-reference.md)\

docs/build/reference/feature-arm64.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
description: "Learn more about: /feature (ARM64)"
3+
title: "/feature (ARM64)"
4+
ms.date: 05/24/2024
5+
---
6+
# `/feature` (ARM64)
7+
8+
Optionally specify one or more Arm A-Profile architecture features to enable for an ARM64 extension specified by **`/arch`** (ARM64). For more information on **`/arch`** (ARM64), see [`/arch` (ARM64)](arch-arm64.md).
9+
10+
## Syntax
11+
12+
> **`/feature:<arg1>`**[**`+arg2`**]
13+
14+
## Arguments
15+
Specify one or more of the following available features to enable if a targeted ARM64 extension supports it.
16+
17+
| Feature argument | Feature identifier | Optional from | Enabled by default | Description |
18+
|--|--|--|--|--|
19+
|**`lse`** | FEAT_LSE | Armv8.0 | Armv8.1 | Large System Extensions. |
20+
|**`rcpc`** | FEAT_LRCPC | Armv8.2 | Armv8.3 | Load-Acquire RCpc instructions. |
21+
22+
## Remarks
23+
24+
Example usage: to enable FEAT_LSE, use feature argument **`lse`** so that the option is **`/feature:lse`**.
25+
26+
If there are conflicting feature arguments specified by **`/feature`**, the right-most feature is enabled. Enabling a feature that is not supported by a targeted architecture may cause unexpected behavior, especially if a CPU does not implement the feature.
27+
28+
You can use either **`/feature`** or only **`/arch`** (ARM64) to specify features. For example, if you want to enable FEAT_LSE when targeting Armv8.0-A, you can either use both **`/feature:lse`** and **`/arch:armv8.0`** or only use **`/arch:armv8.0+lse`**. **`/feature`** exists as another way to specify features without having to specify them in **`/arch`** (ARM64).
29+
30+
### To set the `/feature` compiler option in Visual Studio
31+
32+
1. Open the **Property Pages** dialog box for the project. For more information, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
33+
34+
1. Select the **Configuration Properties** > **C/C++** > **Command Line** property page.
35+
36+
1. In the **Additional options** box, add *`/feature:lse`* or replace `lse` with the feature to enable. Choose **OK** to save your changes.
37+
38+
### To set this compiler option programmatically
39+
40+
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.AdditionalOptions%2A>.
41+
42+
## See also
43+
44+
[`/arch` (Minimum CPU architecture)](arch-minimum-cpu-architecture.md)\
45+
[MSVC compiler options](compiler-options.md)\
46+
[MSVC compiler command-line syntax](compiler-command-line-syntax.md)

docs/build/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,8 @@ items:
560560
href: ../build/reference/favor-optimize-for-architecture-specifics.md
561561
- name: /FC (Full path of source code file in diagnostics)
562562
href: ../build/reference/fc-full-path-of-source-code-file-in-diagnostics.md
563+
- name: /feature (Enable architecture features)
564+
href: ../build/reference/feature-arm64.md
563565
- name: /fp (Specify floating-point behavior)
564566
href: ../build/reference/fp-specify-floating-point-behavior.md
565567
- name: /fpcvt (Floating-point to unsigned integer conversion behavior)

0 commit comments

Comments
 (0)