Mercurial > hg > CbC > CbC_gcc
comparison gcc/dojump.c @ 63:b7f97abdc517 gcc-4.6-20100522
update gcc from gcc-4.5.0 to gcc-4.6
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 24 May 2010 12:47:05 +0900 |
parents | 77e2b8dfacca |
children | 04ced10e8804 |
comparison
equal
deleted
inserted
replaced
56:3c8a44c06a95 | 63:b7f97abdc517 |
---|---|
1 /* Convert tree expression to rtl instructions, for GNU compiler. | 1 /* Convert tree expression to rtl instructions, for GNU compiler. |
2 Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, | 2 Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
3 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 | 3 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 |
4 Free Software Foundation, Inc. | 4 Free Software Foundation, Inc. |
5 | 5 |
6 This file is part of GCC. | 6 This file is part of GCC. |
7 | 7 |
8 GCC is free software; you can redistribute it and/or modify it under | 8 GCC is free software; you can redistribute it and/or modify it under |
33 #include "expr.h" | 33 #include "expr.h" |
34 #include "optabs.h" | 34 #include "optabs.h" |
35 #include "langhooks.h" | 35 #include "langhooks.h" |
36 #include "ggc.h" | 36 #include "ggc.h" |
37 #include "basic-block.h" | 37 #include "basic-block.h" |
38 #include "output.h" | |
38 | 39 |
39 static bool prefer_and_bit_test (enum machine_mode, int); | 40 static bool prefer_and_bit_test (enum machine_mode, int); |
40 static void do_jump_by_parts_greater (tree, tree, int, rtx, rtx); | 41 static void do_jump_by_parts_greater (tree, tree, int, rtx, rtx, int); |
41 static void do_jump_by_parts_equality (tree, tree, rtx, rtx); | 42 static void do_jump_by_parts_equality (tree, tree, rtx, rtx, int); |
42 static void do_compare_and_jump (tree, tree, enum rtx_code, enum rtx_code, rtx, | 43 static void do_compare_and_jump (tree, tree, enum rtx_code, enum rtx_code, rtx, |
43 rtx); | 44 rtx, int); |
45 | |
46 /* Invert probability if there is any. -1 stands for unknown. */ | |
47 | |
48 static inline int | |
49 inv (int prob) | |
50 { | |
51 return prob == -1 ? -1 : REG_BR_PROB_BASE - prob; | |
52 } | |
44 | 53 |
45 /* At the start of a function, record that we have no previously-pushed | 54 /* At the start of a function, record that we have no previously-pushed |
46 arguments waiting to be popped. */ | 55 arguments waiting to be popped. */ |
47 | 56 |
48 void | 57 void |
94 /* Generate code to evaluate EXP and jump to LABEL if the value is zero. | 103 /* Generate code to evaluate EXP and jump to LABEL if the value is zero. |
95 LABEL is an rtx of code CODE_LABEL, in this function and all the | 104 LABEL is an rtx of code CODE_LABEL, in this function and all the |
96 functions here. */ | 105 functions here. */ |
97 | 106 |
98 void | 107 void |
99 jumpifnot (tree exp, rtx label) | 108 jumpifnot (tree exp, rtx label, int prob) |
100 { | 109 { |
101 do_jump (exp, label, NULL_RTX); | 110 do_jump (exp, label, NULL_RTX, inv (prob)); |
102 } | 111 } |
103 | 112 |
104 void | 113 void |
105 jumpifnot_1 (enum tree_code code, tree op0, tree op1, rtx label) | 114 jumpifnot_1 (enum tree_code code, tree op0, tree op1, rtx label, int prob) |
106 { | 115 { |
107 do_jump_1 (code, op0, op1, label, NULL_RTX); | 116 do_jump_1 (code, op0, op1, label, NULL_RTX, inv (prob)); |
108 } | 117 } |
109 | 118 |
110 /* Generate code to evaluate EXP and jump to LABEL if the value is nonzero. */ | 119 /* Generate code to evaluate EXP and jump to LABEL if the value is nonzero. */ |
111 | 120 |
112 void | 121 void |
113 jumpif (tree exp, rtx label) | 122 jumpif (tree exp, rtx label, int prob) |
114 { | 123 { |
115 do_jump (exp, NULL_RTX, label); | 124 do_jump (exp, NULL_RTX, label, prob); |
116 } | 125 } |
117 | 126 |
118 void | 127 void |
119 jumpif_1 (enum tree_code code, tree op0, tree op1, rtx label) | 128 jumpif_1 (enum tree_code code, tree op0, tree op1, rtx label, int prob) |
120 { | 129 { |
121 do_jump_1 (code, op0, op1, NULL_RTX, label); | 130 do_jump_1 (code, op0, op1, NULL_RTX, label, prob); |
122 } | 131 } |
123 | 132 |
124 /* Used internally by prefer_and_bit_test. */ | 133 /* Used internally by prefer_and_bit_test. */ |
125 | 134 |
126 static GTY(()) rtx and_reg; | 135 static GTY(()) rtx and_reg; |
152 PUT_MODE (XEXP (shift_test, 0), mode); | 161 PUT_MODE (XEXP (shift_test, 0), mode); |
153 } | 162 } |
154 | 163 |
155 /* Fill in the integers. */ | 164 /* Fill in the integers. */ |
156 XEXP (and_test, 1) | 165 XEXP (and_test, 1) |
157 = immed_double_const ((unsigned HOST_WIDE_INT) 1 << bitnum, 0, mode); | 166 = immed_double_int_const (double_int_setbit (double_int_zero, bitnum), |
167 mode); | |
158 XEXP (XEXP (shift_test, 0), 1) = GEN_INT (bitnum); | 168 XEXP (XEXP (shift_test, 0), 1) = GEN_INT (bitnum); |
159 | 169 |
160 return (rtx_cost (and_test, IF_THEN_ELSE, optimize_insn_for_speed_p ()) | 170 return (rtx_cost (and_test, IF_THEN_ELSE, optimize_insn_for_speed_p ()) |
161 <= rtx_cost (shift_test, IF_THEN_ELSE, optimize_insn_for_speed_p ())); | 171 <= rtx_cost (shift_test, IF_THEN_ELSE, optimize_insn_for_speed_p ())); |
162 } | 172 } |
163 | 173 |
164 /* Subroutine of do_jump, dealing with exploded comparisons of the type | 174 /* Subroutine of do_jump, dealing with exploded comparisons of the type |
165 OP0 CODE OP1 . IF_FALSE_LABEL and IF_TRUE_LABEL like in do_jump. */ | 175 OP0 CODE OP1 . IF_FALSE_LABEL and IF_TRUE_LABEL like in do_jump. |
176 PROB is probability of jump to if_true_label, or -1 if unknown. */ | |
166 | 177 |
167 void | 178 void |
168 do_jump_1 (enum tree_code code, tree op0, tree op1, | 179 do_jump_1 (enum tree_code code, tree op0, tree op1, |
169 rtx if_false_label, rtx if_true_label) | 180 rtx if_false_label, rtx if_true_label, int prob) |
170 { | 181 { |
171 enum machine_mode mode; | 182 enum machine_mode mode; |
172 rtx drop_through_label = 0; | 183 rtx drop_through_label = 0; |
173 | 184 |
174 switch (code) | 185 switch (code) |
181 != MODE_COMPLEX_FLOAT); | 192 != MODE_COMPLEX_FLOAT); |
182 gcc_assert (GET_MODE_CLASS (TYPE_MODE (inner_type)) | 193 gcc_assert (GET_MODE_CLASS (TYPE_MODE (inner_type)) |
183 != MODE_COMPLEX_INT); | 194 != MODE_COMPLEX_INT); |
184 | 195 |
185 if (integer_zerop (op1)) | 196 if (integer_zerop (op1)) |
186 do_jump (op0, if_true_label, if_false_label); | 197 do_jump (op0, if_true_label, if_false_label, inv (prob)); |
187 else if (GET_MODE_CLASS (TYPE_MODE (inner_type)) == MODE_INT | 198 else if (GET_MODE_CLASS (TYPE_MODE (inner_type)) == MODE_INT |
188 && !can_compare_p (EQ, TYPE_MODE (inner_type), ccp_jump)) | 199 && !can_compare_p (EQ, TYPE_MODE (inner_type), ccp_jump)) |
189 do_jump_by_parts_equality (op0, op1, if_false_label, if_true_label); | 200 do_jump_by_parts_equality (op0, op1, if_false_label, if_true_label, |
201 prob); | |
190 else | 202 else |
191 do_compare_and_jump (op0, op1, EQ, EQ, if_false_label, if_true_label); | 203 do_compare_and_jump (op0, op1, EQ, EQ, if_false_label, if_true_label, |
204 prob); | |
192 break; | 205 break; |
193 } | 206 } |
194 | 207 |
195 case NE_EXPR: | 208 case NE_EXPR: |
196 { | 209 { |
200 != MODE_COMPLEX_FLOAT); | 213 != MODE_COMPLEX_FLOAT); |
201 gcc_assert (GET_MODE_CLASS (TYPE_MODE (inner_type)) | 214 gcc_assert (GET_MODE_CLASS (TYPE_MODE (inner_type)) |
202 != MODE_COMPLEX_INT); | 215 != MODE_COMPLEX_INT); |
203 | 216 |
204 if (integer_zerop (op1)) | 217 if (integer_zerop (op1)) |
205 do_jump (op0, if_false_label, if_true_label); | 218 do_jump (op0, if_false_label, if_true_label, prob); |
206 else if (GET_MODE_CLASS (TYPE_MODE (inner_type)) == MODE_INT | 219 else if (GET_MODE_CLASS (TYPE_MODE (inner_type)) == MODE_INT |
207 && !can_compare_p (NE, TYPE_MODE (inner_type), ccp_jump)) | 220 && !can_compare_p (NE, TYPE_MODE (inner_type), ccp_jump)) |
208 do_jump_by_parts_equality (op0, op1, if_true_label, if_false_label); | 221 do_jump_by_parts_equality (op0, op1, if_true_label, if_false_label, |
222 inv (prob)); | |
209 else | 223 else |
210 do_compare_and_jump (op0, op1, NE, NE, if_false_label, if_true_label); | 224 do_compare_and_jump (op0, op1, NE, NE, if_false_label, if_true_label, |
225 prob); | |
211 break; | 226 break; |
212 } | 227 } |
213 | 228 |
214 case LT_EXPR: | 229 case LT_EXPR: |
215 mode = TYPE_MODE (TREE_TYPE (op0)); | 230 mode = TYPE_MODE (TREE_TYPE (op0)); |
216 if (GET_MODE_CLASS (mode) == MODE_INT | 231 if (GET_MODE_CLASS (mode) == MODE_INT |
217 && ! can_compare_p (LT, mode, ccp_jump)) | 232 && ! can_compare_p (LT, mode, ccp_jump)) |
218 do_jump_by_parts_greater (op0, op1, 1, if_false_label, if_true_label); | 233 do_jump_by_parts_greater (op0, op1, 1, if_false_label, if_true_label, |
234 prob); | |
219 else | 235 else |
220 do_compare_and_jump (op0, op1, LT, LTU, if_false_label, if_true_label); | 236 do_compare_and_jump (op0, op1, LT, LTU, if_false_label, if_true_label, |
237 prob); | |
221 break; | 238 break; |
222 | 239 |
223 case LE_EXPR: | 240 case LE_EXPR: |
224 mode = TYPE_MODE (TREE_TYPE (op0)); | 241 mode = TYPE_MODE (TREE_TYPE (op0)); |
225 if (GET_MODE_CLASS (mode) == MODE_INT | 242 if (GET_MODE_CLASS (mode) == MODE_INT |
226 && ! can_compare_p (LE, mode, ccp_jump)) | 243 && ! can_compare_p (LE, mode, ccp_jump)) |
227 do_jump_by_parts_greater (op0, op1, 0, if_true_label, if_false_label); | 244 do_jump_by_parts_greater (op0, op1, 0, if_true_label, if_false_label, |
245 inv (prob)); | |
228 else | 246 else |
229 do_compare_and_jump (op0, op1, LE, LEU, if_false_label, if_true_label); | 247 do_compare_and_jump (op0, op1, LE, LEU, if_false_label, if_true_label, |
248 prob); | |
230 break; | 249 break; |
231 | 250 |
232 case GT_EXPR: | 251 case GT_EXPR: |
233 mode = TYPE_MODE (TREE_TYPE (op0)); | 252 mode = TYPE_MODE (TREE_TYPE (op0)); |
234 if (GET_MODE_CLASS (mode) == MODE_INT | 253 if (GET_MODE_CLASS (mode) == MODE_INT |
235 && ! can_compare_p (GT, mode, ccp_jump)) | 254 && ! can_compare_p (GT, mode, ccp_jump)) |
236 do_jump_by_parts_greater (op0, op1, 0, if_false_label, if_true_label); | 255 do_jump_by_parts_greater (op0, op1, 0, if_false_label, if_true_label, |
256 prob); | |
237 else | 257 else |
238 do_compare_and_jump (op0, op1, GT, GTU, if_false_label, if_true_label); | 258 do_compare_and_jump (op0, op1, GT, GTU, if_false_label, if_true_label, |
259 prob); | |
239 break; | 260 break; |
240 | 261 |
241 case GE_EXPR: | 262 case GE_EXPR: |
242 mode = TYPE_MODE (TREE_TYPE (op0)); | 263 mode = TYPE_MODE (TREE_TYPE (op0)); |
243 if (GET_MODE_CLASS (mode) == MODE_INT | 264 if (GET_MODE_CLASS (mode) == MODE_INT |
244 && ! can_compare_p (GE, mode, ccp_jump)) | 265 && ! can_compare_p (GE, mode, ccp_jump)) |
245 do_jump_by_parts_greater (op0, op1, 1, if_true_label, if_false_label); | 266 do_jump_by_parts_greater (op0, op1, 1, if_true_label, if_false_label, |
267 inv (prob)); | |
246 else | 268 else |
247 do_compare_and_jump (op0, op1, GE, GEU, if_false_label, if_true_label); | 269 do_compare_and_jump (op0, op1, GE, GEU, if_false_label, if_true_label, |
270 prob); | |
248 break; | 271 break; |
249 | 272 |
250 case ORDERED_EXPR: | 273 case ORDERED_EXPR: |
251 do_compare_and_jump (op0, op1, ORDERED, ORDERED, | 274 do_compare_and_jump (op0, op1, ORDERED, ORDERED, |
252 if_false_label, if_true_label); | 275 if_false_label, if_true_label, prob); |
253 break; | 276 break; |
254 | 277 |
255 case UNORDERED_EXPR: | 278 case UNORDERED_EXPR: |
256 do_compare_and_jump (op0, op1, UNORDERED, UNORDERED, | 279 do_compare_and_jump (op0, op1, UNORDERED, UNORDERED, |
257 if_false_label, if_true_label); | 280 if_false_label, if_true_label, prob); |
258 break; | 281 break; |
259 | 282 |
260 case UNLT_EXPR: | 283 case UNLT_EXPR: |
261 do_compare_and_jump (op0, op1, UNLT, UNLT, if_false_label, if_true_label); | 284 do_compare_and_jump (op0, op1, UNLT, UNLT, if_false_label, if_true_label, |
285 prob); | |
262 break; | 286 break; |
263 | 287 |
264 case UNLE_EXPR: | 288 case UNLE_EXPR: |
265 do_compare_and_jump (op0, op1, UNLE, UNLE, if_false_label, if_true_label); | 289 do_compare_and_jump (op0, op1, UNLE, UNLE, if_false_label, if_true_label, |
290 prob); | |
266 break; | 291 break; |
267 | 292 |
268 case UNGT_EXPR: | 293 case UNGT_EXPR: |
269 do_compare_and_jump (op0, op1, UNGT, UNGT, if_false_label, if_true_label); | 294 do_compare_and_jump (op0, op1, UNGT, UNGT, if_false_label, if_true_label, |
295 prob); | |
270 break; | 296 break; |
271 | 297 |
272 case UNGE_EXPR: | 298 case UNGE_EXPR: |
273 do_compare_and_jump (op0, op1, UNGE, UNGE, if_false_label, if_true_label); | 299 do_compare_and_jump (op0, op1, UNGE, UNGE, if_false_label, if_true_label, |
300 prob); | |
274 break; | 301 break; |
275 | 302 |
276 case UNEQ_EXPR: | 303 case UNEQ_EXPR: |
277 do_compare_and_jump (op0, op1, UNEQ, UNEQ, if_false_label, if_true_label); | 304 do_compare_and_jump (op0, op1, UNEQ, UNEQ, if_false_label, if_true_label, |
305 prob); | |
278 break; | 306 break; |
279 | 307 |
280 case LTGT_EXPR: | 308 case LTGT_EXPR: |
281 do_compare_and_jump (op0, op1, LTGT, LTGT, if_false_label, if_true_label); | 309 do_compare_and_jump (op0, op1, LTGT, LTGT, if_false_label, if_true_label, |
310 prob); | |
282 break; | 311 break; |
283 | 312 |
284 case TRUTH_ANDIF_EXPR: | 313 case TRUTH_ANDIF_EXPR: |
285 if (if_false_label == NULL_RTX) | 314 if (if_false_label == NULL_RTX) |
286 { | 315 { |
287 drop_through_label = gen_label_rtx (); | 316 drop_through_label = gen_label_rtx (); |
288 do_jump (op0, drop_through_label, NULL_RTX); | 317 do_jump (op0, drop_through_label, NULL_RTX, prob); |
289 do_jump (op1, NULL_RTX, if_true_label); | 318 do_jump (op1, NULL_RTX, if_true_label, prob); |
290 } | 319 } |
291 else | 320 else |
292 { | 321 { |
293 do_jump (op0, if_false_label, NULL_RTX); | 322 do_jump (op0, if_false_label, NULL_RTX, prob); |
294 do_jump (op1, if_false_label, if_true_label); | 323 do_jump (op1, if_false_label, if_true_label, prob); |
295 } | 324 } |
296 break; | 325 break; |
297 | 326 |
298 case TRUTH_ORIF_EXPR: | 327 case TRUTH_ORIF_EXPR: |
299 if (if_true_label == NULL_RTX) | 328 if (if_true_label == NULL_RTX) |
300 { | 329 { |
301 drop_through_label = gen_label_rtx (); | 330 drop_through_label = gen_label_rtx (); |
302 do_jump (op0, NULL_RTX, drop_through_label); | 331 do_jump (op0, NULL_RTX, drop_through_label, prob); |
303 do_jump (op1, if_false_label, NULL_RTX); | 332 do_jump (op1, if_false_label, NULL_RTX, prob); |
304 } | 333 } |
305 else | 334 else |
306 { | 335 { |
307 do_jump (op0, NULL_RTX, if_true_label); | 336 do_jump (op0, NULL_RTX, if_true_label, prob); |
308 do_jump (op1, if_false_label, if_true_label); | 337 do_jump (op1, if_false_label, if_true_label, prob); |
309 } | 338 } |
310 break; | 339 break; |
311 | 340 |
312 default: | 341 default: |
313 gcc_unreachable (); | 342 gcc_unreachable (); |
325 Either of IF_FALSE_LABEL and IF_TRUE_LABEL may be zero, | 354 Either of IF_FALSE_LABEL and IF_TRUE_LABEL may be zero, |
326 meaning fall through in that case. | 355 meaning fall through in that case. |
327 | 356 |
328 do_jump always does any pending stack adjust except when it does not | 357 do_jump always does any pending stack adjust except when it does not |
329 actually perform a jump. An example where there is no jump | 358 actually perform a jump. An example where there is no jump |
330 is when EXP is `(foo (), 0)' and IF_FALSE_LABEL is null. */ | 359 is when EXP is `(foo (), 0)' and IF_FALSE_LABEL is null. |
360 | |
361 PROB is probability of jump to if_true_label, or -1 if unknown. */ | |
331 | 362 |
332 void | 363 void |
333 do_jump (tree exp, rtx if_false_label, rtx if_true_label) | 364 do_jump (tree exp, rtx if_false_label, rtx if_true_label, int prob) |
334 { | 365 { |
335 enum tree_code code = TREE_CODE (exp); | 366 enum tree_code code = TREE_CODE (exp); |
336 rtx temp; | 367 rtx temp; |
337 int i; | 368 int i; |
338 tree type; | 369 tree type; |
375 case ABS_EXPR: | 406 case ABS_EXPR: |
376 case NEGATE_EXPR: | 407 case NEGATE_EXPR: |
377 case LROTATE_EXPR: | 408 case LROTATE_EXPR: |
378 case RROTATE_EXPR: | 409 case RROTATE_EXPR: |
379 /* These cannot change zero->nonzero or vice versa. */ | 410 /* These cannot change zero->nonzero or vice versa. */ |
380 do_jump (TREE_OPERAND (exp, 0), if_false_label, if_true_label); | 411 do_jump (TREE_OPERAND (exp, 0), if_false_label, if_true_label, prob); |
381 break; | 412 break; |
382 | 413 |
383 case TRUTH_NOT_EXPR: | 414 case TRUTH_NOT_EXPR: |
384 do_jump (TREE_OPERAND (exp, 0), if_true_label, if_false_label); | 415 do_jump (TREE_OPERAND (exp, 0), if_true_label, if_false_label, |
416 inv (prob)); | |
385 break; | 417 break; |
386 | 418 |
387 case COND_EXPR: | 419 case COND_EXPR: |
388 { | 420 { |
389 rtx label1 = gen_label_rtx (); | 421 rtx label1 = gen_label_rtx (); |
395 if (!if_false_label) | 427 if (!if_false_label) |
396 if_false_label = drop_through_label; | 428 if_false_label = drop_through_label; |
397 } | 429 } |
398 | 430 |
399 do_pending_stack_adjust (); | 431 do_pending_stack_adjust (); |
400 do_jump (TREE_OPERAND (exp, 0), label1, NULL_RTX); | 432 do_jump (TREE_OPERAND (exp, 0), label1, NULL_RTX, -1); |
401 do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label); | 433 do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label, prob); |
402 emit_label (label1); | 434 emit_label (label1); |
403 do_jump (TREE_OPERAND (exp, 2), if_false_label, if_true_label); | 435 do_jump (TREE_OPERAND (exp, 2), if_false_label, if_true_label, prob); |
404 break; | 436 break; |
405 } | 437 } |
406 | 438 |
407 case COMPOUND_EXPR: | 439 case COMPOUND_EXPR: |
408 /* Lowered by gimplify.c. */ | 440 /* Lowered by gimplify.c. */ |
429 if (! SLOW_BYTE_ACCESS | 461 if (! SLOW_BYTE_ACCESS |
430 && type != 0 && bitsize >= 0 | 462 && type != 0 && bitsize >= 0 |
431 && TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (exp)) | 463 && TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (exp)) |
432 && have_insn_for (COMPARE, TYPE_MODE (type))) | 464 && have_insn_for (COMPARE, TYPE_MODE (type))) |
433 { | 465 { |
434 do_jump (fold_convert (type, exp), if_false_label, if_true_label); | 466 do_jump (fold_convert (type, exp), if_false_label, if_true_label, |
467 prob); | |
435 break; | 468 break; |
436 } | 469 } |
437 goto normal; | 470 goto normal; |
438 } | 471 } |
439 | 472 |
458 case LTGT_EXPR: | 491 case LTGT_EXPR: |
459 case TRUTH_ANDIF_EXPR: | 492 case TRUTH_ANDIF_EXPR: |
460 case TRUTH_ORIF_EXPR: | 493 case TRUTH_ORIF_EXPR: |
461 other_code: | 494 other_code: |
462 do_jump_1 (code, TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1), | 495 do_jump_1 (code, TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1), |
463 if_false_label, if_true_label); | 496 if_false_label, if_true_label, prob); |
464 break; | 497 break; |
465 | 498 |
466 case BIT_AND_EXPR: | 499 case BIT_AND_EXPR: |
467 /* fold_single_bit_test() converts (X & (1 << C)) into (X >> C) & 1. | 500 /* fold_single_bit_test() converts (X & (1 << C)) into (X >> C) & 1. |
468 See if the former is preferred for jump tests and restore it | 501 See if the former is preferred for jump tests and restore it |
469 if so. */ | 502 if so. */ |
470 if (integer_onep (TREE_OPERAND (exp, 1))) | 503 if (integer_onep (TREE_OPERAND (exp, 1))) |
471 { | 504 { |
472 tree exp0 = TREE_OPERAND (exp, 0); | 505 tree exp0 = TREE_OPERAND (exp, 0); |
473 rtx set_label, clr_label; | 506 rtx set_label, clr_label; |
507 int setclr_prob = prob; | |
474 | 508 |
475 /* Strip narrowing integral type conversions. */ | 509 /* Strip narrowing integral type conversions. */ |
476 while (CONVERT_EXPR_P (exp0) | 510 while (CONVERT_EXPR_P (exp0) |
477 && TREE_OPERAND (exp0, 0) != error_mark_node | 511 && TREE_OPERAND (exp0, 0) != error_mark_node |
478 && TYPE_PRECISION (TREE_TYPE (exp0)) | 512 && TYPE_PRECISION (TREE_TYPE (exp0)) |
484 && integer_onep (TREE_OPERAND (exp0, 1))) | 518 && integer_onep (TREE_OPERAND (exp0, 1))) |
485 { | 519 { |
486 exp0 = TREE_OPERAND (exp0, 0); | 520 exp0 = TREE_OPERAND (exp0, 0); |
487 clr_label = if_true_label; | 521 clr_label = if_true_label; |
488 set_label = if_false_label; | 522 set_label = if_false_label; |
523 setclr_prob = inv (prob); | |
489 } | 524 } |
490 else | 525 else |
491 { | 526 { |
492 clr_label = if_false_label; | 527 clr_label = if_false_label; |
493 set_label = if_true_label; | 528 set_label = if_true_label; |
505 TREE_INT_CST_LOW (shift))) | 540 TREE_INT_CST_LOW (shift))) |
506 { | 541 { |
507 unsigned HOST_WIDE_INT mask | 542 unsigned HOST_WIDE_INT mask |
508 = (unsigned HOST_WIDE_INT) 1 << TREE_INT_CST_LOW (shift); | 543 = (unsigned HOST_WIDE_INT) 1 << TREE_INT_CST_LOW (shift); |
509 do_jump (build2 (BIT_AND_EXPR, argtype, arg, | 544 do_jump (build2 (BIT_AND_EXPR, argtype, arg, |
510 build_int_cst_wide_type (argtype, mask, 0)), | 545 build_int_cstu (argtype, mask)), |
511 clr_label, set_label); | 546 clr_label, set_label, setclr_prob); |
512 break; | 547 break; |
513 } | 548 } |
514 } | 549 } |
515 } | 550 } |
516 | 551 |
528 && (mode = mode_for_size (i + 1, MODE_INT, 0)) != BLKmode | 563 && (mode = mode_for_size (i + 1, MODE_INT, 0)) != BLKmode |
529 && (type = lang_hooks.types.type_for_mode (mode, 1)) != 0 | 564 && (type = lang_hooks.types.type_for_mode (mode, 1)) != 0 |
530 && TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (exp)) | 565 && TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (exp)) |
531 && have_insn_for (COMPARE, TYPE_MODE (type))) | 566 && have_insn_for (COMPARE, TYPE_MODE (type))) |
532 { | 567 { |
533 do_jump (fold_convert (type, exp), if_false_label, if_true_label); | 568 do_jump (fold_convert (type, exp), if_false_label, if_true_label, |
569 prob); | |
534 break; | 570 break; |
535 } | 571 } |
536 | 572 |
537 if (TYPE_PRECISION (TREE_TYPE (exp)) > 1 | 573 if (TYPE_PRECISION (TREE_TYPE (exp)) > 1 |
538 || TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST) | 574 || TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST) |
554 case BIT_IOR_EXPR: | 590 case BIT_IOR_EXPR: |
555 case TRUTH_OR_EXPR: | 591 case TRUTH_OR_EXPR: |
556 /* High branch cost, expand as the bitwise OR of the conditions. | 592 /* High branch cost, expand as the bitwise OR of the conditions. |
557 Do the same if the RHS has side effects, because we're effectively | 593 Do the same if the RHS has side effects, because we're effectively |
558 turning a TRUTH_OR_EXPR into a TRUTH_ORIF_EXPR. */ | 594 turning a TRUTH_OR_EXPR into a TRUTH_ORIF_EXPR. */ |
559 if (BRANCH_COST (optimize_insn_for_speed_p (), false)>= 4 | 595 if (BRANCH_COST (optimize_insn_for_speed_p (), false) >= 4 |
560 || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1))) | 596 || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1))) |
561 goto normal; | 597 goto normal; |
562 code = TRUTH_ORIF_EXPR; | 598 code = TRUTH_ORIF_EXPR; |
563 goto other_code; | 599 goto other_code; |
564 | 600 |
578 temp = copy_to_reg (temp); | 614 temp = copy_to_reg (temp); |
579 } | 615 } |
580 do_compare_rtx_and_jump (temp, CONST0_RTX (GET_MODE (temp)), | 616 do_compare_rtx_and_jump (temp, CONST0_RTX (GET_MODE (temp)), |
581 NE, TYPE_UNSIGNED (TREE_TYPE (exp)), | 617 NE, TYPE_UNSIGNED (TREE_TYPE (exp)), |
582 GET_MODE (temp), NULL_RTX, | 618 GET_MODE (temp), NULL_RTX, |
583 if_false_label, if_true_label); | 619 if_false_label, if_true_label, prob); |
584 } | 620 } |
585 | 621 |
586 if (drop_through_label) | 622 if (drop_through_label) |
587 { | 623 { |
588 do_pending_stack_adjust (); | 624 do_pending_stack_adjust (); |
594 UNSIGNEDP says to do unsigned comparison. | 630 UNSIGNEDP says to do unsigned comparison. |
595 Jump to IF_TRUE_LABEL if OP0 is greater, IF_FALSE_LABEL otherwise. */ | 631 Jump to IF_TRUE_LABEL if OP0 is greater, IF_FALSE_LABEL otherwise. */ |
596 | 632 |
597 static void | 633 static void |
598 do_jump_by_parts_greater_rtx (enum machine_mode mode, int unsignedp, rtx op0, | 634 do_jump_by_parts_greater_rtx (enum machine_mode mode, int unsignedp, rtx op0, |
599 rtx op1, rtx if_false_label, rtx if_true_label) | 635 rtx op1, rtx if_false_label, rtx if_true_label, |
636 int prob) | |
600 { | 637 { |
601 int nwords = (GET_MODE_SIZE (mode) / UNITS_PER_WORD); | 638 int nwords = (GET_MODE_SIZE (mode) / UNITS_PER_WORD); |
602 rtx drop_through_label = 0; | 639 rtx drop_through_label = 0; |
603 int i; | 640 int i; |
604 | 641 |
626 } | 663 } |
627 | 664 |
628 /* All but high-order word must be compared as unsigned. */ | 665 /* All but high-order word must be compared as unsigned. */ |
629 do_compare_rtx_and_jump (op0_word, op1_word, GT, | 666 do_compare_rtx_and_jump (op0_word, op1_word, GT, |
630 (unsignedp || i > 0), word_mode, NULL_RTX, | 667 (unsignedp || i > 0), word_mode, NULL_RTX, |
631 NULL_RTX, if_true_label); | 668 NULL_RTX, if_true_label, prob); |
632 | 669 |
633 /* Consider lower words only if these are equal. */ | 670 /* Consider lower words only if these are equal. */ |
634 do_compare_rtx_and_jump (op0_word, op1_word, NE, unsignedp, word_mode, | 671 do_compare_rtx_and_jump (op0_word, op1_word, NE, unsignedp, word_mode, |
635 NULL_RTX, NULL_RTX, if_false_label); | 672 NULL_RTX, NULL_RTX, if_false_label, |
673 inv (prob)); | |
636 } | 674 } |
637 | 675 |
638 if (if_false_label) | 676 if (if_false_label) |
639 emit_jump (if_false_label); | 677 emit_jump (if_false_label); |
640 if (drop_through_label) | 678 if (drop_through_label) |
646 The code of EXP is ignored; we always test GT if SWAP is 0, | 684 The code of EXP is ignored; we always test GT if SWAP is 0, |
647 and LT if SWAP is 1. */ | 685 and LT if SWAP is 1. */ |
648 | 686 |
649 static void | 687 static void |
650 do_jump_by_parts_greater (tree treeop0, tree treeop1, int swap, | 688 do_jump_by_parts_greater (tree treeop0, tree treeop1, int swap, |
651 rtx if_false_label, rtx if_true_label) | 689 rtx if_false_label, rtx if_true_label, int prob) |
652 { | 690 { |
653 rtx op0 = expand_normal (swap ? treeop1 : treeop0); | 691 rtx op0 = expand_normal (swap ? treeop1 : treeop0); |
654 rtx op1 = expand_normal (swap ? treeop0 : treeop1); | 692 rtx op1 = expand_normal (swap ? treeop0 : treeop1); |
655 enum machine_mode mode = TYPE_MODE (TREE_TYPE (treeop0)); | 693 enum machine_mode mode = TYPE_MODE (TREE_TYPE (treeop0)); |
656 int unsignedp = TYPE_UNSIGNED (TREE_TYPE (treeop0)); | 694 int unsignedp = TYPE_UNSIGNED (TREE_TYPE (treeop0)); |
657 | 695 |
658 do_jump_by_parts_greater_rtx (mode, unsignedp, op0, op1, if_false_label, | 696 do_jump_by_parts_greater_rtx (mode, unsignedp, op0, op1, if_false_label, |
659 if_true_label); | 697 if_true_label, prob); |
660 } | 698 } |
661 | 699 |
662 /* Jump according to whether OP0 is 0. We assume that OP0 has an integer | 700 /* Jump according to whether OP0 is 0. We assume that OP0 has an integer |
663 mode, MODE, that is too wide for the available compare insns. Either | 701 mode, MODE, that is too wide for the available compare insns. Either |
664 Either (but not both) of IF_TRUE_LABEL and IF_FALSE_LABEL may be NULL_RTX | 702 Either (but not both) of IF_TRUE_LABEL and IF_FALSE_LABEL may be NULL_RTX |
665 to indicate drop through. */ | 703 to indicate drop through. */ |
666 | 704 |
667 static void | 705 static void |
668 do_jump_by_parts_zero_rtx (enum machine_mode mode, rtx op0, | 706 do_jump_by_parts_zero_rtx (enum machine_mode mode, rtx op0, |
669 rtx if_false_label, rtx if_true_label) | 707 rtx if_false_label, rtx if_true_label, int prob) |
670 { | 708 { |
671 int nwords = GET_MODE_SIZE (mode) / UNITS_PER_WORD; | 709 int nwords = GET_MODE_SIZE (mode) / UNITS_PER_WORD; |
672 rtx part; | 710 rtx part; |
673 int i; | 711 int i; |
674 rtx drop_through_label = 0; | 712 rtx drop_through_label = 0; |
686 part, 1, OPTAB_WIDEN); | 724 part, 1, OPTAB_WIDEN); |
687 | 725 |
688 if (part != 0) | 726 if (part != 0) |
689 { | 727 { |
690 do_compare_rtx_and_jump (part, const0_rtx, EQ, 1, word_mode, | 728 do_compare_rtx_and_jump (part, const0_rtx, EQ, 1, word_mode, |
691 NULL_RTX, if_false_label, if_true_label); | 729 NULL_RTX, if_false_label, if_true_label, prob); |
692 | |
693 return; | 730 return; |
694 } | 731 } |
695 | 732 |
696 /* If we couldn't do the "or" simply, do this with a series of compares. */ | 733 /* If we couldn't do the "or" simply, do this with a series of compares. */ |
697 if (! if_false_label) | 734 if (! if_false_label) |
698 drop_through_label = if_false_label = gen_label_rtx (); | 735 drop_through_label = if_false_label = gen_label_rtx (); |
699 | 736 |
700 for (i = 0; i < nwords; i++) | 737 for (i = 0; i < nwords; i++) |
701 do_compare_rtx_and_jump (operand_subword_force (op0, i, mode), | 738 do_compare_rtx_and_jump (operand_subword_force (op0, i, mode), |
702 const0_rtx, EQ, 1, word_mode, NULL_RTX, | 739 const0_rtx, EQ, 1, word_mode, NULL_RTX, |
703 if_false_label, NULL_RTX); | 740 if_false_label, NULL_RTX, prob); |
704 | 741 |
705 if (if_true_label) | 742 if (if_true_label) |
706 emit_jump (if_true_label); | 743 emit_jump (if_true_label); |
707 | 744 |
708 if (drop_through_label) | 745 if (drop_through_label) |
714 Either (but not both) of IF_TRUE_LABEL and IF_FALSE_LABEL may be NULL_RTX | 751 Either (but not both) of IF_TRUE_LABEL and IF_FALSE_LABEL may be NULL_RTX |
715 to indicate drop through. */ | 752 to indicate drop through. */ |
716 | 753 |
717 static void | 754 static void |
718 do_jump_by_parts_equality_rtx (enum machine_mode mode, rtx op0, rtx op1, | 755 do_jump_by_parts_equality_rtx (enum machine_mode mode, rtx op0, rtx op1, |
719 rtx if_false_label, rtx if_true_label) | 756 rtx if_false_label, rtx if_true_label, int prob) |
720 { | 757 { |
721 int nwords = (GET_MODE_SIZE (mode) / UNITS_PER_WORD); | 758 int nwords = (GET_MODE_SIZE (mode) / UNITS_PER_WORD); |
722 rtx drop_through_label = 0; | 759 rtx drop_through_label = 0; |
723 int i; | 760 int i; |
724 | 761 |
725 if (op1 == const0_rtx) | 762 if (op1 == const0_rtx) |
726 { | 763 { |
727 do_jump_by_parts_zero_rtx (mode, op0, if_false_label, if_true_label); | 764 do_jump_by_parts_zero_rtx (mode, op0, if_false_label, if_true_label, |
765 prob); | |
728 return; | 766 return; |
729 } | 767 } |
730 else if (op0 == const0_rtx) | 768 else if (op0 == const0_rtx) |
731 { | 769 { |
732 do_jump_by_parts_zero_rtx (mode, op1, if_false_label, if_true_label); | 770 do_jump_by_parts_zero_rtx (mode, op1, if_false_label, if_true_label, |
771 prob); | |
733 return; | 772 return; |
734 } | 773 } |
735 | 774 |
736 if (! if_false_label) | 775 if (! if_false_label) |
737 drop_through_label = if_false_label = gen_label_rtx (); | 776 drop_through_label = if_false_label = gen_label_rtx (); |
738 | 777 |
739 for (i = 0; i < nwords; i++) | 778 for (i = 0; i < nwords; i++) |
740 do_compare_rtx_and_jump (operand_subword_force (op0, i, mode), | 779 do_compare_rtx_and_jump (operand_subword_force (op0, i, mode), |
741 operand_subword_force (op1, i, mode), | 780 operand_subword_force (op1, i, mode), |
742 EQ, 0, word_mode, NULL_RTX, | 781 EQ, 0, word_mode, NULL_RTX, |
743 if_false_label, NULL_RTX); | 782 if_false_label, NULL_RTX, prob); |
744 | 783 |
745 if (if_true_label) | 784 if (if_true_label) |
746 emit_jump (if_true_label); | 785 emit_jump (if_true_label); |
747 if (drop_through_label) | 786 if (drop_through_label) |
748 emit_label (drop_through_label); | 787 emit_label (drop_through_label); |
751 /* Given an EQ_EXPR expression EXP for values too wide to be compared | 790 /* Given an EQ_EXPR expression EXP for values too wide to be compared |
752 with one insn, test the comparison and jump to the appropriate label. */ | 791 with one insn, test the comparison and jump to the appropriate label. */ |
753 | 792 |
754 static void | 793 static void |
755 do_jump_by_parts_equality (tree treeop0, tree treeop1, rtx if_false_label, | 794 do_jump_by_parts_equality (tree treeop0, tree treeop1, rtx if_false_label, |
756 rtx if_true_label) | 795 rtx if_true_label, int prob) |
757 { | 796 { |
758 rtx op0 = expand_normal (treeop0); | 797 rtx op0 = expand_normal (treeop0); |
759 rtx op1 = expand_normal (treeop1); | 798 rtx op1 = expand_normal (treeop1); |
760 enum machine_mode mode = TYPE_MODE (TREE_TYPE (treeop0)); | 799 enum machine_mode mode = TYPE_MODE (TREE_TYPE (treeop0)); |
761 do_jump_by_parts_equality_rtx (mode, op0, op1, if_false_label, | 800 do_jump_by_parts_equality_rtx (mode, op0, op1, if_false_label, |
762 if_true_label); | 801 if_true_label, prob); |
763 } | 802 } |
764 | 803 |
765 /* Split a comparison into two others, the second of which has the other | 804 /* Split a comparison into two others, the second of which has the other |
766 "orderedness". The first is always ORDERED or UNORDERED if MODE | 805 "orderedness". The first is always ORDERED or UNORDERED if MODE |
767 does not honor NaNs (which means that it can be skipped in that case; | 806 does not honor NaNs (which means that it can be skipped in that case; |
847 compared. */ | 886 compared. */ |
848 | 887 |
849 void | 888 void |
850 do_compare_rtx_and_jump (rtx op0, rtx op1, enum rtx_code code, int unsignedp, | 889 do_compare_rtx_and_jump (rtx op0, rtx op1, enum rtx_code code, int unsignedp, |
851 enum machine_mode mode, rtx size, rtx if_false_label, | 890 enum machine_mode mode, rtx size, rtx if_false_label, |
852 rtx if_true_label) | 891 rtx if_true_label, int prob) |
853 { | 892 { |
854 rtx tem; | 893 rtx tem; |
855 rtx dummy_label = NULL_RTX; | 894 rtx dummy_label = NULL_RTX; |
895 rtx last; | |
856 | 896 |
857 /* Reverse the comparison if that is safe and we want to jump if it is | 897 /* Reverse the comparison if that is safe and we want to jump if it is |
858 false. Also convert to the reverse comparison if the target can | 898 false. Also convert to the reverse comparison if the target can |
859 implement it. */ | 899 implement it. */ |
860 if ((! if_true_label | 900 if ((! if_true_label |
876 { | 916 { |
877 tem = if_true_label; | 917 tem = if_true_label; |
878 if_true_label = if_false_label; | 918 if_true_label = if_false_label; |
879 if_false_label = tem; | 919 if_false_label = tem; |
880 code = rcode; | 920 code = rcode; |
921 prob = inv (prob); | |
881 } | 922 } |
882 } | 923 } |
883 | 924 |
884 /* If one operand is constant, make it the second one. Only do this | 925 /* If one operand is constant, make it the second one. Only do this |
885 if the other operand is not constant as well. */ | 926 if the other operand is not constant as well. */ |
922 { | 963 { |
923 switch (code) | 964 switch (code) |
924 { | 965 { |
925 case LTU: | 966 case LTU: |
926 do_jump_by_parts_greater_rtx (mode, 1, op1, op0, | 967 do_jump_by_parts_greater_rtx (mode, 1, op1, op0, |
927 if_false_label, if_true_label); | 968 if_false_label, if_true_label, prob); |
928 break; | 969 break; |
929 | 970 |
930 case LEU: | 971 case LEU: |
931 do_jump_by_parts_greater_rtx (mode, 1, op0, op1, | 972 do_jump_by_parts_greater_rtx (mode, 1, op0, op1, |
932 if_true_label, if_false_label); | 973 if_true_label, if_false_label, |
974 inv (prob)); | |
933 break; | 975 break; |
934 | 976 |
935 case GTU: | 977 case GTU: |
936 do_jump_by_parts_greater_rtx (mode, 1, op0, op1, | 978 do_jump_by_parts_greater_rtx (mode, 1, op0, op1, |
937 if_false_label, if_true_label); | 979 if_false_label, if_true_label, prob); |
938 break; | 980 break; |
939 | 981 |
940 case GEU: | 982 case GEU: |
941 do_jump_by_parts_greater_rtx (mode, 1, op1, op0, | 983 do_jump_by_parts_greater_rtx (mode, 1, op1, op0, |
942 if_true_label, if_false_label); | 984 if_true_label, if_false_label, |
985 inv (prob)); | |
943 break; | 986 break; |
944 | 987 |
945 case LT: | 988 case LT: |
946 do_jump_by_parts_greater_rtx (mode, 0, op1, op0, | 989 do_jump_by_parts_greater_rtx (mode, 0, op1, op0, |
947 if_false_label, if_true_label); | 990 if_false_label, if_true_label, prob); |
948 break; | 991 break; |
949 | 992 |
950 case LE: | 993 case LE: |
951 do_jump_by_parts_greater_rtx (mode, 0, op0, op1, | 994 do_jump_by_parts_greater_rtx (mode, 0, op0, op1, |
952 if_true_label, if_false_label); | 995 if_true_label, if_false_label, |
996 inv (prob)); | |
953 break; | 997 break; |
954 | 998 |
955 case GT: | 999 case GT: |
956 do_jump_by_parts_greater_rtx (mode, 0, op0, op1, | 1000 do_jump_by_parts_greater_rtx (mode, 0, op0, op1, |
957 if_false_label, if_true_label); | 1001 if_false_label, if_true_label, prob); |
958 break; | 1002 break; |
959 | 1003 |
960 case GE: | 1004 case GE: |
961 do_jump_by_parts_greater_rtx (mode, 0, op1, op0, | 1005 do_jump_by_parts_greater_rtx (mode, 0, op1, op0, |
962 if_true_label, if_false_label); | 1006 if_true_label, if_false_label, |
1007 inv (prob)); | |
963 break; | 1008 break; |
964 | 1009 |
965 case EQ: | 1010 case EQ: |
966 do_jump_by_parts_equality_rtx (mode, op0, op1, if_false_label, | 1011 do_jump_by_parts_equality_rtx (mode, op0, op1, if_false_label, |
967 if_true_label); | 1012 if_true_label, prob); |
968 break; | 1013 break; |
969 | 1014 |
970 case NE: | 1015 case NE: |
971 do_jump_by_parts_equality_rtx (mode, op0, op1, if_true_label, | 1016 do_jump_by_parts_equality_rtx (mode, op0, op1, if_true_label, |
972 if_false_label); | 1017 if_false_label, inv (prob)); |
973 break; | 1018 break; |
974 | 1019 |
975 default: | 1020 default: |
976 gcc_unreachable (); | 1021 gcc_unreachable (); |
977 } | 1022 } |
1023 dest_label = dummy_label; | 1068 dest_label = dummy_label; |
1024 } | 1069 } |
1025 else | 1070 else |
1026 dest_label = if_false_label; | 1071 dest_label = if_false_label; |
1027 do_compare_rtx_and_jump (op0, op1, first_code, unsignedp, mode, | 1072 do_compare_rtx_and_jump (op0, op1, first_code, unsignedp, mode, |
1028 size, dest_label, NULL_RTX); | 1073 size, dest_label, NULL_RTX, prob); |
1029 } | 1074 } |
1030 else | 1075 else |
1031 do_compare_rtx_and_jump (op0, op1, first_code, unsignedp, mode, | 1076 do_compare_rtx_and_jump (op0, op1, first_code, unsignedp, mode, |
1032 size, NULL_RTX, if_true_label); | 1077 size, NULL_RTX, if_true_label, prob); |
1033 } | 1078 } |
1034 } | 1079 } |
1035 | 1080 |
1081 last = get_last_insn (); | |
1036 emit_cmp_and_jump_insns (op0, op1, code, size, mode, unsignedp, | 1082 emit_cmp_and_jump_insns (op0, op1, code, size, mode, unsignedp, |
1037 if_true_label); | 1083 if_true_label); |
1084 if (prob != -1 && profile_status != PROFILE_ABSENT) | |
1085 { | |
1086 for (last = NEXT_INSN (last); | |
1087 last && NEXT_INSN (last); | |
1088 last = NEXT_INSN (last)) | |
1089 if (JUMP_P (last)) | |
1090 break; | |
1091 if (!last | |
1092 || !JUMP_P (last) | |
1093 || NEXT_INSN (last) | |
1094 || !any_condjump_p (last)) | |
1095 { | |
1096 if (dump_file) | |
1097 fprintf (dump_file, "Failed to add probability note\n"); | |
1098 } | |
1099 else | |
1100 { | |
1101 gcc_assert (!find_reg_note (last, REG_BR_PROB, 0)); | |
1102 add_reg_note (last, REG_BR_PROB, GEN_INT (prob)); | |
1103 } | |
1104 } | |
1038 } | 1105 } |
1039 | 1106 |
1040 if (if_false_label) | 1107 if (if_false_label) |
1041 emit_jump (if_false_label); | 1108 emit_jump (if_false_label); |
1042 if (dummy_label) | 1109 if (dummy_label) |
1054 things pushed on the stack that aren't yet used. */ | 1121 things pushed on the stack that aren't yet used. */ |
1055 | 1122 |
1056 static void | 1123 static void |
1057 do_compare_and_jump (tree treeop0, tree treeop1, enum rtx_code signed_code, | 1124 do_compare_and_jump (tree treeop0, tree treeop1, enum rtx_code signed_code, |
1058 enum rtx_code unsigned_code, rtx if_false_label, | 1125 enum rtx_code unsigned_code, rtx if_false_label, |
1059 rtx if_true_label) | 1126 rtx if_true_label, int prob) |
1060 { | 1127 { |
1061 rtx op0, op1; | 1128 rtx op0, op1; |
1062 tree type; | 1129 tree type; |
1063 enum machine_mode mode; | 1130 enum machine_mode mode; |
1064 int unsignedp; | 1131 int unsignedp; |
1114 #endif | 1181 #endif |
1115 | 1182 |
1116 do_compare_rtx_and_jump (op0, op1, code, unsignedp, mode, | 1183 do_compare_rtx_and_jump (op0, op1, code, unsignedp, mode, |
1117 ((mode == BLKmode) | 1184 ((mode == BLKmode) |
1118 ? expr_size (treeop0) : NULL_RTX), | 1185 ? expr_size (treeop0) : NULL_RTX), |
1119 if_false_label, if_true_label); | 1186 if_false_label, if_true_label, prob); |
1120 } | 1187 } |
1121 | 1188 |
1122 #include "gt-dojump.h" | 1189 #include "gt-dojump.h" |