From 5f2d6cfa81853503bd97f87c35fba49bac9ba699 Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Wed, 20 Jun 2001 07:18:18 +0000 Subject: Fix __builtin_expect on PowerPCs From-SVN: r43470 --- gcc/expr.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'gcc/expr.c') diff --git a/gcc/expr.c b/gcc/expr.c index 9b81988..4031cab 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -9913,6 +9913,39 @@ do_jump (exp, if_false_label, if_true_label) } break; + /* Special case: + __builtin_expect (, 0) and + __builtin_expect (, 1) + + We need to do this here, so that 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); -- cgit v1.1