(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
pcrel-opt-st-si.c
       1  /* { dg-do compile } */
       2  /* { dg-require-effective-target powerpc_pcrel } */
       3  /* { dg-options "-O2 -mdejagnu-cpu=power10 -mpcrel-opt" } */
       4  
       5  #define TYPE	int
       6  #define LARGE	0x20000
       7  
       8  /* Test whether we get the right number of PCREL_OPT optimizations for int.  */
       9  extern TYPE ext[];
      10  
      11  void
      12  store (TYPE a)
      13  {
      14    ext[0] = a;			/* PCREL_OPT relocation.  */
      15  }
      16  
      17  void
      18  store2 (TYPE a)
      19  {
      20    ext[2] = a;			/* PCREL_OPT relocation.  */
      21  }
      22  
      23  void
      24  store_large (TYPE a)
      25  {
      26    ext[LARGE] = a;		/* No PCREL_OPT (store is prefixed).  */
      27  }
      28  
      29  void
      30  store_variable (TYPE a, unsigned long n)
      31  {
      32    ext[n] = a;			/* No PCREL_OPT (store is indexed).  */
      33  }
      34  
      35  void
      36  store_double (double a)
      37  {
      38    ext[0] = (TYPE) a;		/* No PCREL_OPT (STFIWX is indexed).  */
      39  }
      40  
      41  /* { dg-final { scan-assembler-times "R_PPC64_PCREL_OPT"  2 } } */