PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / delay-slot-2.c
blobd8619aac95ded2cb7a4e37e8baea0715fcf4f0c1
1 /* PR rtl-optimization/51187 */
2 /* Reported by Jurij Smakov <jurij@wooyd.org> */
4 /* { dg-do compile } */
5 /* { dg-options "-g -O2" } */
7 extern int printf (__const char *__restrict __format, ...);
8 extern void print_c_condition (const char *);
9 extern void print_host_wide_int (long);
11 enum decision_type
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
21 struct decision_test
23 struct decision_test *next;
24 enum decision_type type;
26 union
28 int num_insns;
30 struct
32 const char *name;
33 } pred;
35 const char *c_test;
36 int veclen;
37 int dup;
38 long intval;
39 int opno;
41 struct {
42 int code_number;
43 int lineno;
44 int num_clobbers_to_add;
45 } insn;
46 } u;
49 enum routine_type {
50 RECOG, SPLIT, PEEPHOLE2
53 void
54 write_cond (struct decision_test *p, int depth,
55 enum routine_type subroutine_type)
57 switch (p->type)
59 case DT_num_insns:
60 printf ("peep2_current_count >= %d", p->u.num_insns);
61 break;
63 case DT_code:
64 printf ("GET_CODE (x%d) == ", depth);
65 break;
67 case DT_veclen:
68 printf ("XVECLEN (x%d, 0) == %d", depth, p->u.veclen);
69 break;
71 case DT_elt_zero_int:
72 printf ("XINT (x%d, 0) == %d", depth, (int) p->u.intval);
73 break;
75 case DT_elt_one_int:
76 printf ("XINT (x%d, 1) == %d", depth, (int) p->u.intval);
77 break;
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;
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;
90 case DT_veclen_ge:
91 printf ("XVECLEN (x%d, 0) >= %d", depth, p->u.veclen);
92 break;
94 case DT_dup:
95 printf ("rtx_equal_p (x%d, operands[%d])", depth, p->u.dup);
96 break;
98 case DT_pred:
99 printf ("%s (x%d)", p->u.pred.name, depth);
100 break;
102 case DT_c_test:
103 print_c_condition (p->u.c_test);
104 break;
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;
112 default:
113 __builtin_unreachable();
117 /* { dg-final { scan-assembler "printf" } } */