> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Xbox コンパイラ テクノロジ

> XBOX コンパイラ テクノロジ

XBOX 用のコンパイラは、Visual Studio に付属している Visual C++ x64 コンパイラです。Visual Studio 2022 (17.12 または 17.14) か、最新の Visual Studio 2026 更新プログラムを使用してください。

XBOX 開発では、clang/LLVM for Windows v11 以降もサポートされています。このツールセットは Visual C/C++ ランタイムを使用します。MSBuild を使用する場合は、Visual Studio 2019 または Visual Studio 2022 の clang/LLVM 統合を使用してください。

その他のツールセットとランタイムの組み合わせでは、実行できないか、認定に合格しない可能性があります。

Visual C++ コードのアップグレードの詳細については、「[Visual C++ 移植およびアップグレード ガイド](https://learn.microsoft.com/cpp/porting/visual-cpp-porting-and-upgrading-guide)」を参照してください。

> [!NOTE]
>
> XBOX ツールは、デバッグ シンボルとして Microsoft Program Database (PDB) ファイルでのみ動作します。LLVM の `.ld` ファイルが出力する CodeView または DWARF のデバッグ情報はサポートされていません。

## C++14、C++17、C++20 の言語バージョンと機能

Visual Studio 2019、Visual Studio 2022、Visual Studio 2026 は C++11、C++14、C++17 をサポートしています。Visual Studio 2022 と Visual Studio 2026 は C++20 もサポートしています。

| コンパイラのバージョン | バージョン マクロ | リリース | 注記 |
| - | - | - | - |
| 19.20 | \_MSC\_VER == 1920 | Visual Studio 2019 (バージョン 16.0) | [Visual Studio 2019 における C++17/20 の機能と修正](https://devblogs.microsoft.com/cppblog/cpp17-20-features-and-fixes-in-vs-2019/) |
| 19.21 | \_MSC\_VER == 1921 | Visual Studio 2019 (バージョン 16.1) | |
| 19.22 | \_MSC\_VER == 1922 | Visual Studio 2019 (バージョン 16.2) | |
| 19.23 | \_MSC\_VER == 1923 | Visual Studio 2019 (バージョン 16.3) | |
| 19.24 | \_MSC\_VER == 1924 | Visual Studio 2019 (バージョン 16.4) | |
| 19.25 | \_MSC\_VER == 1925 | Visual Studio 2019 (バージョン 16.5) | [C++20 モジュール](https://devblogs.microsoft.com/cppblog/c-modules-conformance-improvements-with-msvc-in-visual-studio-2019-16-5/) |
| 19.26 | \_MSC\_VER == 1926 | Visual Studio 2019 (バージョン 16.6) | [VS 2019 16.1 から 16.6 における C++20 の機能と修正](https://devblogs.microsoft.com/cppblog/c20-features-and-fixes-in-vs-2019-16-1-through-16-6/) |
| 19.27 | \_MSC\_VER == 1927 | Visual Studio 2019 (バージョン 16.7) | [STL の機能と修正](https://github.com/microsoft/STL/wiki/VS-2019-Changelog#vs-2019-167) |
| 19.28 | \_MSC\_VER == 1928 | Visual Studio 2019 (バージョン 16.8) | [C++20 モジュール](https://devblogs.microsoft.com/cppblog/standard-c20-modules-support-with-msvc-in-visual-studio-2019-version-16-8/)  [C++20 コルーチン](https://devblogs.microsoft.com/cppblog/c-coroutines-in-visual-studio-2019-version-16-8/)  [C++20 の言語機能](https://devblogs.microsoft.com/cppblog/c20-features-in-visual-studio-2019-versions-16-7-and-16-8/)  [STL の機能と修正](https://github.com/microsoft/STL/wiki/VS-2019-Changelog#vs-2019-168) |
| 19.28.29910 以降 | | Visual Studio 2019 (バージョン 16.9) | [STL の機能と修正](https://github.com/microsoft/STL/wiki/VS-2019-Changelog#vs-2019-169) |
| 19.29 | \_MSC\_VER = 1929 | Visual Studio 2019 (バージョン 16.10) | [C++20 Ranges](https://devblogs.microsoft.com/cppblog/c20-ranges-are-complete-in-visual-studio-2019-version-16-10/)  [\<format>](https://devblogs.microsoft.com/cppblog/format-in-visual-studio-2019-version-16-10/)  [\<chrono> の拡張](https://devblogs.microsoft.com/cppblog/cpp20s-extensions-to-chrono-available-in-visual-studio-2019-version-16-10/)  [STL の機能と修正](https://github.com/microsoft/STL/wiki/VS-2019-Changelog#vs-2019-1610) |
| 19.29.30133.0 以降 | | Visual Studio 2019 (バージョン 16.11) | [C++20 コルーチン](https://devblogs.microsoft.com/cppblog/cpp20-coroutine-improvements-in-visual-studio-2019-version-16-11/)  [STL の変更に関する注記](https://github.com/microsoft/STL/wiki/VS-2019-Changelog#vs-2019-161114)  [/std:c++20 スイッチ](https://devblogs.microsoft.com/cppblog/msvc-cpp20-and-the-std-cpp20-switch/) |
| 19.30 | \_MSC\_VER == 1930 | Visual Studio 2022 (17.0) | [STL の機能と修正](https://github.com/microsoft/STL/wiki/VS-2022-Changelog#vs-2022-170) |
| 19.31 | \_MSC\_VER == 1931 | Visual Studio 2022 (17.1) | [STL の機能と修正](https://github.com/microsoft/STL/wiki/VS-2022-Changelog#vs-2022-171) |
| 19.32 | \_MSC\_VER == 1932 | Visual Studio 2022 (17.2) | [MSVC の STL が /std:c++20 を完全実装](https://devblogs.microsoft.com/cppblog/msvcs-stl-completes-stdc20/)  [STL の機能と修正](https://github.com/microsoft/STL/wiki/VS-2022-Changelog#vs-2022-172) |
| 19.33 | \_MSC\_VER = 1933 | Visual Studio 2022 (17.3) | [STL の機能と修正](https://github.com/microsoft/STL/wiki/VS-2022-Changelog#vs-2022-173) |
| 19.34 | \_MSC\_VER = 1934 | Visual Studio 2022 (17.4) | [STL の機能と修正](https://github.com/microsoft/STL/wiki/VS-2022-Changelog#vs-2022-174) |
| 19.35 | \_MSC\_VER = 1935 | Visual Studio 2022 (17.5) | [STL の機能と修正](https://github.com/microsoft/STL/wiki/VS-2022-Changelog#vs-2022-175) |
| 19.36 | \_MSC\_VER = 1936 | Visual Studio 2022 (17.6) | [vcpkg](https://devblogs.microsoft.com/cppblog/visual-studio-17-6-for-cpp-devs/)  [STL の機能と修正](https://github.com/microsoft/STL/wiki/VS-2022-Changelog#vs-2022-176) |
| 19.37 | \_MSC\_VER = 1937 | Visual Studio 2022 (17.7) | [STL の機能と修正](https://github.com/microsoft/STL/wiki/VS-2022-Changelog#vs-2022-177) |
| 19.38 | \_MSC\_VER = 1938 | Visual Studio 2022 (17.8) | [STL の機能と修正](https://github.com/microsoft/STL/wiki/VS-2022-Changelog#vs-2022-178) |
| 19.39 | \_MSC\_VER = 1939 | Visual Studio 2022 (17.9) | [MSVC バックエンドの更新](https://devblogs.microsoft.com/cppblog/msvc-backend-updates-since-visual-studio-2022-version-17-3/)  [STL の機能と修正](https://github.com/microsoft/STL/wiki/VS-2022-Changelog#vs-2022-179) |
| 19.40 | \_MSC\_VER = 1940 | Visual Studio 2022 (17.10) | [MSVC ツールセットのマイナー バージョン](https://devblogs.microsoft.com/cppblog/msvc-toolset-minor-version-number-14-40-in-vs-2022-v17-10/)  [STL の機能と修正](https://github.com/microsoft/STL/wiki/Changelog#vs-2022-1710) |
| 19.41 | \_MSC\_VER = 1941 | Visual Studio 2022 (17.11) | [診断の変更](https://devblogs.microsoft.com/cppblog/whats-new-for-cpp-developers-in-visual-studio-2022-17-11/)  [STL の機能と修正](https://github.com/microsoft/STL/wiki/Changelog#vs-2022-1711) |
| 19.42 | \_MSC\_VER = 1942 | Visual Studio 2022 (17.12) | [STL の機能と修正](https://github.com/microsoft/STL/wiki/Changelog#vs-2022-1712) |
| 19.43 | \_MSC\_VER = 1943 | Visual Studio 2022 (17.13) | [C++ 言語の更新](https://devblogs.microsoft.com/cppblog/msvc-compiler-updates-in-visual-studio-2022-version-17-13/)  [STL の機能と修正](https://github.com/microsoft/STL/wiki/Changelog#vs-2022-1713) |
| 19.44 | \_MSC\_VER = 1944 | Visual Studio 2022 (17.14) | [C++ 言語の更新](https://devblogs.microsoft.com/cppblog/c-language-updates-in-msvc-in-visual-studio-2022-17-14/)  [STL の機能と修正](https://github.com/microsoft/STL/wiki/Changelog#vs-2022-1714) |
| 19.50 | \_MSC\_VER = 1950 | Visual Studio 2026 | [C++ 言語の更新](https://devblogs.microsoft.com/cppblog/c-language-updates-in-msvc-build-tools-v14-50/)  [STL の機能と修正](https://github.com/microsoft/STL/wiki/Changelog#msvc-build-tools-1450) |

## 組み込み関数

Visual C++ コンパイラは x64 インライン アセンブリをサポートしていませんが、XBOX 開発で特殊な命令セットを利用できるよう、さまざまな組み込み関数をサポートしています。

> [!NOTE]
>
> 組み込み関数を使用する場合は、ターゲット プラットフォームがその命令をサポートしていることを事前に確認していることが前提となります。サポートを確認しない場合、アプリは実行時に `invalid instruction` 例外をスローします。特に、XBOX One (AMD Jaguar CPU) は AVX と F16C をサポートし、XBOX Series X|S (AMD Hercules CPU) はさらに AVX2 と FMA3 もサポートしている点に注意してください。どちらのプラットフォームも AVX-512 以降の命令はサポートしていません。

| ヘッダー | 説明 |
| - | - |
| intrin.h | 一般的な組み込み関数。特に `__cpuid` や、CRT ルーチンのさまざまな組み込み関数形式。ammintrin.h と immintrin.h をインクルードします。 |
| ammintrin.h | AMD 命令セット: SSE5、FMA4、XOP の組み込み関数。   *FMA4 と XOP は、XBOX One (AMD Jaguar CPU) と XBOX Series X\|S (AMD Hercules CPU) ではサポートされていません*。 |
| immintrin.h | Intel 命令セット: [AVX](https://en.wikipedia.org/wiki/Advanced_Vector_Extensions)、AVX2、[BMI、BMI2](https://en.wikipedia.org/wiki/Bit_manipulation_instruction_set)、[FMA3](https://en.wikipedia.org/wiki/FMA_instruction_set)、[F16C/CVT16](https://en.wikipedia.org/wiki/F16C) の組み込み関数。   *AVX2、BMI2、FMA3 は XBOX Series X\|S (AMD Hercules CPU) ではサポートされていますが、XBOX One (AMD Jaguar CPU) ではサポートされていません*。 |
| xmmintrin.h | [SSE](https://en.wikipedia.org/wiki/Streaming_SIMD_Extensions) 組み込み関数と `__m128` 型 (単精度浮動小数点 SIMD)。 |
| emmintrin.h | [SSE2](https://en.wikipedia.org/wiki/SSE2) 組み込み関数と `__m128i` / `__m128d` 型 (倍精度浮動小数点および整数 SIMD)。 |
| pmmintrin.h | [SSE3](https://en.wikipedia.org/wiki/SSE3) 組み込み関数 (float/double の水平加算および減算演算、特定の "dup" 演算)。 |
| tmmintrin.h | [SSSE3](https://en.wikipedia.org/wiki/SSSE3) 組み込み関数 (SSE2 を補完する追加の水平演算、整数の abs、"byte" シャッフル)。 |
| smmintrin.h | [SSE4.1](https://en.wikipedia.org/wiki/SSE4) 組み込み関数 (内積、丸め、SSE2 向けの拡張 min/max サポート)。 |
| nmmintrin.h | SSE4.2 組み込み関数。 |
| wmmintrin.h | AES 組み込み関数。 |
| zmmintrin.h | AVX-512 組み込み関数。   *AVX-512 組み込み関数は、XBOX One (AMD Jaguar CPU) と XBOX Series X\|S (AMD Hercules CPU) ではサポートされていません*。 |
| mmintrin.h | Intel MMX 組み込み関数 (`__m64` 型を含む)。x64 ネイティブ アプリケーションではサポートされていません。 |
| mm3dnow\.h | AMD 3DNow! 組み込み関数。x64 ネイティブ アプリケーションではサポートされていません。*`_mm_prefetch` / `_m_prefetchw` は x64 ネイティブでサポートされており、intrin.h でも定義されています。* |

> [!NOTE]
>
> Visual Studio は **/arch:AVX** および **/arch:AVX2** スイッチをサポートしています。これらのスイッチにより、AVX 命令セット標準の一部である [VEX プレフィックス](https://en.wikipedia.org/wiki/VEX_prefix)を使用できるようになります。すべての XBOX アプリケーションでこのスイッチを使用してください。詳細については、次の記事を参照してください。

* [Microsoft Docs: x64 組み込み関数](https://learn.microsoft.com/cpp/intrinsics/x64-amd64-intrinsics-list)

* [Intel: AVX](https://go.microsoft.com/fwlink/p/?LinkId=251202)

* [Games for Windows and the DirectX SDK ブログ: DirectXMath シリーズ](https://walbourn.github.io/directxmath-sse-sse2-and-arm-neon/)

### clang/LLVM の組み込み関数

clang/LLVM for Windows ツールセットは MSVC と同じ組み込み関数の多くを実装していますが、いくつかの重要な違いがあります。

* clang/LLVM と GNUC は、SSE SIMD 型を Visual C++ や Intel Compiler とは異なる方法で扱います。具体的には、`__m128`、`__m128i`、`__m128d` 型は構造体ではなく不透明型であるため、これらの型を使用する C++ のオーバーロード関数を作成することはできません。この違いにより、`__m128.m128_f32[0]` による要素への直接アクセスも clang/LLVM ではコンパイルされません。

> このため、DirectXMath は clang/LLVM を使用してビルドする場合に `_XM_NO_XMVECTOR_OVERLOADS_` を定義します。移植性を高めるために、コード内でこのマクロを明示的に定義して、MSVC でも同様に適用することができます。

* clang/LLVM の *cpuid* 組み込み関数は、特別なヘッダー `#include <cpuid.h>` を使用します。`__cpuid` 組み込み関数は異なるパラメーター リストを受け取り、`__cpuid_count` は MSVC の `__cpuidex` に相当しますが、こちらもパラメーター リストが異なります。

```
#if (defined(__clang__) || defined(__GNUC__)) && (__x86_64__ || __i386__)
#include <cpuid.h>
#else
#include <intrin.h>
#endif
```

```
int CPUInfo[4] = { -1 };
#if defined(__clang__) || defined(__GNUC__)
__cpuid(0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
#else
__cpuid(CPUInfo, 0);
#endif
```

```
#if defined(__clang__) || defined(__GNUC__)
__cpuid_count(7, 0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
#else
__cpuidex(CPUInfo, 7, 0);
#endif
```

## 呼び出し規約

x64 ネイティブ コードの既定の呼び出し規約は `__fastcall` です。詳細は [Microsoft Docs](https://learn.microsoft.com/cpp/build/x64-calling-convention) に記載されています。x64 では、`__cdecl` および `__stdcall` 呼び出し規約は `__fastcall` の単なるエイリアスです。

MSVC および clang/LLVM コンパイラは、x86 および x64 コード向けに `__vectorcall` 呼び出し規約をサポートしています。詳細については、
[Visual C++ Team Blog: Introducing 'Vector Calling Convention'](https://devblogs.microsoft.com/cppblog/introducing-vector-calling-convention/) および [Microsoft Docs](https://learn.microsoft.com/cpp/cpp/vectorcall) を参照してください。

## 自動ベクター化と自動並列化

Visual C++ オプティマイザーは、自動ベクター化機能によって、スカラーの整数演算や浮動小数点演算を SIMD 命令に変換できます。自動ベクター化は `/O2` または `/Ox` で自動的に有効になります。`#pragma loop(no_vector)` を使用すると、特定のループに対して無効にできます。

これらのコンパイラ ツールセットは、スレッドを使用したループの自動並列化もサポートしています。自動並列化は `/Qpar` を使用して有効にします。`#pragma (loop(hint_parallel(n)))` を使用すると、特定のループに対してヒントを指定できます。詳細については、次の記事を参照してください。

* [自動並列化と自動ベクター化](https://learn.microsoft.com/cpp/parallel/auto-parallelization-and-auto-vectorization)

## バグの報告

**Visual C++ コンパイラ**のバグは、(可能であれば) Visual Studio の *\[問題の報告...]* から報告してください。[Microsoft Docs](https://learn.microsoft.com/visualstudio/ide/how-to-report-a-problem-with-visual-studio) および [Developer Community](https://aka.ms/feedback/report?space=62) Web サイトを参照してください。コンパイラ向けの適切なバグ レポートの作成方法の詳細については、[このページ](https://aka.ms/compilerbug)を参照してください。

> [!NOTE]
>
> 問題を再現するために NDA 対象の追加情報が必要な場合は、"Microsoft only" とマークしたコメントを公開レポートに追加できます。

**clang/LLVM for Windows コンパイラ**のバグ報告には、[https://bugs.llvm.org/](https://bugs.llvm.org/) を使用してください。

**Microsoft Standard C++ Library** (STL とも呼ばれます) のバグ報告には、[https://github.com/microsoft/STL/issues](https://github.com/microsoft/STL/issues) を使用してください。

いつものように、エスカレーションが必要な重大な問題については、お気軽に*アカウント マネージャー*にお問い合わせください。

## リソース

* [AMD 開発者ガイドとマニュアル](https://developer.amd.com/resources/developer-guides-manuals/)

* [Intel 64 および IA-32 アーキテクチャ ソフトウェア開発者マニュアル](https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html)

* [Visual Studio の Visual C++ の新機能](https://learn.microsoft.com/cpp/what-s-new-for-visual-cpp-in-visual-studio)


## Related topics

- [コンソール開発向け Visual Studio](/ja-jp/tools/tools-console/visualstudio/visualstudio.md)
- [XBOX GDK 向け HLSL シェーダー コンパイラ (DXC)](/ja-jp/tools/tools-console/shadercompiler/index.md)
- [Visual C++ コンパイラのリソース](/ja-jp/tools/tools-console/visualstudio/compiler-resources.md)
- [Visual C++ コンパイラとリンカーのスイッチに関する推奨事項](/ja-jp/tools/tools-console/visualstudio/compiler-switch-recommendations.md)
- [ゲーム ランチャーとハンドヘルド](/ja-jp/build/gdk-and-engines/handheld/handheld-launchers.md)
