re PR tree-optimization/43721 (Failure to optimise (a/b) and (a%b) into single __aeab...
authorPrathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
Fri, 28 Oct 2016 19:05:12 +0000 (19:05 +0000)
committerPrathamesh Kulkarni <prathamesh3492@gcc.gnu.org>
Fri, 28 Oct 2016 19:05:12 +0000 (19:05 +0000)
commite72531b9cb3c214731f0e0f64f53033d3efb80ca
tree9837b3df122e46bd34e1497c40a603aa1033fab1
parent0dfeae289cc3c97f0f61d02c81df393e720badf9
re PR tree-optimization/43721 (Failure to optimise (a/b) and (a%b) into single __aeabi_idivmod call)

2016-10-28  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
    Kugan Vivekanandarajah  <kuganv@linaro.org>
    Jim Wilson  <jim.wilson@linaro.org>

PR tree-optimization/43721
* target.def: New hook expand_divmod_libfunc.
* doc/tm.texi.in: Add hook for TARGET_EXPAND_DIVMOD_LIBFUNC
* doc/tm.texi: Regenerate.
* internal-fn.def: Add new entry for DIVMOD ifn.
* internal-fn.c (expand_DIVMOD): New.
* tree-ssa-math-opts.c: Include optabs-libfuncs.h, tree-eh.h,
targhooks.h.
(widen_mul_stats): Add new field divmod_calls_inserted.
(target_supports_divmod_p): New.
(divmod_candidate_p): Likewise.
(convert_to_divmod): Likewise.
(pass_optimize_widening_mul::execute): Call
calculate_dominance_info(), renumber_gimple_stmt_uids() at
beginning of function. Call convert_to_divmod()
and record stats for divmod.
* config/arm/arm.c (arm_expand_divmod_libfunc): Override hook
TARGET_EXPAND_DIVMOD_LIBFUNC.
* doc/sourcebuild.texi: Add items for arm_divmod_simode, divmod,
divmod_simode.

testsuite/
* lib/target-supports.exp (check_effective_target_divmod): New.
(check_effective_target_divmod_simode): Likewise.
(check_effective_target_arm_divmod_simode): Likewise.
* gcc.dg/divmod-1-simode.c: New test.
* gcc.dg/divmod-1.c: Likewise.
* gcc.dg/divmod-2-simode.c: Likewise.
* gcc.dg/divmod-2.c: Likewise.
* gcc.dg/divmod-3-simode.c: Likewise.
* gcc.dg/divmod-3.c: Likewise.
* gcc.dg/divmod-4-simode.c: Likewise.
* gcc.dg/divmod-4.c: Likewise.
* gcc.dg/divmod-5.c: Likewise.
* gcc.dg/divmod-6-simode.c: Likewise.
* gcc.dg/divmod-6.c: Likewise.
* gcc.dg/divmod-7.c: Likewise.

Co-Authored-By: Jim Wilson <jim.wilson@linaro.org>
Co-Authored-By: Kugan Vivekanandarajah <kuganv@linaro.org>
From-SVN: r241660
23 files changed:
gcc/ChangeLog
gcc/config/arm/arm.c
gcc/doc/sourcebuild.texi
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/internal-fn.c
gcc/internal-fn.def
gcc/target.def
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/divmod-1-simode.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/divmod-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/divmod-2-simode.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/divmod-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/divmod-3-simode.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/divmod-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/divmod-4-simode.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/divmod-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/divmod-5.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/divmod-6-simode.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/divmod-6.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/divmod-7.c [new file with mode: 0644]
gcc/testsuite/lib/target-supports.exp
gcc/tree-ssa-math-opts.c