(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
aarch64/
fp16/
f16_convs_1.c
       1  /* { dg-do run } */
       2  /* { dg-options "-O2" } */
       3  /* { dg-additional-options "-mfp16-format=ieee" {target "arm*-*-*"} } */
       4  
       5  extern void abort (void);
       6  
       7  #define EPSILON 0.0001
       8  
       9  int
      10  main (int argc, char **argv)
      11  {
      12    float f1 = 3.14159f;
      13    float f2 = 2.718f;
      14    /* This 'assembler' statement should be portable between ARM and AArch64.  */
      15    asm volatile ("" : : : "memory");
      16    __fp16 in1 = f1;
      17    __fp16 in2 = f2;
      18  
      19    /* Do the addition on __fp16's (implicitly converts both operands to
      20       float32, adds, converts back to f16, then we convert back to f32).  */
      21    __fp16 res1 = in1 + in2;
      22    asm volatile ("" : : : "memory");
      23    float f_res_1 = res1;
      24  
      25    /* Do the addition on float32's (we convert both operands to f32, and add,
      26       as above, but skip the final conversion f32 -> f16 -> f32).  */
      27    float f1a = in1;
      28    float f2a = in2;
      29    float f_res_2 = f1a + f2a;
      30  
      31    if (__builtin_fabs (f_res_2 - f_res_1) > EPSILON)
      32      abort ();
      33    return 0;
      34  }