(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
bfp/
scalar-test-data-class-13.c
       1  /* { dg-do run { target { powerpc*-*-* } } } */
       2  /* { dg-require-effective-target p9vector_hw } */
       3  /* { dg-options "-mdejagnu-cpu=power9" } */
       4  
       5  #include <altivec.h>
       6  #include <stdbool.h>
       7  #include <stdlib.h>
       8  
       9  bool
      10  test_zero (float *p)
      11  {
      12    float source = *p;
      13  
      14    /*
      15      0x40    Test for NaN
      16      0x20    Test for +Infinity
      17      0x10    Test for -Infinity
      18      0x08    Test for +Zero
      19      0x04    Test for -Zero
      20      0x02    Test for +Denormal
      21      0x01    Test for -Denormal
      22    */
      23    return scalar_test_data_class (source, 12);
      24  }
      25  
      26  int
      27  main ()
      28  {
      29    /* A Zero value has a biased exponent value of zero and a zero
      30     * fraction value.  The sign may be either positive or negative.  */
      31    unsigned int zero_plus_image = 0x0;
      32    unsigned int zero_minus_image = 0x80000000;
      33    unsigned int non_zero_image = 0x60000000;
      34  
      35    float *zero_plus_p = (float *) &zero_plus_image;
      36    float *zero_minus_p = (float *) &zero_minus_image;
      37    float *not_zero_p = (float *) &non_zero_image;
      38  
      39    if (!test_zero (zero_plus_p))
      40      abort ();
      41    if (!test_zero (zero_minus_p))
      42      abort ();
      43    if (test_zero (not_zero_p))
      44      abort ();
      45    return 0;
      46  }