annotate gcc/rtl-tests.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Unit tests for RTL-handling.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 2015-2020 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 This file is part of GCC.
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it under
kono
parents:
diff changeset
7 the terms of the GNU General Public License as published by the Free
kono
parents:
diff changeset
8 Software Foundation; either version 3, or (at your option) any later
kono
parents:
diff changeset
9 version.
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
kono
parents:
diff changeset
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
kono
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kono
parents:
diff changeset
14 for more details.
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
17 along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
18 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 #include "config.h"
kono
parents:
diff changeset
21 #include "system.h"
kono
parents:
diff changeset
22 #include "coretypes.h"
kono
parents:
diff changeset
23 #include "tm.h"
kono
parents:
diff changeset
24 #include "opts.h"
kono
parents:
diff changeset
25 #include "hash-set.h"
kono
parents:
diff changeset
26 #include "fixed-value.h"
kono
parents:
diff changeset
27 #include "alias.h"
kono
parents:
diff changeset
28 #include "flags.h"
kono
parents:
diff changeset
29 #include "symtab.h"
kono
parents:
diff changeset
30 #include "tree-core.h"
kono
parents:
diff changeset
31 #include "stor-layout.h"
kono
parents:
diff changeset
32 #include "tree.h"
kono
parents:
diff changeset
33 #include "stringpool.h"
kono
parents:
diff changeset
34 #include "stor-layout.h"
kono
parents:
diff changeset
35 #include "rtl.h"
kono
parents:
diff changeset
36 #include "pretty-print.h"
kono
parents:
diff changeset
37 #include "cfgbuild.h"
kono
parents:
diff changeset
38 #include "print-rtl.h"
kono
parents:
diff changeset
39 #include "selftest.h"
kono
parents:
diff changeset
40 #include "selftest-rtl.h"
kono
parents:
diff changeset
41 #include "function.h"
kono
parents:
diff changeset
42 #include "memmodel.h"
kono
parents:
diff changeset
43 #include "emit-rtl.h"
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 #if CHECKING_P
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 namespace selftest {
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 /* Verify that PAT is printed as EXPECTED. Helper function for
kono
parents:
diff changeset
50 selftests. */
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 static void
kono
parents:
diff changeset
53 verify_print_pattern (const char *expected, rtx pat)
kono
parents:
diff changeset
54 {
kono
parents:
diff changeset
55 pretty_printer pp;
kono
parents:
diff changeset
56 print_pattern (&pp, pat, 1);
kono
parents:
diff changeset
57 ASSERT_STREQ (expected, pp_formatted_text (&pp));
kono
parents:
diff changeset
58 }
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60 /* Verify that X is dumped as EXPECTED_DUMP, using compact mode.
kono
parents:
diff changeset
61 Use LOC as the effective location when reporting errors. */
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 void
kono
parents:
diff changeset
64 assert_rtl_dump_eq (const location &loc, const char *expected_dump, rtx x,
kono
parents:
diff changeset
65 rtx_reuse_manager *reuse_manager)
kono
parents:
diff changeset
66 {
kono
parents:
diff changeset
67 named_temp_file tmp_out (".rtl");
kono
parents:
diff changeset
68 FILE *outfile = fopen (tmp_out.get_filename (), "w");
kono
parents:
diff changeset
69 rtx_writer w (outfile, 0, false, true, reuse_manager);
kono
parents:
diff changeset
70 w.print_rtl (x);
kono
parents:
diff changeset
71 fclose (outfile);
kono
parents:
diff changeset
72
kono
parents:
diff changeset
73 char *dump = read_file (SELFTEST_LOCATION, tmp_out.get_filename ());
kono
parents:
diff changeset
74 ASSERT_STREQ_AT (loc, expected_dump, dump);
kono
parents:
diff changeset
75 free (dump);
kono
parents:
diff changeset
76 }
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 /* Verify that regs are dumped as expected (in compact mode). */
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 static void
kono
parents:
diff changeset
81 test_dumping_regs ()
kono
parents:
diff changeset
82 {
kono
parents:
diff changeset
83 /* Dumps of hard regs contain a target-specific name, so we don't test
kono
parents:
diff changeset
84 it here; this can be tested in target-specific selftests. */
kono
parents:
diff changeset
85
kono
parents:
diff changeset
86 /* Test dumping of virtual regs. The various virtual regs are inited as
kono
parents:
diff changeset
87 Pmode, so this is target-specific. The tests below assume DImode, so
kono
parents:
diff changeset
88 only run the tests for targets where Pmode is DImode. */
kono
parents:
diff changeset
89 if (Pmode == DImode)
kono
parents:
diff changeset
90 {
kono
parents:
diff changeset
91 ASSERT_RTL_DUMP_EQ ("(reg:DI virtual-incoming-args)",
kono
parents:
diff changeset
92 virtual_incoming_args_rtx);
kono
parents:
diff changeset
93 ASSERT_RTL_DUMP_EQ ("(reg:DI virtual-stack-vars)",
kono
parents:
diff changeset
94 virtual_stack_vars_rtx);
kono
parents:
diff changeset
95 ASSERT_RTL_DUMP_EQ ("(reg:DI virtual-stack-dynamic)",
kono
parents:
diff changeset
96 virtual_stack_dynamic_rtx);
kono
parents:
diff changeset
97 ASSERT_RTL_DUMP_EQ ("(reg:DI virtual-outgoing-args)",
kono
parents:
diff changeset
98 virtual_outgoing_args_rtx);
kono
parents:
diff changeset
99 ASSERT_RTL_DUMP_EQ ("(reg:DI virtual-cfa)",
kono
parents:
diff changeset
100 virtual_cfa_rtx);
kono
parents:
diff changeset
101 ASSERT_RTL_DUMP_EQ ("(reg:DI virtual-preferred-stack-boundary)",
kono
parents:
diff changeset
102 virtual_preferred_stack_boundary_rtx);
kono
parents:
diff changeset
103 }
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105 /* Test dumping of non-virtual pseudos. */
kono
parents:
diff changeset
106 ASSERT_RTL_DUMP_EQ ("(reg:SI <0>)",
kono
parents:
diff changeset
107 gen_raw_REG (SImode, LAST_VIRTUAL_REGISTER + 1));
kono
parents:
diff changeset
108 ASSERT_RTL_DUMP_EQ ("(reg:SI <1>)",
kono
parents:
diff changeset
109 gen_raw_REG (SImode, LAST_VIRTUAL_REGISTER + 2));
kono
parents:
diff changeset
110 }
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112 /* Verify that insns are dumped as expected (in compact mode). */
kono
parents:
diff changeset
113
kono
parents:
diff changeset
114 static void
kono
parents:
diff changeset
115 test_dumping_insns ()
kono
parents:
diff changeset
116 {
kono
parents:
diff changeset
117 /* Barriers. */
kono
parents:
diff changeset
118 rtx_barrier *barrier = as_a <rtx_barrier *> (rtx_alloc (BARRIER));
kono
parents:
diff changeset
119 SET_NEXT_INSN (barrier) = NULL;
kono
parents:
diff changeset
120 ASSERT_RTL_DUMP_EQ ("(cbarrier 0)\n", barrier);
kono
parents:
diff changeset
121
kono
parents:
diff changeset
122 /* Labels. */
kono
parents:
diff changeset
123 rtx_insn *label = gen_label_rtx ();
kono
parents:
diff changeset
124 CODE_LABEL_NUMBER (label) = 42;
kono
parents:
diff changeset
125 ASSERT_RTL_DUMP_EQ ("(clabel 0 42)\n", label);
kono
parents:
diff changeset
126
kono
parents:
diff changeset
127 LABEL_NAME (label)= "some_label";
kono
parents:
diff changeset
128 ASSERT_RTL_DUMP_EQ ("(clabel 0 42 (\"some_label\"))\n", label);
kono
parents:
diff changeset
129 }
kono
parents:
diff changeset
130
kono
parents:
diff changeset
131 /* Manually exercise the rtx_reuse_manager code. */
kono
parents:
diff changeset
132
kono
parents:
diff changeset
133 static void
kono
parents:
diff changeset
134 test_dumping_rtx_reuse ()
kono
parents:
diff changeset
135 {
kono
parents:
diff changeset
136 rtx_reuse_manager r;
kono
parents:
diff changeset
137
kono
parents:
diff changeset
138 rtx x = rtx_alloc (SCRATCH);
kono
parents:
diff changeset
139 rtx y = rtx_alloc (SCRATCH);
kono
parents:
diff changeset
140 rtx z = rtx_alloc (SCRATCH);
kono
parents:
diff changeset
141
kono
parents:
diff changeset
142 /* x and y will be seen more than once. */
kono
parents:
diff changeset
143 r.preprocess (x);
kono
parents:
diff changeset
144 r.preprocess (x);
kono
parents:
diff changeset
145 r.preprocess (y);
kono
parents:
diff changeset
146 r.preprocess (y);
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 /* z will be only seen once. */
kono
parents:
diff changeset
149 r.preprocess (z);
kono
parents:
diff changeset
150
kono
parents:
diff changeset
151 /* Verify that x and y have been assigned reuse IDs. */
kono
parents:
diff changeset
152 int reuse_id_for_x;
kono
parents:
diff changeset
153 ASSERT_TRUE (r.has_reuse_id (x, &reuse_id_for_x));
kono
parents:
diff changeset
154 ASSERT_EQ (0, reuse_id_for_x);
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156 int reuse_id_for_y;
kono
parents:
diff changeset
157 ASSERT_TRUE (r.has_reuse_id (y, &reuse_id_for_y));
kono
parents:
diff changeset
158 ASSERT_EQ (1, reuse_id_for_y);
kono
parents:
diff changeset
159
kono
parents:
diff changeset
160 /* z is only seen once and thus shouldn't get a reuse ID. */
kono
parents:
diff changeset
161 ASSERT_FALSE (r.has_reuse_id (z, NULL));
kono
parents:
diff changeset
162
kono
parents:
diff changeset
163 /* The first dumps of x and y should be prefixed by reuse ID;
kono
parents:
diff changeset
164 all subsequent dumps of them should show up as "reuse_rtx". */
kono
parents:
diff changeset
165 ASSERT_RTL_DUMP_EQ_WITH_REUSE ("(0|scratch)", x, &r);
kono
parents:
diff changeset
166 ASSERT_RTL_DUMP_EQ_WITH_REUSE ("(reuse_rtx 0)", x, &r);
kono
parents:
diff changeset
167 ASSERT_RTL_DUMP_EQ_WITH_REUSE ("(reuse_rtx 0)", x, &r);
kono
parents:
diff changeset
168
kono
parents:
diff changeset
169 ASSERT_RTL_DUMP_EQ_WITH_REUSE ("(1|scratch)", y, &r);
kono
parents:
diff changeset
170 ASSERT_RTL_DUMP_EQ_WITH_REUSE ("(reuse_rtx 1)", y, &r);
kono
parents:
diff changeset
171 ASSERT_RTL_DUMP_EQ_WITH_REUSE ("(reuse_rtx 1)", y, &r);
kono
parents:
diff changeset
172
kono
parents:
diff changeset
173 /* z only appears once and thus shouldn't be prefixed with a
kono
parents:
diff changeset
174 reuse ID. */
kono
parents:
diff changeset
175 ASSERT_RTL_DUMP_EQ_WITH_REUSE ("(scratch)", z, &r);
kono
parents:
diff changeset
176 }
kono
parents:
diff changeset
177
kono
parents:
diff changeset
178 /* Unit testing of "single_set". */
kono
parents:
diff changeset
179
kono
parents:
diff changeset
180 static void
kono
parents:
diff changeset
181 test_single_set ()
kono
parents:
diff changeset
182 {
kono
parents:
diff changeset
183 /* A label is not a SET. */
kono
parents:
diff changeset
184 ASSERT_EQ (NULL_RTX, single_set (gen_label_rtx ()));
kono
parents:
diff changeset
185
kono
parents:
diff changeset
186 /* An unconditional jump insn is a single SET. */
kono
parents:
diff changeset
187 rtx set_pc = gen_rtx_SET (pc_rtx,
kono
parents:
diff changeset
188 gen_rtx_LABEL_REF (VOIDmode,
kono
parents:
diff changeset
189 gen_label_rtx ()));
kono
parents:
diff changeset
190 rtx_insn *jump_insn = emit_jump_insn (set_pc);
kono
parents:
diff changeset
191 ASSERT_EQ (set_pc, single_set (jump_insn));
kono
parents:
diff changeset
192
kono
parents:
diff changeset
193 /* etc */
kono
parents:
diff changeset
194 }
kono
parents:
diff changeset
195
kono
parents:
diff changeset
196 /* Construct an unconditional jump to a label, and verify that
kono
parents:
diff changeset
197 various properties of it are sane. */
kono
parents:
diff changeset
198
kono
parents:
diff changeset
199 static void
kono
parents:
diff changeset
200 test_uncond_jump ()
kono
parents:
diff changeset
201 {
kono
parents:
diff changeset
202 set_new_first_and_last_insn (NULL, NULL);
kono
parents:
diff changeset
203 rtx_insn *label = gen_label_rtx ();
kono
parents:
diff changeset
204 rtx jump_pat = gen_rtx_SET (pc_rtx,
kono
parents:
diff changeset
205 gen_rtx_LABEL_REF (VOIDmode,
kono
parents:
diff changeset
206 label));
kono
parents:
diff changeset
207 ASSERT_EQ (SET, jump_pat->code);
kono
parents:
diff changeset
208 ASSERT_EQ (LABEL_REF, SET_SRC (jump_pat)->code);
kono
parents:
diff changeset
209 ASSERT_EQ (label, label_ref_label (SET_SRC (jump_pat)));
kono
parents:
diff changeset
210 ASSERT_EQ (PC, SET_DEST (jump_pat)->code);
kono
parents:
diff changeset
211
kono
parents:
diff changeset
212 verify_print_pattern ("pc=L0", jump_pat);
kono
parents:
diff changeset
213
kono
parents:
diff changeset
214 ASSERT_RTL_DUMP_EQ ("(set (pc)\n"
kono
parents:
diff changeset
215 " (label_ref 0))",
kono
parents:
diff changeset
216 jump_pat);
kono
parents:
diff changeset
217
kono
parents:
diff changeset
218 rtx_insn *jump_insn = emit_jump_insn (jump_pat);
kono
parents:
diff changeset
219 ASSERT_FALSE (any_condjump_p (jump_insn));
kono
parents:
diff changeset
220 ASSERT_TRUE (any_uncondjump_p (jump_insn));
kono
parents:
diff changeset
221 ASSERT_TRUE (pc_set (jump_insn));
kono
parents:
diff changeset
222 ASSERT_TRUE (simplejump_p (jump_insn));
kono
parents:
diff changeset
223 ASSERT_TRUE (onlyjump_p (jump_insn));
kono
parents:
diff changeset
224 ASSERT_TRUE (control_flow_insn_p (jump_insn));
kono
parents:
diff changeset
225
kono
parents:
diff changeset
226 ASSERT_RTL_DUMP_EQ ("(cjump_insn 1 (set (pc)\n"
kono
parents:
diff changeset
227 " (label_ref 0)))\n",
kono
parents:
diff changeset
228 jump_insn);
kono
parents:
diff changeset
229 }
kono
parents:
diff changeset
230
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
231 template<unsigned int N>
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
232 struct const_poly_int_tests
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
233 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
234 static void run ();
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
235 };
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
236
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
237 template<>
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
238 struct const_poly_int_tests<1>
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
239 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
240 static void run () {}
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
241 };
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
242
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
243 /* Test various CONST_POLY_INT properties. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
244
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
245 template<unsigned int N>
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
246 void
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
247 const_poly_int_tests<N>::run ()
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
248 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
249 rtx x1 = gen_int_mode (poly_int64 (1, 1), QImode);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
250 rtx x255 = gen_int_mode (poly_int64 (1, 255), QImode);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
251
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
252 /* Test that constants are unique. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
253 ASSERT_EQ (x1, gen_int_mode (poly_int64 (1, 1), QImode));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
254 ASSERT_NE (x1, gen_int_mode (poly_int64 (1, 1), HImode));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
255 ASSERT_NE (x1, x255);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
256
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
257 /* Test const_poly_int_value. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
258 ASSERT_KNOWN_EQ (const_poly_int_value (x1), poly_int64 (1, 1));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
259 ASSERT_KNOWN_EQ (const_poly_int_value (x255), poly_int64 (1, -1));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
260
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
261 /* Test rtx_to_poly_int64. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
262 ASSERT_KNOWN_EQ (rtx_to_poly_int64 (x1), poly_int64 (1, 1));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
263 ASSERT_KNOWN_EQ (rtx_to_poly_int64 (x255), poly_int64 (1, -1));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
264 ASSERT_MAYBE_NE (rtx_to_poly_int64 (x255), poly_int64 (1, 255));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
265
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
266 /* Test plus_constant of a symbol. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
267 rtx symbol = gen_rtx_SYMBOL_REF (Pmode, "foo");
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
268 rtx offset1 = gen_int_mode (poly_int64 (9, 11), Pmode);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
269 rtx sum1 = gen_rtx_CONST (Pmode, gen_rtx_PLUS (Pmode, symbol, offset1));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
270 ASSERT_RTX_EQ (plus_constant (Pmode, symbol, poly_int64 (9, 11)), sum1);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
271
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
272 /* Test plus_constant of a CONST. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
273 rtx offset2 = gen_int_mode (poly_int64 (12, 20), Pmode);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
274 rtx sum2 = gen_rtx_CONST (Pmode, gen_rtx_PLUS (Pmode, symbol, offset2));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
275 ASSERT_RTX_EQ (plus_constant (Pmode, sum1, poly_int64 (3, 9)), sum2);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
276
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
277 /* Test a cancelling plus_constant. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
278 ASSERT_EQ (plus_constant (Pmode, sum2, poly_int64 (-12, -20)), symbol);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
279
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
280 /* Test plus_constant on integer constants. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
281 ASSERT_EQ (plus_constant (QImode, const1_rtx, poly_int64 (4, -2)),
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
282 gen_int_mode (poly_int64 (5, -2), QImode));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
283 ASSERT_EQ (plus_constant (QImode, x1, poly_int64 (4, -2)),
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
284 gen_int_mode (poly_int64 (5, -1), QImode));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
285 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
286
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
287 /* Check dumping of repeated RTL vectors. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
288
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
289 static void
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
290 test_dumping_repeat ()
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
291 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
292 rtx p = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (3));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
293 XVECEXP (p, 0, 0) = const0_rtx;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
294 XVECEXP (p, 0, 1) = const0_rtx;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
295 XVECEXP (p, 0, 2) = const0_rtx;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
296 ASSERT_RTL_DUMP_EQ ("(parallel [\n"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
297 " (const_int 0) repeated x3\n"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
298 " ])",
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
299 p);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
300
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
301 XVECEXP (p, 0, 1) = const1_rtx;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
302 ASSERT_RTL_DUMP_EQ ("(parallel [\n"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
303 " (const_int 0)\n"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
304 " (const_int 1)\n"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
305 " (const_int 0)\n"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
306 " ])",
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
307 p);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
308 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
309
111
kono
parents:
diff changeset
310 /* Run all of the selftests within this file. */
kono
parents:
diff changeset
311
kono
parents:
diff changeset
312 void
kono
parents:
diff changeset
313 rtl_tests_c_tests ()
kono
parents:
diff changeset
314 {
kono
parents:
diff changeset
315 test_dumping_regs ();
kono
parents:
diff changeset
316 test_dumping_insns ();
kono
parents:
diff changeset
317 test_dumping_rtx_reuse ();
kono
parents:
diff changeset
318 test_single_set ();
kono
parents:
diff changeset
319 test_uncond_jump ();
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
320 const_poly_int_tests<NUM_POLY_INT_COEFFS>::run ();
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
321 test_dumping_repeat ();
111
kono
parents:
diff changeset
322
kono
parents:
diff changeset
323 /* Purge state. */
kono
parents:
diff changeset
324 set_first_insn (NULL);
kono
parents:
diff changeset
325 set_last_insn (NULL);
kono
parents:
diff changeset
326 }
kono
parents:
diff changeset
327
kono
parents:
diff changeset
328 } // namespace selftest
kono
parents:
diff changeset
329 #endif /* #if CHECKING_P */