diff options
author | guojiufu <guojiufu@linux.ibm.com> | 2020-07-15 16:07:47 +0800 |
---|---|---|
committer | guojiufu <guojiufu@linux.ibm.com> | 2020-07-15 16:15:05 +0800 |
commit | 7a9fd18598e638b55c591624e753fb7a88abe1ab (patch) | |
tree | 53319423ecbfa03696271c0af503d35bbc71654c /gcc | |
parent | fff15bad1ab571906c37b88380431768d917dcb0 (diff) | |
download | gcc-7a9fd18598e638b55c591624e753fb7a88abe1ab.zip gcc-7a9fd18598e638b55c591624e753fb7a88abe1ab.tar.gz gcc-7a9fd18598e638b55c591624e753fb7a88abe1ab.tar.bz2 |
rs6000: Refine RTL unroll hook for small loops
For very small loops (< 6 insns), it would be fine to unroll 4
times to run fast with less latency and better cache usage. Like
below loops:
while (i) a[--i] = NULL; while (p < e) *d++ = *p++;
With this patch enhances, we could see some performance improvement
for some workloads(e.g. SPEC2017).
2020-07-13 Jiufu Guo <guojiufu@cn.ibm.com>
* config/rs6000/rs6000.c (rs6000_loop_unroll_adjust): Refine hook.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index dda51d5..c5c3300c 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -5212,13 +5212,14 @@ rs6000_loop_unroll_adjust (unsigned nunroll, struct loop *loop) { if (unroll_only_small_loops) { - /* TODO: This is hardcoded to 10 right now. It can be refined, for - example we may want to unroll very small loops more times (4 perhaps). - We also should use a PARAM for this. */ + /* TODO: These are hardcoded values right now. We probably should use + a PARAM here. */ + if (loop->ninsns <= 6) + return MIN (4, nunroll); if (loop->ninsns <= 10) return MIN (2, nunroll); - else - return 0; + + return 0; } return nunroll; |