diff options
author | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-22 17:43:43 -0300 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-22 17:43:43 -0300 |
commit | a926878ddbd5a98b272c22171ce58663fc04c3e0 (patch) | |
tree | 86af256e5d9a9c06263c00adc90e5fe348008c43 /gcc/expmed.c | |
parent | 542730f087133690b47e036dfd43eb0db8a650ce (diff) | |
parent | 07cbaed8ba7d1b6e4ab3a9f44175502a4e1ecdb1 (diff) | |
download | gcc-devel/autopar_devel.zip gcc-devel/autopar_devel.tar.gz gcc-devel/autopar_devel.tar.bz2 |
Merge branch 'autopar_rebase2' into autopar_develdevel/autopar_devel
Quickly commit changes in the rebase branch.
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r-- | gcc/expmed.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c index e7c03fb..d34f0fb 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -155,6 +155,8 @@ init_expmed_one_conv (struct init_expmed_rtl *all, scalar_int_mode to_mode, PUT_MODE (all->reg, from_mode); set_convert_cost (to_mode, from_mode, speed, set_src_cost (which, to_mode, speed)); + /* Restore all->reg's mode. */ + PUT_MODE (all->reg, to_mode); } static void @@ -229,6 +231,7 @@ init_expmed_one_mode (struct init_expmed_rtl *all, if (GET_MODE_CLASS (int_mode_to) == MODE_INT && GET_MODE_WIDER_MODE (int_mode_to).exists (&wider_mode)) { + PUT_MODE (all->reg, mode); PUT_MODE (all->zext, wider_mode); PUT_MODE (all->wide_mult, wider_mode); PUT_MODE (all->wide_lshr, wider_mode); @@ -4086,9 +4089,12 @@ expand_sdiv_pow2 (scalar_int_mode mode, rtx op0, HOST_WIDE_INT d) { temp = gen_reg_rtx (mode); temp = emit_store_flag (temp, LT, op0, const0_rtx, mode, 0, 1); - temp = expand_binop (mode, add_optab, temp, op0, NULL_RTX, - 0, OPTAB_LIB_WIDEN); - return expand_shift (RSHIFT_EXPR, mode, temp, logd, NULL_RTX, 0); + if (temp != NULL_RTX) + { + temp = expand_binop (mode, add_optab, temp, op0, NULL_RTX, + 0, OPTAB_LIB_WIDEN); + return expand_shift (RSHIFT_EXPR, mode, temp, logd, NULL_RTX, 0); + } } if (HAVE_conditional_move @@ -4122,17 +4128,21 @@ expand_sdiv_pow2 (scalar_int_mode mode, rtx op0, HOST_WIDE_INT d) temp = gen_reg_rtx (mode); temp = emit_store_flag (temp, LT, op0, const0_rtx, mode, 0, -1); - if (GET_MODE_BITSIZE (mode) >= BITS_PER_WORD - || shift_cost (optimize_insn_for_speed_p (), mode, ushift) - > COSTS_N_INSNS (1)) - temp = expand_binop (mode, and_optab, temp, gen_int_mode (d - 1, mode), - NULL_RTX, 0, OPTAB_LIB_WIDEN); - else - temp = expand_shift (RSHIFT_EXPR, mode, temp, - ushift, NULL_RTX, 1); - temp = expand_binop (mode, add_optab, temp, op0, NULL_RTX, - 0, OPTAB_LIB_WIDEN); - return expand_shift (RSHIFT_EXPR, mode, temp, logd, NULL_RTX, 0); + if (temp != NULL_RTX) + { + if (GET_MODE_BITSIZE (mode) >= BITS_PER_WORD + || shift_cost (optimize_insn_for_speed_p (), mode, ushift) + > COSTS_N_INSNS (1)) + temp = expand_binop (mode, and_optab, temp, + gen_int_mode (d - 1, mode), + NULL_RTX, 0, OPTAB_LIB_WIDEN); + else + temp = expand_shift (RSHIFT_EXPR, mode, temp, + ushift, NULL_RTX, 1); + temp = expand_binop (mode, add_optab, temp, op0, NULL_RTX, + 0, OPTAB_LIB_WIDEN); + return expand_shift (RSHIFT_EXPR, mode, temp, logd, NULL_RTX, 0); + } } label = gen_label_rtx (); |