<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/77220>77220</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Handle `f(-x)=f(x)` for even functions and `f(-x)=-f(x)` for odd functions
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
k-arrows
</td>
</tr>
</table>
<pre>
Currently, Clang handles this for trigonometric functions (`sin`, `cos`, and `tan`).
https://godbolt.org/z/eharx1Gn4
However, for example, Clang doesn't currently handle this for the error function (`erf`).
https://godbolt.org/z/33W9Eharo
```c
#include<math.h>
double test_erf1(double x)
{
return -erf(-x);
}
double test_erf2(double x)
{
return erf(x);
}
```
There are many other functions we have to check, but I think the following GCC test is helpful.
https://github.com/gcc-mirror/gcc/blob/master/gcc/testsuite/gcc.dg/torture/builtin-symmetric-1.c
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMU8tu2zAQ_BrqQkigqPdBh8SOkt4L9FhQ1MpkQ5EGH3bcry9oKbFRtEEAQdIud4czmF3mnDxogB5Vj6jaJyx4YWz_mjJrzdklo5ku_S5YC9qrC6I7vFNMH7BgelLgsBfS4dlY7K08GG0W8FZyPAfNvTTaYURbVBMnNapJbEc14cZtAdNTTHi2nnYZRmSPyIPw_uhQ8YDogOhwMNNolM-MPSA6_EZ0AMHsW_6sy7V8fb-YM5zARtxICN7YclRwozwZcBrRxmP-rmeTcadCAAZrjf1QsAkAO28Uv8awKH50T4JZszGsyfrwLaaF1FyFCVCxW5gXmUDF072ayYQxMgPnf4Kdc0TbLfWGaLdVNo_rD8bYgg9W4zQSpW16LSoe3-v2n0DTL0KvyP8BfteH7y_6LsACZhbwwvQFGy_A3o3GGbBgJ8DeYC6Av0arxuDxt-iHfr2aMRulzFnqA37e7a6UsXRYgDrOQf3bC-lFGDNulhhwni4yGroGiA6jMiOiw8Kch1s2IrsgPayZbIpGemN9sDE1Bqm81Km7LOuEp3nGk6kvpq7oWAJ93pCyJnlF20T0bKpIW_F25DUtp4q3ddvUeUMa0pYdbedE9pTQkuSkISWtaJtVY9fl41y0tJ7rtulQSWBhUmVKnZY4Vol0LkDfNJSSRLERlLuuLKUazvh6iCiNG2z72JOO4eBQSZR03t1QvPQK-pd16lFN7mZl_-FuTdYFOoG-c2vb1fuO9O8WM023jiRY1X_iTSS1fdKjNb-Ae0SHqxSH6HCV-icAAP__rKRpuQ">