(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
builtin-tgmath-2.c
       1  /* Test __builtin_tgmath: valid uses, _FloatN types.  */
       2  /* { dg-do run } */
       3  /* { dg-options "" } */
       4  /* { dg-add-options float32 } */
       5  /* { dg-require-effective-target float32_runtime } */
       6  
       7  extern void abort (void);
       8  extern void exit (int);
       9  
      10  #define CHECK_CALL(C, E, V)			\
      11    do						\
      12      {						\
      13        if ((C) != (E))				\
      14  	abort ();				\
      15        extern __typeof (C) V;			\
      16      }						\
      17    while (0)
      18  
      19  extern float var_f;
      20  extern double var_d;
      21  extern long double var_ld;
      22  extern _Float32 var_f32;
      23  
      24  float t1f (float x) { return x + 1; }
      25  double t1d (double x) { return x + 2; }
      26  long double t1l (long double x) { return x + 3; }
      27  _Float32 t1f32 (_Float32 x) { return x + 4; }
      28  
      29  #define t1v(x) __builtin_tgmath (t1f, t1d, t1l, t1f32, x)
      30  
      31  static void
      32  test_1 (void)
      33  {
      34    float f = 1;
      35    double d = 2;
      36    long double ld = 3;
      37    _Float32 f32 = 4;
      38    int i = 5;
      39    CHECK_CALL (t1v (f), 2, var_f);
      40    CHECK_CALL (t1v (d), 4, var_d);
      41    CHECK_CALL (t1v (ld), 6, var_ld);
      42    CHECK_CALL (t1v (f32), 8, var_f32);
      43    CHECK_CALL (t1v (i), 7, var_d);
      44  }
      45  
      46  int
      47  main (void)
      48  {
      49    test_1 ();
      50    exit (0);
      51  }