(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
delay-slot-2.c
       1  /* PR rtl-optimization/51187 */
       2  /* Reported by Jurij Smakov <jurij@wooyd.org> */
       3  
       4  /* { dg-do compile } */
       5  /* { dg-options "-g -O2" } */
       6  
       7  extern int printf (__const char *__restrict __format, ...);
       8  extern void print_c_condition (const char *);
       9  extern void print_host_wide_int (long);
      10  
      11  enum decision_type
      12  {
      13    DT_num_insns,
      14    DT_mode, DT_code, DT_veclen,
      15    DT_elt_zero_int, DT_elt_one_int, DT_elt_zero_wide, DT_elt_zero_wide_safe,
      16    DT_const_int,
      17    DT_veclen_ge, DT_dup, DT_pred, DT_c_test,
      18    DT_accept_op, DT_accept_insn
      19  };
      20  
      21  struct decision_test
      22  {
      23    struct decision_test *next;
      24    enum decision_type type;
      25  
      26    union
      27    {
      28      int num_insns;
      29  
      30      struct
      31      {
      32        const char *name;
      33      } pred;
      34  
      35      const char *c_test;
      36      int veclen;
      37      int dup;
      38      long intval;
      39      int opno;
      40  
      41      struct {
      42        int code_number;
      43        int lineno;
      44        int num_clobbers_to_add;
      45      } insn;
      46    } u;
      47  };
      48  
      49  enum routine_type {
      50    RECOG, SPLIT, PEEPHOLE2
      51  };
      52  
      53  void
      54  write_cond (struct decision_test *p, int depth,
      55       enum routine_type subroutine_type)
      56  {
      57    switch (p->type)
      58      {
      59      case DT_num_insns:
      60        printf ("peep2_current_count >= %d", p->u.num_insns);
      61        break;
      62  
      63      case DT_code:
      64        printf ("GET_CODE (x%d) == ", depth);
      65        break;
      66  
      67      case DT_veclen:
      68        printf ("XVECLEN (x%d, 0) == %d", depth, p->u.veclen);
      69        break;
      70  
      71      case DT_elt_zero_int:
      72        printf ("XINT (x%d, 0) == %d", depth, (int) p->u.intval);
      73        break;
      74  
      75      case DT_elt_one_int:
      76        printf ("XINT (x%d, 1) == %d", depth, (int) p->u.intval);
      77        break;
      78  
      79      case DT_elt_zero_wide:
      80      case DT_elt_zero_wide_safe:
      81        printf ("XWINT (x%d, 0) == ", depth);
      82        print_host_wide_int (p->u.intval);
      83        break;
      84  
      85      case DT_const_int:
      86        printf ("x%d == const_int_rtx[MAX_SAVED_CONST_INT + (%d)]",
      87         depth, (int) p->u.intval);
      88        break;
      89  
      90      case DT_veclen_ge:
      91        printf ("XVECLEN (x%d, 0) >= %d", depth, p->u.veclen);
      92        break;
      93  
      94      case DT_dup:
      95        printf ("rtx_equal_p (x%d, operands[%d])", depth, p->u.dup);
      96        break;
      97  
      98      case DT_pred:
      99        printf ("%s (x%d)", p->u.pred.name, depth);
     100        break;
     101  
     102      case DT_c_test:
     103        print_c_condition (p->u.c_test);
     104        break;
     105  
     106      case DT_accept_insn:
     107        ((void)(__builtin_expect(!(subroutine_type == RECOG), 0) ? __builtin_unreachable(), 0 : 0));
     108        ((void)(__builtin_expect(!(p->u.insn.num_clobbers_to_add), 0) ? __builtin_unreachable(), 0 : 0));
     109        printf ("pnum_clobbers != NULL");
     110        break;
     111  
     112      default:
     113        __builtin_unreachable();
     114      }
     115  }
     116  
     117  /* { dg-final { scan-assembler "printf" } } */