<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/70143>70143</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`-msse4.2` should produce an error when passed to inappropriate targets
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
sh1boot
</td>
</tr>
</table>
<pre>
Clang seems to accept (with a warning) `-msse4` for any target, not just x86.
No problem, as expected:
clang-18 --target=amd64 -msse2 -c -xc /dev/null
clang-18 --target=amd64 -msse3 -c -xc /dev/null
clang-18 --target=amd64 -msse4 -c -xc /dev/null
clang-18 --target=amd64 -msse4.2 -c -xc /dev/null
Error, as expected:
$ clang-18 --target=arm64 -msse2 -c -xc /dev/null
clang-18: error: unsupported option '-msse2' for target 'arm64'
$ clang-18 --target=arm64 -msse3 -c -xc /dev/null
clang-18: error: unsupported option '-msse3' for target 'arm64'
Warning, this is unexpected behaviour:
$ clang-18 --target=arm64 -msse4 -c -xc /dev/null
clang-18: warning: argument unused during compilation: '-msse4' [-Wunused-command-line-argument]
$ clang-18 --target=arm64 -msse4.2 -c -xc /dev/null
clang-18: warning: argument unused during compilation: '-msse4.2' [-Wunused-command-line-argument]
This breaks feature detection in some cmake files which do not see a failure from clang, meaning sse4.2 appears to be available for the compilation target.
(unexpected behaviour exists for arm64 and riscv64 at least; I haven't tested others)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVU2PpDYQ_TXmUgKBoWk4cOiZSUu55BRpz4VdDd41NvJH9-y_jwzdyUZa7cxkcikQ1Md75ecq9F5Nhmhghyd2eMkwhtm6wc_VaG3IRiu_D88azQSeaPEQLKAQtAZgvLupMAPCDZ1RZmK8B9aW-eI9Nawt4WIdoPkOAd1EgfFnMDbA1-gDvHZtwcoXVp52-4eF1dlR05Lc0AO9riQCSVaffvQDkbDkVQd5fk9bv-Ai2wa2uhxyAfmrAMbPkq6Mn03U-h4L8FZ4_bnw5pPhxa_g7_Y356x7o0cAwHjz82pu-WirWH0C2qrWJ4jGx3W1LpAEuwZlDTB-3PMxftyOfC-Wvm_VGD9-CNd7z-C9uOq3cO32y0PEzxBm5UF5iObRYRhpxquy0f23Xr9XGInK4zbVJ0A3xYVMgGiiJwkyOmUmEHZZlcbEMnk9iCZGwA5P-ZfdPRd2WdDIXCtD-SMXO7x8DPovRfn_gS_4x-Dv9s90VKMj_ObhQhiiI5AUSGwSUAa8XQjEgt8ILkqTh9usxAzSbrPIEwHCBZVOgRdnl51NUsFCmKjAvQe4roRuG4AjAV5RaRw17cqa6Uded6X9a8DdLe9-JiqgV-WD3wfm1no0Epzy4preA2hCH1j9BL_DjFcyjB8DBPKb3MNMzjPe7yUyOdSyr3vMaKjavqu6vm7bbB6oqvuqrVrBqa-obauyqUaSfdnw-tB1faYGXvK6KnnD66ot26LkTddJiTQeLyhRsKakBZUutL4uhXVTpryPNBzLqqkzjSNpv-0Rzg3dYPvJOE9rxQ0pJh_j5FlT6sT2nyxBBU3D36uj4Gl5-NlGLdNWkFEQoNkvO9xmMrCiT5IKFpTBdXV2dQoD3Rvvs-j0MIew-nRd-Znx86TCHMdC2IXxc6p8f-Srs19JBMbPG17P-Hnj81cAAAD__38hNks">