2014-04-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / delay-slot-2.c
blob79faf81c7982de494873da81ece537e9c2472e13
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 *);
10 enum decision_type
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
20 struct decision_test
22 struct decision_test *next;
23 enum decision_type type;
25 union
27 int num_insns;
29 struct
31 const char *name;
32 } pred;
34 const char *c_test;
35 int veclen;
36 int dup;
37 long intval;
38 int opno;
40 struct {
41 int code_number;
42 int lineno;
43 int num_clobbers_to_add;
44 } insn;
45 } u;
48 enum routine_type {
49 RECOG, SPLIT, PEEPHOLE2
52 void
53 write_cond (struct decision_test *p, int depth,
54 enum routine_type subroutine_type)
56 switch (p->type)
58 case DT_num_insns:
59 printf ("peep2_current_count >= %d", p->u.num_insns);
60 break;
62 case DT_code:
63 printf ("GET_CODE (x%d) == ", depth);
64 break;
66 case DT_veclen:
67 printf ("XVECLEN (x%d, 0) == %d", depth, p->u.veclen);
68 break;
70 case DT_elt_zero_int:
71 printf ("XINT (x%d, 0) == %d", depth, (int) p->u.intval);
72 break;
74 case DT_elt_one_int:
75 printf ("XINT (x%d, 1) == %d", depth, (int) p->u.intval);
76 break;
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;
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;
89 case DT_veclen_ge:
90 printf ("XVECLEN (x%d, 0) >= %d", depth, p->u.veclen);
91 break;
93 case DT_dup:
94 printf ("rtx_equal_p (x%d, operands[%d])", depth, p->u.dup);
95 break;
97 case DT_pred:
98 printf ("%s (x%d)", p->u.pred.name, depth);
99 break;
101 case DT_c_test:
102 print_c_condition (p->u.c_test);
103 break;
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;
111 default:
112 __builtin_unreachable();
116 /* { dg-final { scan-assembler "printf" } } */