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

    <tr>
        <th>Summary</th>
        <td>
            target("...") attribute mandated on always_inline functions, but that doesn't make sense
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          higher-performance
      </td>
    </tr>
</table>

<pre>
    It seems to me that the `target` and `always_inline` attributes are mutually exclusive.  
In particular, this confusing error feels like a Clang bug:
```
#include <immintrin.h>
template<class T> T zero();
template<> [[gnu::target("sse2")]] [[gnu::always_inline]] __m128i zero() { return _mm_setzero_si128(); }
template<> [[gnu::target("avx")]] [[gnu::always_inline]] __m256i zero() { return _mm256_setzero_si256(); }
template<class T> [[gnu::always_inline]] auto calculate() { return zero<T>(); }
auto calculate_sse2() { return calculate<__m128i>(); }
auto calculate_avx() { return calculate<__m256i>(); }
```
```
<source>:5:68: error: always_inline function 'zero' requires target feature 'sse2',
  but would be inlined into function 'calculate' that is compiled without support for 'sse2'
<source>:5:68: error: always_inline function 'zero' requires target feature 'avx',
  but would be inlined into function 'calculate' that is compiled without support for 'avx'
```
Not only is the error difficult to make sense of (how can inlined code be multiversioned...?), but this error is particularly frustrating as it also seems to lack a reasonable workaround (as [others](https://stackoverflow.com/q/64527691) have noticed as well).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VcGO2zgM_RrlQkxgy7GdHHzIJA3Qy556D2iZjrUjS6lEJZ39-oXsYCeZzna7PRQYYGKLenx8JJ8xBH2yRI0on0W5X2Dkwflm0KeB_NOZfO_8iFbRonXda_OZIRCNAdjBSMADMvBAIKqM0Z-IRZUB2i69QHPF13DU1mhL03tmr9vIFAA9wRg5ojGvQN-UiUFfaAkgsr3Itp8tnNGzVtGgF3IHPOgAytk-Bm1PQN47Dz2RCWD0C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