(root)/
gcc-13.2.0/
gcc/
testsuite/
c-c++-common/
zero-scratch-regs-10.c
       1  /* { dg-do run } */
       2  /* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* nvptx*-*-* s390*-*-* loongarch64*-*-* } } } */
       3  /* { dg-options "-O2" } */
       4  
       5  #include <assert.h>
       6  int result = 0;
       7  
       8  int 
       9  __attribute__((noipa))
      10  __attribute__ ((zero_call_used_regs("skip")))
      11  foo1 (int x)
      12  {
      13    return (x + 1);
      14  }
      15  
      16  int 
      17  __attribute__((noipa))
      18  __attribute__ ((zero_call_used_regs("used-gpr-arg")))
      19  foo2 (int x)
      20  {
      21    return (x + 2);
      22  }
      23  
      24  int 
      25  __attribute__((noipa))
      26  __attribute__ ((zero_call_used_regs("used-gpr")))
      27  foo3 (int x)
      28  {
      29    return (x + 3);
      30  }
      31  
      32  int 
      33  __attribute__((noipa))
      34  __attribute__ ((zero_call_used_regs("used-arg")))
      35  foo4 (int x)
      36  {
      37    return (x + 4);
      38  }
      39  
      40  int 
      41  __attribute__((noipa))
      42  __attribute__ ((zero_call_used_regs("used")))
      43  foo5 (int x)
      44  {
      45    return (x + 5);
      46  }
      47  
      48  int 
      49  __attribute__((noipa))
      50  __attribute__ ((zero_call_used_regs("all-gpr-arg")))
      51  foo6 (int x)
      52  {
      53    return (x + 6);
      54  }
      55  
      56  int 
      57  __attribute__((noipa))
      58  __attribute__ ((zero_call_used_regs("all-gpr")))
      59  foo7 (int x)
      60  {
      61    return (x + 7);
      62  }
      63  
      64  int 
      65  __attribute__((noipa))
      66  __attribute__ ((zero_call_used_regs("all-arg")))
      67  foo8 (int x)
      68  {
      69    return (x + 8);
      70  }
      71  
      72  int 
      73  __attribute__((noipa))
      74  __attribute__ ((zero_call_used_regs("all")))
      75  foo9 (int x)
      76  {
      77    return (x + 9);
      78  }
      79  
      80  int main()
      81  {
      82    result = foo1 (1);
      83    result += foo2 (1);
      84    result += foo3 (1);
      85    result += foo4 (1);
      86    result += foo5 (1);
      87    result += foo6 (1);
      88    result += foo7 (1);
      89    result += foo8 (1);
      90    result += foo9 (1);
      91    assert (result == 54);
      92    return 0;
      93  }