|
1 | 1 | ---
|
2 | 2 | description: "Learn more about: /arch (ARM64)"
|
3 | 3 | title: "/arch (ARM64)"
|
4 |
| -ms.date: 08/30/2022 |
| 4 | +ms.date: 05/24/2024 |
5 | 5 | ---
|
6 | 6 | # `/arch` (ARM64)
|
7 | 7 |
|
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 about **`/arch`** for other target architectures, see [`/arch` (x86)](arch-x86.md), [`/arch` (x64)](arch-x64.md), and [`/arch` (ARM)](arch-arm.md). |
9 | 9 |
|
10 | 10 | ## Syntax
|
11 | 11 |
|
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) |
13 | 14 |
|
14 | 15 | ## Arguments
|
15 | 16 |
|
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. |
18 | 22 |
|
19 | 23 | ## Remarks
|
20 | 24 |
|
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, enable one or more architecture features by appending a feature argument to the option<sup>3</sup>. For example, 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 introduced with the Armv8.1-A extension feature `FEAT_LSE`, but compiler support requires Visual Studio 2022 version 17.2 or later. |
22 | 29 |
|
23 | 30 | The `_M_ARM64` macro is defined by default when compiling for an ARM64 target. For more information, see [Predefined macros](../../preprocessor/predefined-macros.md).
|
24 | 31 |
|
25 |
| -When you use [`/clr`](clr-common-language-runtime-compilation.md) to compile, **`/arch`** has no effect on code generation for managed functions. **`/arch`** only affects code generation for native functions. |
| 32 | +**`/arch`** only affects code generation for native functions. When you use [`/clr`](clr-common-language-runtime-compilation.md) to compile, **`/arch`** has no effect on code generation for managed functions. |
26 | 33 |
|
27 | 34 | ### To set the `/arch` compiler option in Visual Studio
|
28 | 35 |
|
29 | 36 | 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).
|
30 | 37 |
|
31 | 38 | 1. Select the **Configuration Properties** > **C/C++** > **Command Line** property page.
|
32 | 39 |
|
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. |
34 | 41 |
|
35 | 42 | ### To set this compiler option programmatically
|
36 | 43 |
|
37 | 44 | - See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.AdditionalOptions%2A>.
|
38 | 45 |
|
| 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> Architecture feature enablement is available starting in Visual Studio 2022 version 17.10. |
| 49 | + |
39 | 50 | ## See also
|
40 | 51 |
|
41 | 52 | [`/arch` (Minimum CPU architecture)](arch-minimum-cpu-architecture.md)\
|
|
0 commit comments