<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - clang-cl --target=arm64-pc-windows-msvc doesn't support __umulh needed by WinSDK 10.0.20348.0"
   href="https://bugs.llvm.org/show_bug.cgi?id=51128">51128</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang-cl --target=arm64-pc-windows-msvc doesn't support __umulh needed by WinSDK 10.0.20348.0
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>12.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sfinae@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Here's how I reproed this (there may be a simpler way). Install VS 2022 17.0
Preview 2. After choosing the "Desktop development with C++" workload,
customize it:

* Select the "C++ Clang tools for Windows" (containing Clang 12)
* Select the "MSVC v142 - VS 2019 C++ ARM64 build tools (Latest)" (slightly
misnamed; this is the VS 2022 compiler)
* Unselect the default WinSDK 10.0.19041.0
* Select the latest "Windows 10 SDK (10.0.20348.0)"

This setup (Clang 12 + latest WinSDK) works for x86, x64, and ARM (32-bit) in
the microsoft/STL test suite; however, we encountered an incompatibility on
ARM64 due to the new WinSDK attempting to use the __umulh intrinsic, which
works for MSVC but not Clang 12. Self-contained test case, starting from a
clean command prompt:

C:\Temp>"C:\Program Files\Microsoft Visual
Studio\2022\Preview\VC\Auxiliary\Build\vcvarsall.bat" x64_arm64
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.0.0-pre.2.0
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64_arm64'

C:\Temp>type meow.cpp
#include <Windows.h>

C:\Temp>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.30.30401 for ARM64
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]

C:\Temp>cl /EHsc /nologo /W4 /c meow.cpp
meow.cpp

C:\Temp>clang-cl --target=arm64-pc-windows-msvc --version
clang version 12.0.0
Target: arm64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\Microsoft Visual
Studio\2022\Preview\VC\Tools\Llvm\x64\bin

C:\Temp>clang-cl --target=arm64-pc-windows-msvc /EHsc /nologo /W4 /c meow.cpp
In file included from meow.cpp:1:
In file included from C:\Program Files (x86)\Windows
Kits\10\\include\10.0.20348.0\\um\Windows.h:171:
In file included from C:\Program Files (x86)\Windows
Kits\10\\include\10.0.20348.0\\shared\windef.h:24:
In file included from C:\Program Files (x86)\Windows
Kits\10\\include\10.0.20348.0\\shared\minwindef.h:182:
C:\Program Files (x86)\Windows
Kits\10\\include\10.0.20348.0\\um\winnt.h(6370,20): error: use of undeclared
identifier
      '__umulh'
    *HighProduct = UnsignedMultiplyHigh(Multiplier, Multiplicand);
                   ^
C:\Program Files (x86)\Windows
Kits\10\\include\10.0.20348.0\\um\winnt.h(6236,30): note: expanded from macro
      'UnsignedMultiplyHigh'
#define UnsignedMultiplyHigh __umulh
                             ^
1 error generated.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>