Skip to content

clang-cl --target=arm64-pc-windows-msvc doesn't support __umulh needed by WinSDK 10.0.20348.0 #50472

@StephanTLavavej

Description

@StephanTLavavej
Bugzilla Link 51128
Resolution FIXED
Resolved on Oct 11, 2021 20:29
Version 12.0
OS Windows NT
Blocks #51489
CC @dwblaikie,@mstorsjo,@nico,@rnk,@tstellar
Fixed by commit(s) cc3affd ddc49d0

Extended Description

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzilla

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions