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: "tkoenig at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 03 Dec 2017 12:34:15 +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
--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
ig25@linux-d6cw:~> gfortran -v
Es werden eingebaute Spezifikationen verwendet.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/ig25/lib/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Ziel: x86_64-pc-linux-gnu
Konfiguriert mit: ../trunk/configure --prefix=/home/ig25
--enable-maintainer-mode --enable-languages=c,c++,fortran --disable-multilib
Thread-Modell: posix
gcc-Version 8.0.0 20171127 (experimental) (GCC)
ig25@linux-d6cw:~> cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Core(TM)2 Quad CPU Q8200 @ 2.33GHz
stepping : 7
microcode : 0x70a
cpu MHz : 1998.000
cache size : 2048 KB
Using PowerPC, I get
[tkoenig@gcc1-power7 ~]$ ./a.out 100000000 200000000 30000000
Number of input arguments: 3
GOTO: n =100000000, ss =-0.1480800E+10, time = 0.441 (s)
SELECT CASE: n =100000000, ss =-0.1480800E+10, time = 0.412 (s)
IF-Goto: n =100000000, ss =-0.1480800E+10, time = 0.318 (s)
IF-noGoto: n =100000000, ss =-0.1480800E+10, time = 0.176 (s)
IF-ELSE: n =100000000, ss =-0.1480800E+10, time = 1.358 (s)
GOTO: n =200000000, ss =-0.2961600E+10, time = 1.372 (s)
SELECT CASE: n =200000000, ss =-0.2961600E+10, time = 0.647 (s)
IF-Goto: n =200000000, ss =-0.2961600E+10, time = 0.382 (s)
IF-noGoto: n =200000000, ss =-0.2961600E+10, time = 0.338 (s)
IF-ELSE: n =200000000, ss =-0.2961600E+10, time = 0.392 (s)
GOTO: n = 30000000, ss =-0.4442400E+09, time = 0.108 (s)
SELECT CASE: n = 30000000, ss =-0.4442400E+09, time = 0.092 (s)
IF-Goto: n = 30000000, ss =-0.4442400E+09, time = 0.051 (s)
IF-noGoto: n = 30000000, ss =-0.4442400E+09, time = 0.051 (s)
IF-ELSE: n = 30000000, ss =-0.4442400E+09, time = 0.054 (s)
GOTO costs totally 1.920 (s)
SELECT CASE costs totally 1.151 (s)
IF-Goto costs totally 0.752 (s)
IF-noGoto costs totally 0.564 (s)
IF-ELSE costs totally 1.804 (s)
Total time: 6.191 (s)
with
[tkoenig@gcc1-power7 ~]$ gfortran -v
Es werden eingebaute Spezifikationen verwendet.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/tkoenig/libexec/gcc/powerpc64-unknown-linux-gnu/8.0.0/lto-wrapper
Ziel: powerpc64-unknown-linux-gnu
Konfiguriert mit: ../trunk/configure --prefix=/home/tkoenig
--enable-languages=fortran,c,c++ --disable-multilib --enable-maintainer-mode
Thread-Modell: posix
gcc-Version 8.0.0 20171108 (experimental) (GCC)