https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63464

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 33654
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33654&action=edit
gcc5-pr63464.patch

Untested patch to avoid the subtraction of info.range_min from index.
Might not always be a net win, if the mask constant(s) is(are) more costly if
we don't subtract minval than when we do.
E.g. on x86_64, if without subtracting we need to use movabsq + and with a reg,
while with subtracting just sub + and with an immediate mask.
So perhaps we need to build all the masks for both cases and sum up rtx cost of
all the masks and the sub.

This is for the switch opt.  In tree-ssa-reassoc, I'll see what can be reused,
but probably not very much (perhaps the rtx_cost code if we add it for the
switch conversion).

Reply via email to