<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63492>63492</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang-cl cannot compile Windows source files when SIMD intrinsics are used
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          noloader
      </td>
    </tr>
</table>

<pre>
    We've been getting bug reports from users about problems with clang-cl on Windows. It appears clang-cl cannot compile source files that msvc can compile. clang-cl defines `MSC_VER`, so we expect clang-cl to act accordingly.

The following is our reproducer.

In a GitBash terminal:

```
$ git clone https://github.com/weidai11/cryptopp
Cloning into 'cryptopp'...
remote: Enumerating objects: 28709, done.
remote: Counting objects: 100% (109/109), done.
remote: Compressing objects: 100% (62/62), done.
remote: Total 28709 (delta 51), reused 103 (delta 47), pack-reused 28600
Receiving objects: 100% (28709/28709), 27.20 MiB | 13.70 MiB/s, done.
Resolving deltas: 100% (20963/20963), done.
```

Apply the following patch:

```
$ git diff
diff --git a/config_os.h b/config_os.h
index 107e4452..c2c617ca 100644
--- a/config_os.h
+++ b/config_os.h
@@ -31,7 +31,7 @@
 // discussed at http://github.com/weidai11/cryptopp/issues/147.
 #if (defined(_MSC_VER) && defined(__clang__) && \
    !(defined( __clang_analyzer__)) && !defined(__INTEL_LLVM_COMPILER))
-# error: "Unsupported configuration"
+// # error: "Unsupported configuration"^M
 #endif

 // Windows platform
```
In a Visual Studio Developer Prompt:

- Open Visual Studio 2022 Tools Command Prompt for targeting x64
- cd to cryptopp sources
- Run `nmake /f cryptest.nmake CXX=clang-cl.exe`

The results are:

```
c:\Users\...\cryptopp>nmake /f cryptest.nmake CXX=clang-cl.exe

Microsoft (R) Program Maintenance Utility Version 14.36.32535.0
Copyright (C) Microsoft Corporation.  All rights reserved.


******************************
Platform is x64
******************************

        clang-cl.exe  /nologo /W4 /wd4231 /wd4511 /wd4156 /D_MBCS /Zi /TP /GR /EHsc /DNDEBUG /D_NDEBUG /Oi /Oy /O2 /MT /FI sdkddkver.h /FI winapifamily.h /Yc"pch.h" /Fp"pch.pch" /c pch.cpp
        clang-cl.exe  /nologo /W4 /wd4231 /wd4511 /wd4156 /D_MBCS /Zi /TP /GR /EHsc /DNDEBUG /D_NDEBUG /Oi /Oy /O2 /MT /FI sdkddkver.h /FI winapifamily.h /c cryptlib.cpp
        clang-cl.exe  /nologo /W4 /wd4231 /wd4511 /wd4156 /D_MBCS /Zi /TP /GR /EHsc /DNDEBUG /D_NDEBUG /Oi /Oy /O2 /MT /FI sdkddkver.h /FI winapifamily.h /c cpu.cpp
        clang-cl.exe /nologo /W4 /wd4231 /wd4511 /wd4156 /D_MBCS /Zi /TP /GR /EHsc /DNDEBUG /D_NDEBUG /Oi /Oy /O2 /MT /FI sdkddkver.h /FI winapifamily.h /c integer.cpp
        clang-cl.exe  /nologo /W4 /wd4231 /wd4511 /wd4156 /D_MBCS /Zi /TP /GR /EHsc /DNDEBUG /D_NDEBUG /Oi /Oy /O2 /MT /FI sdkddkver.h /FI winapifamily.h /c 3way.cpp
        clang-cl.exe  /nologo /W4 /wd4231 /wd4511 /wd4156 /D_MBCS /Zi /TP /GR /EHsc /DNDEBUG /D_NDEBUG /Oi /Oy /O2 /MT /FI sdkddkver.h /FI winapifamily.h /c adler32.cpp
        clang-cl.exe /nologo /W4 /wd4231 /wd4511 /wd4156 /D_MBCS /Zi /TP /GR /EHsc /DNDEBUG /D_NDEBUG /Oi /Oy /O2 /MT /FI sdkddkver.h /FI winapifamily.h /c algebra.cpp
        clang-cl.exe  /nologo /W4 /wd4231 /wd4511 /wd4156 /D_MBCS /Zi /TP /GR /EHsc /DNDEBUG /D_NDEBUG /Oi /Oy /O2 /MT /FI sdkddkver.h /FI winapifamily.h /c algparam.cpp
        clang-cl.exe  /nologo /W4 /wd4231 /wd4511 /wd4156 /D_MBCS /Zi /TP /GR /EHsc /DNDEBUG /D_NDEBUG /Oi /Oy /O2 /MT /FI sdkddkver.h /FI winapifamily.h /c allocate.cpp
 clang-cl.exe  /nologo /W4 /wd4231 /wd4511 /wd4156 /D_MBCS /Zi /TP /GR /EHsc /DNDEBUG /D_NDEBUG /Oi /Oy /O2 /MT /FI sdkddkver.h /FI winapifamily.h /c arc4.cpp
        clang-cl.exe  /nologo /W4 /wd4231 /wd4511 /wd4156 /D_MBCS /Zi /TP /GR /EHsc /DNDEBUG /D_NDEBUG /Oi /Oy /O2 /MT /FI sdkddkver.h /FI winapifamily.h /c aria.cpp
        clang-cl.exe  /nologo /W4 /wd4231 /wd4511 /wd4156 /D_MBCS /Zi /TP /GR /EHsc /DNDEBUG /D_NDEBUG /Oi /Oy /O2 /MT /FI sdkddkver.h /FI winapifamily.h /c aria_simd.cpp
aria_simd.cpp(181,6): error: always_inline function '_mm_shuffle_epi8' requires target feature 'ssse3', but would be
      inlined into function 'ARIA_ProcessAndXorBlock_SSSE3' that is compiled without support for 'ssse3'
 _mm_shuffle_epi8(_mm_load_si128(CONST_M128_CAST(rk)), MASK)))
 ^
aria_simd.cpp(188,5): error: always_inline function '_mm_shuffle_epi8' requires target feature 'ssse3', but would be
 inlined into function 'ARIA_ProcessAndXorBlock_SSSE3' that is compiled without support for 'ssse3'
 _mm_shuffle_epi8(_mm_load_si128(CONST_M128_CAST(rk)), MASK)));
 ^
2 errors generated.
NMAKE : fatal error U1077: 'clang-cl.exe  /nologo /W4 /wd4231 /wd4511 /wd4156 /D_MBCS /Zi /TP /GR /EHsc /DNDEBUG /D_NDEBUG /Oi /Oy /O2 /MT /FI sdkddkver.h /FI winapifamily.h /c aria_simd.cpp' : return code '0x1'
Stop.
```

If we used `/K` namke option, then we get hundreds of errors as the entire library is built.

The MSVC compiler does not need architecture specific switches and option to enable an ISA. If the compiler supports an ISA, then it is available to use. Microsoft got this right; and GCC and LLVM got this wrong. Microsoft's strategy avoids problems like https://lists.llvm.org/pipermail/llvm-dev/2018-December/128159.html .

Please behave like MSVC if you are going to define `_MSC_VER`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWVFz2zgO_jXMCyYaiZIs-yEPjhL3Mhu3mThNe_fioSlI5oYidSRl1_frb0jZseNue7sPOzeNR0NLJAAC4AdQhJi1olGIVyS_JvnNBevdWpsrpaVmFZqLla52V1-Q0GKDsEJU0KBzQjWw6hsw2GnjLNRGt9BbNBbYSvcOOqNXElsLW-HWwCVTzSWXoBV8EarSWxvBnQPWdciMPY5zppR2wHXbCYlgdW84Qi0kWnBr5qC1G-6pDiTRkbfCWii0QEbxfFEun28fySgmtASrYYuA3zrk7kjuNDDugHGuTSVUI3cRiW9IPB3apzVCraXUW2-rsKB74801uuo5mje0dwoYfBDumtk1ODStUEySdHpK43UZruGRZtAIr45WCGvnOusZ6IzQWSPcul9FXLeEzrYoKiaShNAZN7vO6a4bJJRSq6CachoILV5HaRFFe_UMttohSadwq_oWDQsLp1e_I3d-PqDjIp54H1Va4XdMpe7VOUcSx4TmQOg48Zyz0P5MRNsZtPaHUkaU0JlvfizjSTsmB1U9R4XSMciTPYvB3mIFSZweB7NiP9gx_nK5p6DjUbz3_iNyFJsf6rT3ymz_HyTRIqIxzMU1kKKEJI2K8ETozJ4p_ohWyyA8KHMuO56MUi97-D-3-hwmoZ12ndyBe4PIjjm-_nMYq0RdDz3-Di4vfSfzgNKqFs1S22gNq7fPA71QFX6DJC4wy3IaRZzyUVJw5u0ZZdlAdHl5eS7tMP_1cP2xcJLFJIvhMk0ILQsg9PpwFwYGIhhCAipheW_9MjIXwuXPRwudCWt7tB6sWRG9yk1FPSDGp42K0PHykDaox9mI0BGcDC5D5lguT0ZJXu6lAQChyRtpcOBgisndf9AE1lNumpyKv_v4dHu_vL9_ni_LT_OHu_ugiL8GLxOaAhqjjccTofSzsn3nsy9WMPi29_GtFaH0xP_Be3-JN7-dH32EqhL1KcYOC7JP49BJ5mpt2j9EYEiMz8L2TMLC9ZXQ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