diff options
author | Michael Meissner <meissner@redhat.com> | 2001-06-20 07:18:18 +0000 |
---|---|---|
committer | Michael Meissner <meissner@gcc.gnu.org> | 2001-06-20 07:18:18 +0000 |
commit | 5f2d6cfa81853503bd97f87c35fba49bac9ba699 (patch) | |
tree | 4bd38fb5a549034c774eecc97c073ba05857bbda /gcc/expr.c | |
parent | f34c9fd4a6c2b2395665848eaf60ac9999c41793 (diff) | |
download | gcc-5f2d6cfa81853503bd97f87c35fba49bac9ba699.zip gcc-5f2d6cfa81853503bd97f87c35fba49bac9ba699.tar.gz gcc-5f2d6cfa81853503bd97f87c35fba49bac9ba699.tar.bz2 |
Fix __builtin_expect on PowerPCs
From-SVN: r43470
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -9913,6 +9913,39 @@ do_jump (exp, if_false_label, if_true_label) } break; + /* Special case: + __builtin_expect (<test>, 0) and + __builtin_expect (<test>, 1) + + We need to do this here, so that <test> is not converted to a SCC + operation on machines that use condition code registers and COMPARE + like the PowerPC, and then the jump is done based on whether the SCC + operation produced a 1 or 0. */ + case CALL_EXPR: + /* Check for a built-in function. */ + if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR) + { + tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); + tree arglist = TREE_OPERAND (exp, 1); + + if (TREE_CODE (fndecl) == FUNCTION_DECL + && DECL_BUILT_IN (fndecl) + && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_EXPECT + && arglist != NULL_TREE + && TREE_CHAIN (arglist) != NULL_TREE) + { + rtx seq = expand_builtin_expect_jump (exp, if_false_label, + if_true_label); + + if (seq != NULL_RTX) + { + emit_insn (seq); + return; + } + } + } + /* fall through and generate the normal code. */ + default: normal: temp = expand_expr (exp, NULL_RTX, VOIDmode, 0); |