<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/152555>152555</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] Add __builtin_elementwise_fshl/fshr builtin intrinsic
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend,
constexpr
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
RKSimon
</td>
</tr>
</table>
<pre>
Providing `__builtin_elementwise_fshl` / `__builtin_elementwise_fshr` helper builtins would allow us to represent both integer rotates and funnel/double shift patterns on scalar and vector types.
LLVM represents these as:
```
fshl(X,Y,Z): (X << (Z % BW)) | (Y >> (BW - (Z % BW)))
fshr(X,Y,Z): (X << (BW - (Z % BW))) | (Y >> (Z % BW))
```
X and Y have to be same type (and is the return type as well). technically Z (the shift amount) type doesn't have to match, but should be able to represent the full (modulo) shift amount range.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEU01v6zYQ_DWryyIGtbIs-aCD40SXpkDRAs3HxaCktcSCIg1-2M2_L6i4Ly_vIw8gIIIznNEud6T3ajTMDZS3UN5lMobJuubP3_5SszVZZ4fX5g9nz2pQZkTYiMOhi0oHZQ6seWYTLsrz4egnDRuBQO2nJJdIE-sTO7xSPF5s1ANKre0Fo8dg0fHJsWcTsLNhQmUCj-zQ2SADe5RmwGM0hjVQO9jYaUY_qWPAkwyBnfFoDfpeaukW8pn7YB2G1xP7FYgdiN3Dw9-_v_t4DBN7RumhSChsxHWJHS7FUf0EtH8G2r8AbaHYYTpCKPZQ7NP-BYFKvH1MKG0RquX0GaG4h-I-7W8f8eZ7ZlpvJu7XJj-V-JHfN6SPVYHYPS29ecZJnjl1vWP0cualTel-QtXSGXQcojNviPR4Ya2BtisM3E9G9VLrV0x2dSK_PYWcbTQh_dpya7DsDVAVvtjNMvQT0B67GNBPyxB0jDK95ocZSJrHqHXSn-0QtU2qX7ugk2bkVTY0xbAttjLjJq_KdVlXlNfZ1NRDJei4WYtaFj2xqId1ztzlleg2ol6XmWpIUClqUeUVibxe5WV_zMWGc0lFLeoS1oJnqfRK6_O8sm7MlPeRm7yksiwzLTvWfgkRUa-lGaHYHZ01gc0ARED7BFjjA_97cumkvMtck9Ruujh6WAutfPDv-kEFvcRyv8iVd7gbBvwkftSmGfo_Vik0Thmv-iw63UwhnJbZphaoHVWYYrfq7QzUJsfr5-bk7D_cB6B2Kc8DtdcKzw39FwAA__9MoEvP">