diff options
| author | meissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-06-20 07:18:18 +0000 |
|---|---|---|
| committer | meissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-06-20 07:18:18 +0000 |
| commit | 689df48ef7baa21ac6de5f07cb301c541018dc4d (patch) | |
| tree | 4bd38fb5a549034c774eecc97c073ba05857bbda /gcc/expr.c | |
| parent | 82e7a633ca2b63fdcab8c5adca019de01e310373 (diff) | |
| download | ppe42-gcc-689df48ef7baa21ac6de5f07cb301c541018dc4d.tar.gz ppe42-gcc-689df48ef7baa21ac6de5f07cb301c541018dc4d.zip | |
Fix __builtin_expect on PowerPCs
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@43470 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
| -rw-r--r-- | gcc/expr.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/expr.c b/gcc/expr.c index 9b81988521b..4031cab1635 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 (<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); |

