<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/113360>113360</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Implement fixed point fxbits functions in llvm-libc
</td>
</tr>
<tr>
<th>Labels</th>
<td>
good first issue,
clang,
libc
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
PiJoules
</td>
</tr>
</table>
<pre>
Some fixed point functions from ISO 18037 are implemented in llvm-libc, but not all of them are implemented. The various `fx`bits functions should also be added. Copying from the extension:
```
4.1.7.5 The bitwise integer to fixed-point conversion functions
The bitwise integer to fixed-point conversion functions fxbits, where fx stands for one of hr, r, lr, hk, k, lk, uhr, ur, ulr, uhk, uk or ulk, take one argument with type int_fx_t or uint_fx_t, the result type is a fixed-point type (corresponding to fx).
The bitwise fixed-point to integer conversion functions return an fixed-point value equal to the integer value of the argument divided by 2^F, where F is the number of fractional bits in the fixedpoint result type of the function. For example, if fract has 15 fractional bits, then the value of rbits(0x2000) is 0.25.
```
These can first be implemented as `__builtin_*` functions in clang then llvm-libc can provide the wrappers for each of the builtin functions.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVE2PpDYQ_TXmUhpkTEM3Bw7JbFraXBJpc2_ZUIAzxib-6GH-fWRDf8xkT5Fa1TK8evXqUS7unBw1YkuqX0n1LePBT8a2f8rfTVDoMmH6j_aHmREGuWIPi5HawxB056XRDgZrZvj-4w8oTrQ8ArcIcl4Uzqg99iA1KHWdX5QUHWGvIIIHbTxwpcAM4Cecv-bk8NeEcOVWmuCA1HRYSU2F9O6prJtMUD1w5QwIBN73MfHVLB9Sj5soPyHg6lE7aTQpfyH0G6G3WNP9l46HvMiPeZUKC-nfpUOQ2uOIFrzZOn_ZOu-MvqKNlA81z8z_kwKGNXYYLXqf0CIMKzjPde9gMBaMxmjXZCMgBZXi9BZjCirFsEHCFjdQ2FDhDYyFsOE8f8PEyu0You_wLv0E_mNJsi_DevEJfjukpAnBogvK70AH_FNn6Slhp85Yi24xuo9fI7a_Etbk_3XoU7K5G_ZThyz6YDVw_SnrylVAwH8CV5EhSryxbK-2KXv02cur7LEH8QGMVL-dH5afY0MRq8Ms0MbMwfJUnStIAyh1AiQBW_1nP_ZSN8k5nI0FXHmc7VhG7oQwcQdF9ZV9t3grcRdvt1cnujJKKWFNVElzVuU_HeW7xw6hS15Z5-MVeb6VPN2ry0UEqbzUF8IizZPXUkOnePx2Uc_9BifGxZroYFL5bvmyoN2GFHk33TzYmR-Uu9qsb8u-KRueYVscWVMzdmxO2dTSqh-KDkWDdcVZh4eaH0XZnQ5NeTpWDc9kyyg7FJSx4nSoy1PeFxUVfBCUdTUrREUOFGcuVR7l5saOmXQuYFsUZVnTTHGByqU1x9hoTL9bk0CEMcJeCWOp6_tp21os7kXbJhdEGB05UCWdd49CXnqF7febw59X5fpldT2vxCxY1U7eLy4uKHYm7DxKPwWRd2Ym7ByB-9_LYs3f2HnCzkmyI-y8t3Zt2b8BAAD__3wN8mY">