From: Dehao Chen Date: Thu, 27 Mar 2014 00:41:10 +0000 (+0000) Subject: dojump.c (do_compare_rtx_and_jump): Sets correct probability for compiler inserted... X-Git-Tag: releases/gcc-4.9.0~281 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0dbf28553c24241b594a21180ffbc28c824b576;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9477cf0d1f06..b9fc168cd190 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-03-26 Dehao Chen + + * dojump.c (do_compare_rtx_and_jump): Sets correct probability for + compiler inserted conditional jumps for NAN float check. + 2014-03-26 Jakub Jelinek * ubsan.h (ubsan_create_data): Change second argument's type diff --git a/gcc/dojump.c b/gcc/dojump.c index 7846314e0300..1c3a2bee872c 100644 --- a/gcc/dojump.c +++ b/gcc/dojump.c @@ -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); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a5bcb88b1a87..98ee981cb234 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-03-26 Dehao Chen + + * gcc.dg/predict-8.c: New test. + 2014-03-26 Fabien Chêne PR c++/52369 diff --git a/gcc/testsuite/gcc.dg/predict-8.c b/gcc/testsuite/gcc.dg/predict-8.c new file mode 100644 index 000000000000..8c78ca7fc86b --- /dev/null +++ b/gcc/testsuite/gcc.dg/predict-8.c @@ -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" } } */