This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/63464] compare one character to many: faster
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 06 Oct 2014 16:59:37 +0000
- Subject: [Bug tree-optimization/63464] compare one character to many: faster
- Auto-submitted: auto-generated
- References: <bug-63464-4 at http dot gcc dot gnu dot org/bugzilla/>
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).