1  /* { dg-do compile { target powerpc*-*-* } } */
       2  /* { dg-options "-O2" } */
       3  /* { dg-final { scan-assembler {\mmflr\M.*\mbl\M.*\mmflr\M.*\mbl\M} } } */
       4  
       5  /* This tests if shrink-wrapping for separate components puts a prologue
       6     inside a loop when that is useful.  In this case, it saves the link
       7     register before each call: both calls happen with probability .10,
       8     so saving the link register happens with .80 per execution of f on
       9     average, which is smaller than 1 which you would get if you saved
      10     it outside the loop.  */
      11  
      12  int *a;
      13  void g(void);
      14  
      15  void f(int x)
      16  {
      17  	int j;
      18  	for (j = 0; j < 4; j++) {
      19  		if (__builtin_expect(a[j], 0))
      20  			g();
      21  		asm("#" : : : "memory");
      22  		if (__builtin_expect(a[j], 0))
      23  			g();
      24  		a[j]++;
      25  	}
      26  }