| Issue |
235241
|
| Summary |
[InstCombine] sin+cos>sincos fusion shouldn't depend on no errno
|
| Labels |
llvm:instcombine,
missed-optimization
|
| Assignees |
|
| Reporter |
Andarwinux
|
see https://discourse.llvm.org/t/why-doesn-t-llvm-fuse-paired-sin-cos-into-sincos-the-way-gcc-does-default-math-errno/91701
https://godbolt.org/z/Mfff19Wrz
```c
#include <math.h>
double pair(double a) {
double s = sin(a);
double c = cos(a);
return s + c;
}
```
gcc -O3
```asm
"pair":
sub rsp, 24
lea rdi, [rsp+8]
mov rsi, rsp
call "sincos"
movsd xmm0, QWORD PTR [rsp+8]
addsd xmm0, QWORD PTR [rsp]
add rsp, 24
ret
```
clang -O3
```asm
pair:
sub rsp, 24
movsd qword ptr [rsp + 8], xmm0
call sin@PLT
movsd qword ptr [rsp + 16], xmm0
movsd xmm0, qword ptr [rsp + 8]
call cos@PLT
addsd xmm0, qword ptr [rsp + 16]
add rsp, 24
ret
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs