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

    <tr>
        <th>Summary</th>
        <td>
            [clang] target attributes with `arch=` doesn't work if `-march` is set
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

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

<pre>
    This compiles compiles without any flags, but fails with `-march=x86-64-v2`.

```c
__attribute__((__always_inline__, target("sse"))) void g() {}
__attribute__((target("arch=x86-64,sse"))) void f() { g(); }
```

This compiles compiles without any flags or with `-march=x86-64`, `-march=x86-64-v2`, `-march=x86-64-v3`, `-march=x86-64-v4`, but fails with `-march=znver1`, `-march=znver2`, `-march=znver3`, `-march=znver4`, `-march=znver5`. It also compiles with `-march=native` even if `sys::getHostCPUName()` detects my cpu as `znver5`.

```c
__attribute__((__always_inline__, target("avx512fp16"))) void g() {}
__attribute__((target("x86-64-v4,avx512fp16"))) void f() { g(); }
```

cc https://github.com/tensorchord/pgvecto.rs/issues/650
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVMGOmzAQ_RpzsRIZO3bgwCGbKGovVQ_tGRkYwK3BkT2wm359BWE3u1IStWolS1g8z3ueN0_WIZimB8iIfCLyEOkBW-ezIejOmahw1Tn71ppAS9edjIV3m2eDrRuQ6v5Ma6ubQPieFgPSWht7gSlRbNVpX7ZEHF4StVKb1ciJYmvCdtNS7LJKwnZ5rhG9KQaEPCc8ITzJc22f9Tnkpremn3_vKWrfAM4HeAhAOCc8vSw6OlPRZsZSSrZPZHu4zfye5MP9CN_fJK2vpK8CRDzRi8BbH5e2_tQw6vw9myYuvr_r3z1MPMBeOR-M6Fc_go9vcMzALeEZuKU6A7famAE5ZYB-RqptcB8d-nC412hGIIpRGKGnpp7QcA5E7IjYNYCfXMD91-9fdAfLUBSjFSCUGGh3puVpoDpMVVfd_5Q9Pb7ImNenWP17BK8z4vtHvH-TwrKkLeJp9oofCT82BtuhWJeuI_yI0Afny9b5ivDjqRmhRLf2gfCjCWGAaaMki6pMVKlIdQRZvJWSsVQoGbVZLJJac72Rsqq5ihNZAjDJRCziTVxsVWQyzrhkSczjjZAyXddFlUAqIdmKRCWsIhsGnTZ2be3YrZ1volk4i6WI0zSyugAb5meJ89LqvpnskIfIZ1PBqhiaQDbMmoDhSoEG7fyWXSrkYRkZfbP_mrIlY3NiHISe8C3SZ-d_LjlbUqgYNYEGwGjwNntg6XSJ5bM6efcDSnzv5tLXmPHfAQAA___AIJ1S">