This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 0/9] Improve icvt "convert multiple"
- From: Robin Dapp <rdapp at linux dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: james dot greenhalgh at arm dot com, rdapp at linux dot ibm dot com
- Date: Fri, 2 Aug 2019 17:10:19 +0200
- Subject: [PATCH 0/9] Improve icvt "convert multiple"
Hi,
this patch series tries to address some problems of noce_convert_multiple_sets.
The main drawback is that it emits temporaries for each conversion which are
supposed to be eliminated in a later pass but are still included in cost
estimation.
In an attempt to alleviate this I have ifcvt store the number of transformed
moves (patches 1 and 2) to allow backends to simply consider this number when
implementing their own conversion_profitable hook. This never went upstream
and I included it in this series even though it should not be strictly
necessary after the other changes.
Patch 3 limits the number of situations where temporaries are needed and patch
4 tries to estimate the original seq's costs which was only done after
noce_convert_multiple_sets (and no matter how well the converted seq's costs
were estimated, would always lose against the initial COSTS_N_INSNS(2)).
Patch 6 extracts a comparison vs the condition code. At least the S/390 and
the i386 backend emit seqs like
compare
compare
cmove
compare
cmove
because noce_emit_cmove gets passed a canonicalized comparison (not vs the cc)
causing the backend to create a cc comparison again.
Patch 7 duplicates the noce_emit_cmove mechanism, passing a canonicalized
comparison first, costing the sequence, then passing a cc comparison and
comparing costs of both variants. The better one is then emitted.
Patch 8 and 9 fix some missing things in patch 7. I split them for the sake of
clarity.
In total, the series still feels a bit clunky. If somebody has a nice idea how
to simplify things, I'd gladly incorporate it. I bootstrapped and regtested on
s390 and i386, ppc is still running.
There are also some changes needed in the S/390 backend that I'm going to send
separately at a later time.
Regards
Robin
Robin Dapp (9):
ifcvt: Store the number of created cmovs.
ifcvt: Use enum instead of transform_name string.
ifcvt: Only created temporaries as needed.
ifcvt: Estimate original costs before convert_multiple.
ifcvt: Allow constants operands in noce_convert_multiple_sets.
ifcvt: Extract cc comparison from jump.
ifcvt: Emit two cmov variants and choose the less expensive one.
ifcvt: Handle swap-style idioms differently.
ifcvt: Also pass reversed cc comparison.
gcc/ifcvt.c | 400 ++++++++++++++++++++++++++++++++++++++++++++-------
gcc/ifcvt.h | 71 ++++++++-
gcc/optabs.c | 9 +-
gcc/optabs.h | 2 +-
4 files changed, 421 insertions(+), 61 deletions(-)
--
2.17.0