On Thu, 2020-06-04 at 11:09 +0200, Christophe Lyon wrote: > Hi, > > On Thu, 4 Jun 2020 at 01:03, Jeff Law via Gcc-patches > <gcc-patches@gcc.gnu.org> wrote: > > On Fri, 2020-01-31 at 15:50 -0300, Vitor Guidi wrote: > > > I took the required steps. The patch is attached to this email, I hope > > > I got it right this time. I did not forward the patch to gcc-patches > > > the first time, sorry for the inconvenience. > > > > > > Thank you for your attention, > > > > > > Vitor. > > > > > > in gcc/ChangeLog: > > > 2020-01-28 Vitor Guidi <vitor.gu...@usp.br> > > > * match.pd: New substitution rule for tanh(x)/sinh(x) -> > > > 1.0/cosh(x). > > > > > > in gcc/testsuite/ChangeLog: > > > 2020-01-28 Vitor Guidi <vitor.gu...@usp.br> > > > *gcc.dg/tanhbysinh.c (new): New testcase. > > Thanks. I've installed this on the trunk. Sorry for the delays. > > The new test fails on bare-metal targets (with newlib) such as > arm-eabi, aarch64-elf, moxie and pru: > PASS: gcc.dg/tanhbysinh.c (test for excess errors) > PASS: gcc.dg/tanhbysinh.c scan-tree-dump optimized "cosh " > FAIL: gcc.dg/tanhbysinh.c scan-tree-dump optimized "coshf " > FAIL: gcc.dg/tanhbysinh.c scan-tree-dump optimized "coshl " > > I didn't check the dumps manually; why does the optimization depend on > the lib version? I think it's the TARGET_LIBC_HAS_FUNCTION target hook that's coming into play here. We get the same issues with sinhovercosh-1.
Making the test conditional on ! newlib would seem to help. As a target selector it's not great as it only works properly if newlib has been built and installed, but it's still a hell of a lot better than doing nothing. I'll put that in the tester and see what pops out. jeff