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

    <tr>
        <th>Summary</th>
        <td>
            [Headers][X86] Allow SSE2/AVX2/AVX512BW integer saturated arithmetic intrinsics to be used in constexpr
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            good first issue,
            backend:X86,
            clang:headers,
            constexpr
      </td>
    </tr>

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

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

<pre>
    All of these intrinsics wrap generic __builtin_elementwise_add_sat/sub_sat which can already be used in constexpr
```
_mm_adds_epi8 _mm_adds_epi16
_mm_subs_epi8 _mm_subs_epi16

_mm256_adds_epi8 _mm256_adds_epi16
_mm256_subs_epi8 _mm256_subs_epi16

_mm512_adds_epi8 _mm512_adds_epi16
_mm512_subs_epi8 _mm512_subs_epi16
```
(ignore the AVX512 mask/maskz variants for now)

You can use https://github.com/llvm/llvm-project/pull/152296 for reference - just make sure some of the constants actually saturate!
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUk89u2zAMxp9GvhANLMZy4oMP7rpgwG4r0HWnQLYYW60sBfrTrHv6wU7SOsAuAwzQ-ij8RH0iZQi6t0Q1E_dMPGQyxcH5-sf3Rz06m7VOvdeNMeAOEAcKBNpGr23QXYCTl0foyZLXHez3bdImarsnQyPZeNKB9lKpfZCR4S6kdvqD06C7ATppQRpPUr1DS5ACKdAWOmdDpN9Hz_KGlfnly5v9OE6osKej3sJyxctLOqR2kb6u5vR5B4rylrEUrphJuyEthQVMcLyFLYUrbNJuYEvhDFvckeFW99Z5moyG5ulZcIRRhleGuyn8gTfptbQxwMF5sO7EsDoX9Mul2dEUCIYYj4GtG4Y7hrtexyG1q86NDHfGvF3D3dG7F-qmhzkmYxjuuECsyhnt6UCebEdwBy8pRBjlK0FIniC4kS69cH6suR7ZxSSNeYcgY_IyEkOeqXqtqnUlM6r5RhRiIypeZUPNS46Si2ori22F6lAceF6SLKpSbtZFm2e6xhxFvs03vOBcbFaoykK1bSXzslvLVrEip1Fqs5pusnK-z3QIiWouUORlZmRLJswNjdg7p-CgfYgwb2KIDL8wxFZ2r2QVWzfP2_JD7Yy0PVs3A0lFPnzqH42JOI2Jr2cX29QHVuRGhxg-q4k6mnmgvl0o4oGJ--kY8QCNMe4Ej49fkeGueXq-BMHx_uc0XNST__BRgfQ6DiNF3S0nL7p_Tk2WvKn_uwFmX8K5BSb_3mr8GwAA__-mF1aT">