Skip to content

Commit 7ba157c

Browse files
authored
Merge pull request #5679 from MicrosoftDocs/main
10/16/2024 AM Publish
2 parents 8611b42 + 350fe61 commit 7ba157c

18 files changed

+135
-62
lines changed

docs/build/reference/arch-x64.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,27 @@ Specifies the architecture for code generation on x64. For more information on *
1010

1111
## Syntax
1212

13-
> **`/arch:`**\[**`AVX`**|**`AVX2`**|**`AVX512`**]
13+
> **`/arch:`**\[**`SSE2`**|**`SSE4.2`**|**`AVX`**|**`AVX2`**|**`AVX512`**|**`AVX10.1`**]
1414
1515
## Arguments
1616

17+
**`/arch:SSE2`**\
18+
Enables Intel Streaming SIMD Extensions 2. The default instruction set is SSE2 if no **`/arch`** option is specified.
19+
20+
**`/arch:SSE4.2`**\
21+
Enables Intel Streaming SIMD Extensions 4.2.
22+
1723
**`/arch:AVX`**\
18-
Enables the use of Intel Advanced Vector Extensions instructions.
24+
Enables Intel Advanced Vector Extensions.
1925

2026
**`/arch:AVX2`**\
21-
Enables the use of Intel Advanced Vector Extensions 2 instructions.
27+
Enables Intel Advanced Vector Extensions 2.
2228

2329
**`/arch:AVX512`**\
24-
Enables the use of Intel Advanced Vector Extensions 512 instructions.
30+
Enables Intel Advanced Vector Extensions 512.
31+
32+
**`/arch:AVX10.1`**\
33+
Enables Intel Advanced Vector Extensions 10 version 1.
2534

2635
## Remarks
2736

@@ -33,23 +42,33 @@ The processor extensions have the following characteristics:
3342

3443
- The default mode uses SSE2 instructions for scalar floating-point and vector calculations. These instructions allow calculation with 128-bit vectors of single-precision, double-precision and 1, 2, 4 or 8-byte integer values, as well as single-precision and double-precision scalar floating-point values.
3544

45+
- **`SSE4.2`** uses the full set of SSE instructions for floating-point scalar, vector, and integer vector calculations.
46+
3647
- **`AVX`** introduced an alternative instruction encoding for vector and floating-point scalar instructions. It allows vectors of either 128 bits or 256 bits, and zero-extends all vector results to the full vector size. (For legacy compatibility, SSE-style vector instructions preserve all bits beyond bit 127.) Most floating-point operations are extended to 256 bits.
3748

3849
- **`AVX2`** extends most integer operations to 256-bit vectors and enables use of Fused Multiply-Add (FMA) instructions.
3950

40-
- **`AVX-512`** introduced another instruction encoding form that allows 512-bit vectors, plus certain other optional features. Instructions for other operations were also added.
51+
- **`AVX-512`** introduced another instruction encoding form that allows 512-bit vectors, masking, embedded rounding/broadcast, and new instructions. The default vector length for **`AVX-512`** is 512 bits and can be changed to 256 bits using the [`/vlen`](vlen.md) flag.
52+
53+
- **`AVX10.1`** adds more instructions on top of **`AVX-512`**. The default vector length for **`AVX10.1`** is 256 bits and can be changed to 512 bits using the [`/vlen`](vlen.md) flag.
4154

4255
Each **`/arch`** option may also enable the use of other non-vector instructions that are associated with that option. An example is the use of certain BMI instructions when **`/arch:AVX2`** is specified.
4356

44-
The `__AVX__` preprocessor symbol is defined when the **`/arch:AVX`**, **`/arch:AVX2`** or **`/arch:AVX512`** compiler option is specified. The `__AVX2__` preprocessor symbol is defined when the **`/arch:AVX2`** or **`/arch:AVX512`** compiler option is specified. The `__AVX512F__`, `__AVX512CD__`, `__AVX512BW__`, `__AVX512DQ__` and `__AVX512VL__` preprocessor symbols are defined when the **`/arch:AVX512`** compiler option is specified. For more information, see [Predefined macros](../../preprocessor/predefined-macros.md). The **`/arch:AVX2`** option was introduced in Visual Studio 2013 Update 2, version 12.0.34567.1. Limited support for **`/arch:AVX512`** was added in Visual Studio 2017, and expanded in Visual Studio 2019.
57+
The `__AVX__` preprocessor symbol is defined when the **`/arch:AVX`**, **`/arch:AVX2`**, **`/arch:AVX512`**, or **`/arch:AVX10.1`** compiler option is specified.
58+
The `__AVX2__` preprocessor symbol is defined when the **`/arch:AVX2`**, **`/arch:AVX512`**, or **`/arch:AVX10.1`** compiler option is specified.
59+
The `__AVX512F__`, `__AVX512CD__`, `__AVX512BW__`, `__AVX512DQ__`, and `__AVX512VL__` preprocessor symbols are defined when the **`/arch:AVX512`**, or **`/arch:AVX10.1`** compiler option is specified.
60+
The `__AVX10_VER__` preprocessor symbol is defined when the **`/arch:AVX10.1`** compiler option is specified. It indicates the AVX10 version the compiler is targeting. For more information, see [Predefined macros](../../preprocessor/predefined-macros.md).
61+
The **`/arch:AVX2`** option was introduced in Visual Studio 2013 Update 2, version 12.0.34567.1.
62+
Limited support for **`/arch:AVX512`** was added in Visual Studio 2017, and expanded in Visual Studio 2019.
63+
Support for **`/arch:AVX10.1`** was added in Visual Studio 2022.
4564

46-
### To set the `/arch:AVX`, `/arch:AVX2` or `/arch:AVX512` compiler option in Visual Studio
65+
### To set the `/arch` compiler option in Visual Studio
4766

4867
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).
4968

5069
1. Select the **Configuration Properties** > **C/C++** > **Code Generation** property page.
5170

52-
1. In the **Enable Enhanced Instruction Set** drop-down box, choose **Advanced Vector Extensions (/arch:AVX)**, **Advanced Vector Extensions 2 (/arch:AVX2)** or **Advanced Vector Extensions 512 (/arch:AVX512)**.
71+
1. Modify the **Enable Enhanced Instruction Set** property.
5372

5473
### To set this compiler option programmatically
5574

docs/build/reference/arch-x86.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,30 @@ Specifies the architecture for code generation on x86. For more information on *
99

1010
## Syntax
1111

12-
> **`/arch:`**\[**`IA32`**|**`SSE`**|**`SSE2`**|**`AVX`**|**`AVX2`**|**`AVX512`**]
12+
> **`/arch:`**\[**`IA32`**|**`SSE`**|**`SSE2`**|**`AVX`**|**`AVX2`**|**`AVX512`**|**`AVX10.1`**]
1313
1414
## Arguments
1515

1616
**`/arch:IA32`**\
1717
Specifies no enhanced instructions and also specifies x87 for floating-point calculations.
1818

1919
**`/arch:SSE`**\
20-
Enables the use of SSE instructions.
20+
Enables Intel Streaming SIMD Extensions.
2121

2222
**`/arch:SSE2`**\
23-
Enables the use of SSE2 instructions. This option is the default instruction set on x86 platforms if no **`/arch`** option is specified.
23+
Enables Intel Streaming SIMD Extensions 2. The default instruction set is SSE2 if no **`/arch`** option is specified.
2424

2525
**`/arch:AVX`**\
26-
Enables the use of Intel Advanced Vector Extensions instructions.
26+
Enables Intel Advanced Vector Extensions.
2727

2828
**`/arch:AVX2`**\
29-
Enables the use of Intel Advanced Vector Extensions 2 instructions.
29+
Enables Intel Advanced Vector Extensions 2.
3030

3131
**`/arch:AVX512`**\
32-
Enables the use of Intel Advanced Vector Extensions 512 instructions.
32+
Enables Intel Advanced Vector Extensions 512.
33+
34+
**`/arch:AVX10.1`**\
35+
Enables Intel Advanced Vector Extensions 10 version 1.
3336

3437
## Remarks
3538

@@ -49,9 +52,11 @@ The **`/arch`** options refer to instruction set extensions with the following c
4952

5053
- **`AVX2`** extends most integer operations to 256-bit vectors, and enables use of Fused Multiply-Add (FMA) instructions.
5154

52-
- **`AVX512`** introduced another instruction encoding form that allows 512-bit vectors, plus certain other optional features. Instructions for other operations were also added.
55+
- **`AVX512`** introduced another instruction encoding form that allows 512-bit vectors, masking, embedded rounding/broadcast, and new instructions. The default vector length for **`AVX512`** is 512 bits and can be changed to 256 bits using the [`/vlen`](vlen.md) flag.
56+
57+
- **`AVX10.1`** adds more instructions on top of **`AVX-512`**. The default vector length for **`AVX10.1`** is 256 bits and can be changed to 512 bits using the [`/vlen`](vlen.md) flag.
5358

54-
The optimizer chooses when and how to use vector instructions depending on which **`/arch`** is specified. Scalar floating-point computations are performed with SSE or AVX instructions when available. Some calling conventions specify passing floating-point arguments on the x87 stack, and as a result, your code may use a mixture of both x87 and SSE/AVX instructions for floating-point computations. Integer vector instructions can also be used for some 64-bit integer operations when available.
59+
The optimizer chooses when and how to use vector instructions depending on which **`/arch`** is specified. Scalar floating-point computations are usually performed with SSE or AVX instructions when available. Some calling conventions specify passing floating-point arguments on the x87 stack, and as a result, your code may use a mixture of both x87 and SSE/AVX instructions for floating-point computations. Integer vector instructions can also be used for some 64-bit integer operations when available.
5560

5661
In addition to the vector and floating-point scalar instructions, each **`/arch`** option may also enable the use of other non-vector instructions that are associated with that option. An example is the CMOVcc instruction family that first appeared on the Intel Pentium Pro processors. Because SSE instructions were introduced with the subsequent Intel Pentium III processor, CMOVcc instructions may be generated except when **`/arch:IA32`** is specified.
5762

@@ -69,7 +74,7 @@ r = t + d; // This should produce the same overall result
6974
// whether x87 stack is used or SSE/SSE2 is used.
7075
```
7176

72-
**`/arch`** and [`/QIfist`](qifist-suppress-ftol.md) can't be used on the same compiland. The **`/QIfist`** option changes the rounding behavior of floating-point to integer conversion. The default behavior is to truncate (round toward zero), whereas the **`/QIfist`** option specifies use of the floating-point environment rounding mode. Because the option changes the behavior of all floating-point to integer conversions, **`/QIfist`** has been deprecated. When compiling for SSE or AVX, you can round a floating-point value to an integer using the floating-point environment rounding mode by using an intrinsic function sequence:
77+
**`/arch`** and [`/QIfist`](qifist-suppress-ftol.md) can't be used together. The **`/QIfist`** option changes the rounding behavior of floating-point to integer conversion. The default behavior is to truncate (round toward zero), whereas the **`/QIfist`** option specifies use of the [floating-point environment](fp-specify-floating-point-behavior.md) rounding mode. Because the option changes the behavior of all floating-point to integer conversions, **`/QIfist`** is deprecated. When compiling for SSE or AVX, you can round a floating-point value to an integer using the floating-point environment rounding mode by using an intrinsic function sequence:
7378

7479
```cpp
7580
int convert_float_to_int(float x) {
@@ -81,9 +86,9 @@ int convert_double_to_int(double x) {
8186
}
8287
```
8388
84-
The `_M_IX86_FP`, `__AVX__`, `__AVX2__`, `__AVX512F__`, `__AVX512CD__`, `__AVX512BW__`, `__AVX512DQ__` and `__AVX512VL__` macros indicate which, if any, **`/arch`** compiler option was used. For more information, see [Predefined macros](../../preprocessor/predefined-macros.md). The **`/arch:AVX2`** option and `__AVX2__` macro were introduced in Visual Studio 2013 Update 2, version 12.0.34567.1. Limited support for **`/arch:AVX512`** was added in Visual Studio 2017, and expanded in Visual Studio 2019.
89+
The `_M_IX86_FP`, `__AVX__`, `__AVX2__`, `__AVX512F__`, `__AVX512CD__`, `__AVX512BW__`, `__AVX512DQ__`, `__AVX512VL__`, and `__AVX10_VER__` macros indicate which, if any, **`/arch`** compiler option was used. For more information, see [Predefined macros](../../preprocessor/predefined-macros.md). The **`/arch:AVX2`** option, and `__AVX2__` macro were introduced in Visual Studio 2013 Update 2, version 12.0.34567.1. Limited support for **`/arch:AVX512`** was added in Visual Studio 2017, and expanded in Visual Studio 2019. Support for **`/arch:AVX10.1`** was added in Visual Studio 2022.
8590
86-
### To set this compiler option for AVX, AVX2, AVX512, IA32, SSE, or SSE2 in Visual Studio
91+
### To set the `/arch` compiler option in Visual Studio
8792
8893
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).
8994

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ This table contains an alphabetical list of compiler options. For a list of comp
190190
| [`/V`](v-version-number.md) | Deprecated. Sets the version string. |
191191
| [`/validate-charset`](validate-charset-validate-for-compatible-characters.md) | Validate UTF-8 files for only compatible characters. |
192192
| [`/vd{0|1|2}`](vd-disable-construction-displacements.md) | Suppresses or enables hidden `vtordisp` class members. |
193+
| [`/vlen`](vlen.md) | Specifies vector length. |
193194
| [`/vmb`](vmb-vmg-representation-method.md) | Uses best base for pointers to members. |
194195
| [`/vmg`](vmb-vmg-representation-method.md) | Uses full generality for pointers to members. |
195196
| [`/vmm`](vmm-vms-vmv-general-purpose-representation.md) | Declares multiple inheritance. |

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ This article contains a categorical list of compiler options. For an alphabetica
9292
| [`/RTCc`](rtc-run-time-error-checks.md) | Convert to smaller type checks at run-time. |
9393
| [`/RTCs`](rtc-run-time-error-checks.md) | Enable stack frame runtime checks. |
9494
| [`/RTCu`](rtc-run-time-error-checks.md) | Enables uninitialized local usage checks. |
95+
| [`/vlen`](vlen.md) | Specifies vector length. |
9596
| [`/volatile:iso`](volatile-volatile-keyword-interpretation.md) | Acquire/release semantics not guaranteed on volatile accesses. |
9697
| [`/volatile:ms`](volatile-volatile-keyword-interpretation.md) | Acquire/release semantics guaranteed on volatile accesses. |
9798

docs/build/reference/vlen.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
description: "Learn more about: /vlen"
3+
title: "/vlen"
4+
ms.date: 09/24/2024
5+
f1_keywords: ["/vlen", "-vlen"]
6+
helpviewer_keywords: ["specify vector length", "-vlen compiler option [C++]", "vlen compiler option [C++]", "/vlen compiler option [C++]"]
7+
---
8+
# `/vlen`
9+
10+
Specifies the vector length for code generation on x86 and x64. For more information about **`/arch`** for x86 and x64, see [`/arch` (x86)](arch-x86.md) and [`/arch` (x64)](arch-x64.md).
11+
12+
## Syntax
13+
14+
> **`/vlen=`**\[**`256`**|**`512`**]
15+
16+
> **`/vlen`**
17+
18+
## Arguments
19+
20+
**`/vlen=256`**\
21+
Specify a vector length of 256 bits for auto-vectorization and other optimizations.
22+
23+
**`/vlen=512`**\
24+
Specify a vector length of 512 bits for auto-vectorization and other optimizations.
25+
26+
**`/vlen`**\
27+
Specify the default vector length for the selected **`/arch`** setting.
28+
29+
## Remarks
30+
31+
If a specific **`/vlen`** value isn't specified, the default vector length depends on the **`/arch`** flag setting. The **`/vlen`** flag can override the default vector length specified by **`/arch:AVX512`** or **`/arch:AVX10.1`** flag. For example:
32+
33+
- **`/arch:AVX512 /vlen=256`** overrides the default vector length of 512 bits specified by **`/arch:AVX512`** to be 256 bits.
34+
- **`/arch:AVX10.1 /vlen=512`** overrides the default vector length of 256 bits specified by **`/arch:AVX10.1`** to be 512 bits.
35+
36+
When the specified **`/vlen`** value is incompatible with specified **`/arch`** flag, a warning is generated and default vector length for the **`/arch`** setting is used. For example:
37+
38+
- **`/arch:AVX2 /vlen=512`** generates a warning because AVX2 doesn't support 512-bit vectors. Vector length of 256 bits is used in this case.
39+
40+
### To set the `/vlen=256` or `/vlen=512` compiler option in Visual Studio
41+
42+
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).
43+
44+
1. Select the **Configuration Properties** > **C/C++** > **Command Line** property page.
45+
46+
1. In the **Additional options** box, add *`/vlen=256`* or *`/vlen=512`*. Choose **OK** to save your changes.
47+
48+
## See also
49+
50+
[`/arch` (Minimum CPU Architecture)](arch-minimum-cpu-architecture.md)\
51+
[MSVC compiler options](compiler-options.md)\
52+
[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
@@ -740,6 +740,8 @@ items:
740740
href: ../build/reference/validate-charset-validate-for-compatible-characters.md
741741
- name: /vd (Disable construction displacements)
742742
href: ../build/reference/vd-disable-construction-displacements.md
743+
- name: /vlen (Specify vector length)
744+
href: ../build/reference/vlen.md
743745
- name: /vmb, /vmg (Representation method)
744746
href: ../build/reference/vmb-vmg-representation-method.md
745747
- name: /vmm, /vms, /vmv (General purpose representation)

docs/cpp/exception-specifications-throw-cpp.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
---
2-
description: "Learn more about: Exception specifications (throw, noexcept) (C++)"
32
title: "Exception specifications (throw, noexcept) (C++)"
3+
description: "Learn more about: Exception specifications (throw, noexcept) (C++)"
44
ms.date: "01/18/2018"
55
helpviewer_keywords: ["exceptions [C++], exception specifications", "throwing exceptions [C++], throw keyword", "C++ exception handling [C++], throwing exceptions", "throw keyword [C++]", "noexcept keyword [C++]"]
6-
ms.assetid: 4d3276df-6f31-4c7f-8cab-b9d2d003a629
76
---
87
# Exception specifications (throw, noexcept) (C++)
98

@@ -25,7 +24,7 @@ The following table summarizes the Microsoft C++ implementation of exception spe
2524

2625
|Exception specification|Meaning|
2726
|-----------------------------|-------------|
28-
|**`noexcept`**<br/>`noexcept(true)`<br/>`throw()`|The function does not throw an exception. In **`/std:c++14`** mode (which is the default), **`noexcept`** and `noexcept(true)` are equivalent. When an exception is thrown from a function that is declared **`noexcept`** or `noexcept(true)`, [`std::terminate`](../standard-library/exception-functions.md#terminate) is invoked. When an exception is thrown from a function declared as `throw()` in **`/std:c++14`** mode, the result is undefined behavior. No specific function is invoked. This is a divergence from the C++14 standard, which required the compiler to invoke [`std::unexpected`](../standard-library/exception-functions.md#unexpected). <br/> **Visual Studio 2017 version 15.5 and later**: In **`/std:c++17`** mode , **`noexcept`**, `noexcept(true)`, and `throw()` are all equivalent. In **`/std:c++17`** mode, `throw()` is an alias for `noexcept(true)`. In **`/std:c++17`** mode and later, when an exception is thrown from a function declared with any of these specifications, [`std::terminate`](../standard-library/exception-functions.md#terminate) is invoked as required by the C++17 standard.|
27+
|**`noexcept`**<br/>`noexcept(true)`<br/>`throw()`|The function does not throw an exception. In **`/std:c++14`** mode (which is the default), **`noexcept`** and `noexcept(true)` are equivalent. When an exception is thrown from a function that is declared **`noexcept`** or `noexcept(true)`, [`std::terminate`](../standard-library/exception-functions.md#terminate) is invoked. When an exception is thrown from a function declared as `throw()` in **`/std:c++14`** mode, the result is undefined behavior. No specific function is invoked. This is a divergence from the C++14 standard, which required the compiler to invoke [`std::unexpected`](../standard-library/exception-functions.md#unexpected). <br/> **Visual Studio 2017 version 15.5 and later**: In **`/std:c++17`** mode, **`noexcept`**, `noexcept(true)`, and `throw()` are all equivalent. In **`/std:c++17`** mode, `throw()` is an alias for `noexcept(true)`. In **`/std:c++17`** mode and later, when an exception is thrown from a function declared with any of these specifications, [`std::terminate`](../standard-library/exception-functions.md#terminate) is invoked as required by the C++17 standard.|
2928
|`noexcept(false)`<br/>`throw(...)`<br/>No specification|The function can throw an exception of any type.|
3029
|`throw(type)`| (**C++14 and earlier**) The function can throw an exception of type `type`. The compiler accepts the syntax, but interprets it as `noexcept(false)`. In **`/std:c++17`** mode and later, the compiler issues warning C5040.|
3130

0 commit comments

Comments
 (0)