From: Paolo Bonzini Date: Tue, 7 Apr 2009 12:39:37 +0000 (+0000) Subject: optabs.c (can_compare_p): Test the predicate of a cbranch and cstore pattern. X-Git-Tag: releases/gcc-4.5.0~6843 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c3c64f5002375ee8e8c6264b633abdfbb866184f;p=thirdparty%2Fgcc.git optabs.c (can_compare_p): Test the predicate of a cbranch and cstore pattern. 2009-04-07 Paolo Bonzini * optabs.c (can_compare_p): Test the predicate of a cbranch and cstore pattern. From-SVN: r145667 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8c946ebe3071..120dfc1b03b6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2009-04-07 Paolo Bonzini + + * optabs.c (can_compare_p): Test the predicate of a + cbranch and cstore pattern. + 2009-04-07 Paolo Bonzini * expr.c (convert_move): Use emit_store_flag instead of diff --git a/gcc/optabs.c b/gcc/optabs.c index f7e44db48c2b..7057d9ffa313 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -3980,8 +3980,12 @@ int can_compare_p (enum rtx_code code, enum machine_mode mode, enum can_compare_purpose purpose) { + rtx test; + test = gen_rtx_fmt_ee (code, mode, const0_rtx, const0_rtx); do { + int icode; + if (optab_handler (cmp_optab, mode)->insn_code != CODE_FOR_nothing) { if (purpose == ccp_jump) @@ -3993,15 +3997,19 @@ can_compare_p (enum rtx_code code, enum machine_mode mode, return 1; } if (purpose == ccp_jump - && optab_handler (cbranch_optab, mode)->insn_code != CODE_FOR_nothing) - return 1; + && (icode = optab_handler (cbranch_optab, mode)->insn_code) != CODE_FOR_nothing + && insn_data[icode].operand[0].predicate (test, mode)) + return 1; + if (purpose == ccp_store_flag + && (icode = optab_handler (cstore_optab, mode)->insn_code) != CODE_FOR_nothing + && insn_data[icode].operand[1].predicate (test, mode)) + return 1; if (purpose == ccp_cmov && optab_handler (cmov_optab, mode)->insn_code != CODE_FOR_nothing) return 1; - if (purpose == ccp_store_flag - && optab_handler (cstore_optab, mode)->insn_code != CODE_FOR_nothing) - return 1; + mode = GET_MODE_WIDER_MODE (mode); + PUT_MODE (test, mode); } while (mode != VOIDmode);