From e9ebb86799fd77cdd5351078230c114a90e66066 Mon Sep 17 00:00:00 2001 From: Robin Dapp Date: Wed, 27 Nov 2019 13:53:40 +0100 Subject: ifcvt/optabs: Allow using a CC comparison for emit_conditional_move. Currently we only ever call emit_conditional_move with the comparison (as well as its comparands) we got from the jump. Thus, backends are going to emit a CC comparison for every conditional move that is being generated instead of re-using the existing CC. This, combined with emitting temporaries for each conditional move, causes sky-high costs for conditional moves. This patch allows to re-use a CC so the costing situation is improved a bit. gcc/ChangeLog: * rtl.h (struct rtx_comparison): New struct that holds an rtx comparison. * config/rs6000/rs6000.cc (rs6000_emit_minmax): Use struct instead of single parameters. (rs6000_emit_swsqrt): Likewise. * expmed.cc (expand_sdiv_pow2): Likewise. (emit_store_flag): Likewise. * expr.cc (expand_cond_expr_using_cmove): Likewise. (expand_expr_real_2): Likewise. * ifcvt.cc (noce_emit_cmove): Add compare and reversed compare parameters. * optabs.cc (emit_conditional_move_1): New function. (expand_doubleword_shift_condmove): Use struct. (emit_conditional_move): Use struct and allow to call directly without going through preparation steps. * optabs.h (emit_conditional_move): Use struct. --- gcc/expr.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'gcc/expr.cc') diff --git a/gcc/expr.cc b/gcc/expr.cc index 4324b18..35e4029 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -8824,8 +8824,9 @@ expand_cond_expr_using_cmove (tree treeop0 ATTRIBUTE_UNUSED, op2 = gen_lowpart (mode, op2); /* Try to emit the conditional move. */ - insn = emit_conditional_move (temp, comparison_code, - op00, op01, comparison_mode, + insn = emit_conditional_move (temp, + { comparison_code, op00, op01, + comparison_mode }, op1, op2, mode, unsignedp); @@ -9716,8 +9717,9 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, start_sequence (); /* Try to emit the conditional move. */ - insn = emit_conditional_move (target, comparison_code, - op0, cmpop1, mode, + insn = emit_conditional_move (target, + { comparison_code, + op0, cmpop1, mode }, op0, op1, mode, unsignedp); -- cgit v1.1