aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc
diff options
context:
space:
mode:
authorJiufu Guo <guojiufu@linux.ibm.com>2021-07-15 17:21:00 +0800
committerJiufu Guo <guojiufu@linux.ibm.com>2021-07-29 08:42:56 +0800
commitaafa38b5bfed5e3eff258aa5354ed928f4986709 (patch)
treeaa79d882438826d124bc09c9c61168a939e15f8d /gcc/doc
parent3916902930769d5172c0feaa5f535ca7b2bafdf7 (diff)
downloadgcc-aafa38b5bfed5e3eff258aa5354ed928f4986709.zip
gcc-aafa38b5bfed5e3eff258aa5354ed928f4986709.tar.gz
gcc-aafa38b5bfed5e3eff258aa5354ed928f4986709.tar.bz2
Use preferred mode for doloop IV [PR61837]
Currently, doloop.xx variable is using the type as niter which may be shorter than word size. For some targets, it would be better to use word size type. For example, on 64bit system, to access 32bit value, subreg maybe used. Then using 64bit type maybe better for niter if it can be present in both 32bit and 64bit. This patch add target hook to query preferred mode for doloop IV, and update mode accordingly. gcc/ChangeLog: 2021-07-29 Jiufu Guo <guojiufu@linux.ibm.com> PR target/61837 * config/rs6000/rs6000.c (TARGET_PREFERRED_DOLOOP_MODE): New hook. (rs6000_preferred_doloop_mode): New hook. * doc/tm.texi: Regenerate. * doc/tm.texi.in: Add hook preferred_doloop_mode. * target.def (preferred_doloop_mode): New hook. * targhooks.c (default_preferred_doloop_mode): New hook. * targhooks.h (default_preferred_doloop_mode): New hook. * tree-ssa-loop-ivopts.c (compute_doloop_base_on_mode): New function. (add_iv_candidate_for_doloop): Call targetm.preferred_doloop_mode and compute_doloop_base_on_mode. gcc/testsuite/ChangeLog: 2021-07-29 Jiufu Guo <guojiufu@linux.ibm.com> PR target/61837 * gcc.target/powerpc/pr61837.c: New test.
Diffstat (limited to 'gcc/doc')
-rw-r--r--gcc/doc/tm.texi9
-rw-r--r--gcc/doc/tm.texi.in2
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index c8f4abe..d5f8852 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -12011,6 +12011,15 @@ By default, the RTL loop optimizer does not use a present doloop pattern for
loops containing function calls or branch on table instructions.
@end deftypefn
+@deftypefn {Target Hook} machine_mode TARGET_PREFERRED_DOLOOP_MODE (machine_mode @var{mode})
+This hook takes a @var{mode} for a doloop IV, where @code{mode} is the
+original mode for the operation. If the target prefers an alternate
+@code{mode} for the operation, then this hook should return that mode;
+otherwise the original @code{mode} should be returned. For example, on a
+64-bit target, @code{DImode} might be preferred over @code{SImode}. Both the
+original and the returned modes should be @code{MODE_INT}.
+@end deftypefn
+
@deftypefn {Target Hook} bool TARGET_LEGITIMATE_COMBINED_INSN (rtx_insn *@var{insn})
Take an instruction in @var{insn} and return @code{false} if the instruction
is not appropriate as a combination of two or more instructions. The
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 9c4b501..0b60342 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -7943,6 +7943,8 @@ to by @var{ce_info}.
@hook TARGET_INVALID_WITHIN_DOLOOP
+@hook TARGET_PREFERRED_DOLOOP_MODE
+
@hook TARGET_LEGITIMATE_COMBINED_INSN
@hook TARGET_CAN_FOLLOW_JUMP