This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/83262] SELECT CASE slower than IF/ELSE


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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]