https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69827
Bug ID: 69827 Summary: [5 Regression] sincos not done Product: gcc Version: 5.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: tkoenig at gcc dot gnu.org Target Milestone: --- The following code does not produce a call to sincos even with -ffast-math -O3. I think this should be happening since PR 30038, so am I tentatively marking this as a regression. Not sure about current trunk, hope to be able to check soon. $ cat foo.c #include <math.h> void foo(double t, double *x, double *y) { *y = sin(t); *x = cos(t); } $ gcc -S -O3 -ffast-math foo.c $ cat foo.s .file "foo.c" .section .text.unlikely,"x" .LCOLDB0: .text .LHOTB0: .p2align 4,,15 .globl foo .def foo; .scl 2; .type 32; .endef .seh_proc foo foo: pushq %rsi .seh_pushreg %rsi pushq %rbx .seh_pushreg %rbx subq $56, %rsp .seh_stackalloc 56 movaps %xmm6, 32(%rsp) .seh_savexmm %xmm6, 32 .seh_endprologue movapd %xmm0, %xmm6 movq %r8, %rsi movq %rdx, %rbx call sin movsd %xmm0, (%rsi) movapd %xmm6, %xmm0 call cos nop movaps 32(%rsp), %xmm6 movsd %xmm0, (%rbx) addq $56, %rsp popq %rbx popq %rsi ret .seh_endproc .section .text.unlikely,"x" .LCOLDE0: .text .LHOTE0: .ident "GCC: (GNU) 5.3.0" .def sin; .scl 2; .type 32; .endef .def cos; .scl 2; .type 32; .endef This works as expected: $ cat bar.c void bar(double t, double *x, double *y) { __builtin_sincos(t, x, y); *x = *x + 1.; } $ gcc -O3 -S bar.c $ cat bar.s .file "bar.c" .section .text.unlikely,"x" .LCOLDB1: .text .LHOTB1: .p2align 4,,15 .globl bar .def bar; .scl 2; .type 32; .endef .seh_proc bar bar: pushq %rbx .seh_pushreg %rbx subq $32, %rsp .seh_stackalloc 32 .seh_endprologue movq %rdx, %rbx call sincos movsd .LC0(%rip), %xmm0 addsd (%rbx), %xmm0 movsd %xmm0, (%rbx) addq $32, %rsp popq %rbx ret .seh_endproc .section .text.unlikely,"x" .LCOLDE1: .text .LHOTE1: .section .rdata,"dr" .align 8 .LC0: .long 0 .long 1072693248 .ident "GCC: (GNU) 5.3.0" .def sincos; .scl 2; .type 32; .endef $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-cygwin/5.3.0/lto-wrapper.exe Target: x86_64-unknown-cygwin Configured with: ../gcc-5.3.0/configure --enable-languages=c,c++,fortran,lto --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=c,c++,fortran,lto --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm --enable-libquadmath --enable-libquadmath-support --enable-libssp --disable-symvers --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id Thread model: posix gcc version 5.3.0 (GCC)