(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
pr84154-2.c
       1  /* { dg-do compile { target { powerpc*-*-* } } } */
       2  /* { dg-skip-if "" { powerpc*-*-darwin* } } */
       3  /* { dg-require-effective-target powerpc_p8vector_ok } */
       4  /* { dg-options "-mdejagnu-cpu=power8 -O2" } */
       5  
       6  /* PR target/84154.  Make sure on ISA 2.07 (power8) that we store the result of
       7     a conversion to char/short using an offsettable address does not generate
       8     direct moves for storing 32-bit integers, but does do a direct move for
       9     8/16-bit integers.  */
      10  
      11  void
      12  double_to_uc (double x, unsigned char *p)
      13  {
      14    p[3] = x;
      15  }
      16  
      17  void
      18  double_to_sc (double x, signed char *p)
      19  {
      20    p[3] = x;
      21  }
      22  
      23  void
      24  double_to_us (double x, unsigned short *p)
      25  {
      26    p[3] = x;
      27  }
      28  
      29  void
      30  double_to_ss (double x, short *p)
      31  {
      32    p[3] = x;
      33  }
      34  
      35  void
      36  double_to_ui (double x, unsigned int *p)
      37  {
      38    p[3] = x;
      39  }
      40  
      41  void
      42  double_to_si (double x, int *p)
      43  {
      44    p[3] = x;
      45  }
      46  
      47  /* { dg-final { scan-assembler-times {\mfctiwuz\M|\mxscvdpuxws\M} 3 } } */
      48  /* { dg-final { scan-assembler-times {\mfctiwz\M|\mxscvdpsxws\M}  3 } } */
      49  /* { dg-final { scan-assembler-times {\mmfvsrwz\M}                4 } } */
      50  /* { dg-final { scan-assembler-times {\mstfiwx\M|\mstxsiwx\M}     2 } } */
      51  /* { dg-final { scan-assembler-times {\mstb\M}                    2 } } */
      52  /* { dg-final { scan-assembler-times {\msth\M}                    2 } } */
      53  /* { dg-final { scan-assembler-not   {\mlbz\M}                      } } */
      54  /* { dg-final { scan-assembler-not   {\mlhz\M}                      } } */
      55  /* { dg-final { scan-assembler-not   {\mlha\M}                      } } */
      56  /* { dg-final { scan-assembler-not   {\mmfvsrd\M}                   } } */
      57  /* { dg-final { scan-assembler-not   {\mstw\M}                      } } */