dojump.c (do_compare_rtx_and_jump): Sets correct probability for compiler inserted conditional jumps for NAN float...

* dojump.c (do_compare_rtx_and_jump): Sets correct probability for
	compiler inserted conditional jumps for NAN float check.
	* gcc.dg/predict-8.c: New test.

From-SVN: r208860
This commit is contained in:
Dehao Chen 2014-03-27 00:41:10 +00:00 committed by Dehao Chen
parent e5d6141d82
commit a0dbf28553
4 changed files with 30 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2014-03-26 Dehao Chen <dehao@google.com>
* dojump.c (do_compare_rtx_and_jump): Sets correct probability for
compiler inserted conditional jumps for NAN float check.
2014-03-26 Jakub Jelinek <jakub@redhat.com>
* ubsan.h (ubsan_create_data): Change second argument's type

View File

@ -1103,6 +1103,11 @@ do_compare_rtx_and_jump (rtx op0, rtx op1, enum rtx_code code, int unsignedp,
else
{
int first_prob = prob;
if (first_code == UNORDERED)
first_prob = REG_BR_PROB_BASE / 100;
else if (first_code == ORDERED)
first_prob = REG_BR_PROB_BASE - REG_BR_PROB_BASE / 100;
if (and_them)
{
rtx dest_label;
@ -1116,11 +1121,13 @@ do_compare_rtx_and_jump (rtx op0, rtx op1, enum rtx_code code, int unsignedp,
else
dest_label = if_false_label;
do_compare_rtx_and_jump (op0, op1, first_code, unsignedp, mode,
size, dest_label, NULL_RTX, prob);
size, dest_label, NULL_RTX,
first_prob);
}
else
do_compare_rtx_and_jump (op0, op1, first_code, unsignedp, mode,
size, NULL_RTX, if_true_label, prob);
size, NULL_RTX, if_true_label,
first_prob);
}
}

View File

@ -1,3 +1,7 @@
2014-03-26 Dehao Chen <dehao@google.com>
* gcc.dg/predict-8.c: New test.
2014-03-26 Fabien Chêne <fabien@gcc.gnu.org>
PR c++/52369

View File

@ -0,0 +1,12 @@
/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
/* { dg-options "-O2 -fdump-rtl-expand" } */
int foo(float a, float b) {
if (a == b)
return 1;
else
return 2;
}
/* { dg-final { scan-rtl-dump-times "REG_BR_PROB 100" 1 "expand"} } */
/* { dg-final { cleanup-rtl-dump "expand" } } */