This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/83262] SELECT CASE slower than IF/ELSE
- From: "dominiq at lps dot ens.fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 03 Dec 2017 14:10:32 +0000
- Subject: [Bug tree-optimization/83262] SELECT CASE slower than IF/ELSE
- Auto-submitted: auto-generated
- References: <bug-83262-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83262
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-12-03
Ever confirmed|0 |1
--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
I suspect that the code is not testing what it is expected to test. IMO the
lines
key = mod(n,10) + 1
should be replaced with
key = mod(i,10) + 1
With the change I get
GOTO costs totally 3.377 (s)
SELECT CASE costs totally 4.455 (s)
IF-Goto costs totally 1.553 (s)
IF-noGoto costs totally 1.572 (s)
IF-ELSE costs totally 1.547 (s)
GCC 4.8.5 is significantly slower
GOTO costs totally 6.594 (s)
SELECT CASE costs totally 7.215 (s)
IF-Goto costs totally 4.512 (s)
IF-noGoto costs totally 4.601 (s)
IF-ELSE costs totally 4.581 (s)