{"id":30628,"date":"2022-06-07T16:00:37","date_gmt":"2022-06-07T16:00:37","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cppblog\/?p=30628"},"modified":"2024-09-10T07:55:49","modified_gmt":"2024-09-10T07:55:49","slug":"msvc-backend-updates-in-visual-studio-2022-version-17-2","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/msvc-backend-updates-in-visual-studio-2022-version-17-2\/","title":{"rendered":"MSVC Backend Updates in Visual Studio 2022 version 17.2"},"content":{"rendered":"<p>In <a href=\"https:\/\/visualstudio.microsoft.com\/vs\/\">Visual Studio 2022<\/a> version 17.2 we have continued to improve the C++ backend with new features, new and improved optimizations, build throughput improvements, and better security. Here is a list of improvements for you to review.<\/p>\n<ul>\n<li>OpenMP: The <code>task<\/code> directive as defined by OpenMP 3.1 is supported for <code>-openmp:llvm<\/code>, including all the clauses. Note that the compiler does not yet support `task` clauses added in later versions of OpenMP. See more details in <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/openmp-task-support-for-c-in-visual-studio\/\">OpenMP Task Support for C++ in Visual Studio<\/a>.<\/li>\n<li>Implemented Intel intrinsic functions for the AVX512-FP16 instruction set extension. More information about these functions can be found on the <a href=\"https:\/\/www.intel.com\/content\/www\/us\/en\/docs\/intrinsics-guide\/index.html#avx512techs=AVX512_FP16\">Intel Intrinsics Guide<\/a>.<\/li>\n<li>Implemented Intel intrinsic functions <code>_castf32_u32<\/code>, <code>_castf64_u64<\/code>, <code>_castu32_f32<\/code>, and <code>_castu64_f64<\/code>\u00a0to cast between floating point values and integer values without conversion on x64 and x86. More information about these functions can be found on the <a href=\"https:\/\/www.intel.com\/content\/www\/us\/en\/docs\/intrinsics-guide\/index.html#text=_cast&amp;techs=Other\">Intel Intrinsics Guide<\/a>.<\/li>\n<li>New ARM64 compiler flags: <code>\/Zc:arm64-aliased-neon-types-<\/code> and <code>\/Zc:arm64-aliased-neon-types<\/code>. When you pass <code>\/Zc:arm64-aliased-neon-types-<\/code> to <code>cl.exe<\/code>, the compiler will treat NEON intrinsic types as distinct types for ARM64 as defined by the <a href=\"https:\/\/github.com\/ARM-software\/abi-aa\/blob\/main\/aapcs64\/aapcs64.rst#appendix-support-for-advanced-simd-extensions\">Procedure Call Standard for the Arm 64-bit Architecture<\/a>, which is consistent with Clang and GCC. This flag is opt-in, so ARM64 NEON intrinsic code that compiled with previous versions of MSVC will still compile when you upgrade. <code>\/Zc:arm64-aliased-neon-types<\/code>\u00a0(without the minus sign at the end) is the default behavior.\n<ul>\n<li>For example, consider two function declarations, <code>void foo(float32x4_t)<\/code> and <code>void foo(int32x4_t)<\/code>. By default, MSVC considers these two the same declaration, and attempting to define them both would lead to a multiple definition error. With <code>\/Zc:arm64-aliased-neon-types-<\/code>, MSVC will treat them as Clang and GCC would.<\/li>\n<\/ul>\n<\/li>\n<li>New ARM64 compiler flags: <code>\/arch:armv8.0<\/code> and <code>\/arch:armv8.1<\/code>. These new flags allow the compiler to generate instructions that were introduced and required by the specified architecture extension. `\/arch:armv8.0` is the current default behavior and is the same as if you didn\u2019t specify it. In 17.2, <code>\/arch:armv8.1<\/code> allows the <code>_Interlocked*<\/code> intrinsic functions to use the appropriate atomic instruction that was introduced with the ARMv8.1 extension, FEAT_LSE.<\/li>\n<li>New and improved optimizations\n<ul>\n<li>The <a href=\"https:\/\/en.cppreference.com\/w\/c\/numeric\/math\/log2\">C standard library functions <code>log2<\/code> and <code>log2f<\/code><\/a> have been implemented as compiler intrinsic functions on x64 and ARM64. This allows the compiler to perform optimizations with <code>log2<\/code> and <code>log2f<\/code> under <code>\/fp:fast<\/code>\u00a0x64 and ARM64.<\/li>\n<li>Improved auto-vectorizer loop recognition. The auto-vectorizer now recognizes the average pattern and more cases of decrementing induction variables.<\/li>\n<li>More <a href=\"https:\/\/en.wikipedia.org\/wiki\/Peephole_optimization\">peephole optimizations<\/a> for multiple targets.<\/li>\n<li>Improved load\/store pairing on ARM64.<\/li>\n<\/ul>\n<\/li>\n<li>ARM64EC\n<ul>\n<li>Compiler flags incompatible with the <code>\/arm64EC<\/code> flag are now rejected. This includes all CLR flags, <code>\/Gy-<\/code>, and <code>\/Gw-<\/code>.<\/li>\n<li>Added the <code>\/MACHINE:ARM64EC<\/code> flag to <code>link.exe<\/code>, and removed it from <code>lib.exe<\/code>. For <code>lib.exe<\/code>, you should specify <code>\/MACHINE:ARM64X<\/code>.<\/li>\n<li>When <code>\/arm64EC<\/code> is passed to <code>cl.exe<\/code> and <code>cl.exe<\/code> also invokes <code>link.exe<\/code>, <code>\/MACHINE:ARM64EC<\/code> will be passed by default to <code>link.exe<\/code>.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Do you want to experience the new improvements of the C++ backend? Please <a href=\"https:\/\/visualstudio.microsoft.com\/vs\/\">download the latest Visual Studio 2022<\/a> and give it a try! Any feedback is welcome. We can be reached via the comments below, <a href=\"https:\/\/developercommunity.visualstudio.com\/search?space=62\">Developer Community<\/a>, and Twitter (<a href=\"https:\/\/twitter.com\/visualc\">@VisualC<\/a>)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Visual Studio 2022 version 17.2 we have continued to improve the C++ backend with new features, new and improved optimizations, build throughput improvements, and better security. Here is a list of improvements for you to review. OpenMP: The task directive as defined by OpenMP 3.1 is supported for -openmp:llvm, including all the clauses. Note [&hellip;]<\/p>\n","protected":false},"author":60165,"featured_media":35994,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3946,1],"tags":[],"class_list":["post-30628","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-backend","category-cplusplus"],"acf":[],"blog_post_summary":"<p>In Visual Studio 2022 version 17.2 we have continued to improve the C++ backend with new features, new and improved optimizations, build throughput improvements, and better security. Here is a list of improvements for you to review. OpenMP: The task directive as defined by OpenMP 3.1 is supported for -openmp:llvm, including all the clauses. Note [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/30628","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/60165"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=30628"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/30628\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/35994"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=30628"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=30628"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=30628"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}