(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
prefix-no-update.c
       1  /* { dg-do compile } */
       2  /* { dg-require-effective-target powerpc_prefixed_addr } */
       3  /* { dg-require-effective-target lp64 } */
       4  /* { dg-options "-O2 -mdejagnu-cpu=power10" } */
       5  
       6  /* Make sure that we don't generate a prefixed form of the load and store with
       7     update instructions (i.e. instead of generating LWZU we have to generate
       8     PLWZ plus a PADDI).  */
       9  
      10  #ifndef SIZE
      11  #define SIZE 50000
      12  #endif
      13  
      14  struct foo {
      15    unsigned int field;
      16    char pad[SIZE];
      17  };
      18  
      19  struct foo *inc_load (struct foo *p, unsigned int *q)
      20  {
      21    *q = (++p)->field;	/* PLWZ, PADDI, STW.  */
      22    return p;
      23  }
      24  
      25  struct foo *dec_load (struct foo *p, unsigned int *q)
      26  {
      27    *q = (--p)->field;	/* PLWZ, PADDI, STW.  */
      28    return p;
      29  }
      30  
      31  struct foo *inc_store (struct foo *p, unsigned int *q)
      32  {
      33    (++p)->field = *q;	/* LWZ, PADDI, PSTW.  */
      34    return p;
      35  }
      36  
      37  struct foo *dec_store (struct foo *p, unsigned int *q)
      38  {
      39    (--p)->field = *q;	/* LWZ, PADDI, PSTW.  */
      40    return p;
      41  }
      42  
      43  /* { dg-final { scan-assembler-times {\mlwz\M}    2 } } */
      44  /* { dg-final { scan-assembler-times {\mstw\M}    2 } } */
      45  /* { dg-final { scan-assembler-times {\mpaddi\M}  4 } } */
      46  /* { dg-final { scan-assembler-times {\mplwz\M}   2 } } */
      47  /* { dg-final { scan-assembler-times {\mpstw\M}   2 } } */
      48  /* { dg-final { scan-assembler-not   {\mplwzu\M}    } } */
      49  /* { dg-final { scan-assembler-not   {\mpstwu\M}    } } */
      50  /* { dg-final { scan-assembler-not   {\maddis\M}    } } */
      51  /* { dg-final { scan-assembler-not   {\maddi\M}     } } */