(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
sinatan-3.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-Ofast -fdump-tree-optimized" } */
       3  
       4  extern float sinf (float);
       5  extern float cosf (float);
       6  extern float atanf (float);
       7  extern double sin (double);
       8  extern double cos (double);
       9  extern double atan (double);
      10  extern long double sinl (long double);
      11  extern long double cosl (long double);
      12  extern long double atanl (long double);
      13  
      14  float __attribute__ ((noinline)) 
      15  cosatanf_(float x)
      16  {
      17      float atg = atanf(x);
      18      return cosf(atg) + atg;
      19  }
      20  
      21  double __attribute__ ((noinline)) 
      22  cosatan_(double x)
      23  {
      24      double atg = atan(x);
      25      return cos(atg) + atg;
      26  }
      27  
      28  long double __attribute__ ((noinline)) 
      29  cosatanl_(long double x)
      30  {
      31      long double atg = atanl(x);
      32      return cosl(atg) + atg;
      33  }
      34  
      35  float __attribute__ ((noinline)) 
      36  sinatanf_(float x)
      37  {
      38      float atg = atanf(x);
      39      return sinf(atg) + atg;
      40  }
      41  
      42  double __attribute__ ((noinline)) 
      43  sinatan_(double x)
      44  {
      45      double atg = atan(x);
      46      return sin(atg) + atg;
      47  }
      48  
      49  long double __attribute__ ((noinline)) 
      50  sinatanl_(long double x)
      51  {
      52      long double atg = atanl(x);
      53      return sinl(atg) + atg;
      54  }
      55  
      56  /* There should be calls to both sin and atan */
      57  /* { dg-final { scan-tree-dump "cos " "optimized" } } */
      58  /* { dg-final { scan-tree-dump "sin " "optimized" } } */
      59  /* { dg-final { scan-tree-dump "atan " "optimized" } } */
      60  /* { dg-final { scan-tree-dump "cosf " "optimized" } } */
      61  /* { dg-final { scan-tree-dump "sinf " "optimized" } } */
      62  /* { dg-final { scan-tree-dump "atanf " "optimized" } } */
      63  /* { dg-final { scan-tree-dump "cosl " "optimized" } } */
      64  /* { dg-final { scan-tree-dump "sinl " "optimized" } } */
      65  /* { dg-final { scan-tree-dump "atanl " "optimized" } } */