OSDN Git Service

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