Message ID | 20200713115028.965181-1-guojiufu@linux.ibm.com |
---|---|
State | New |
Headers | show |
Series | [rs6000] : Refine RTL unroll hook for small loops | expand |
Hi Jiu Fu, On Mon, Jul 13, 2020 at 07:50:28PM +0800, guojiufu wrote: > For very small loops (< 6 insns), it would be fine to unroll 4 > times to run fast with less latency and better cache usage. > - /* 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: Using hardcodes here, for tunable, PARAM(s) maybe refined. */ /* TODO: These are hardcoded values right now. We probably should use a PARAM here. */ Okay for trunk with that. Thanks! Segher
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 58f5d780603..06844fdba57 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -5135,16 +5135,15 @@ rs6000_destroy_cost_data (void *data) static unsigned rs6000_loop_unroll_adjust (unsigned nunroll, struct loop *loop) { - if (unroll_only_small_loops) + 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: Using hardcodes here, for tunable, PARAM(s) maybe refined. */ + if (loop->ninsns <= 6) + return MIN (4, nunroll); if (loop->ninsns <= 10) return MIN (2, nunroll); - else - return 0; + + return 0; } return nunroll; --