https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83262
--- Comment #15 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Architecture and possibly micro-architecture dependent.
On Power10:
[tkoenig@cfarm120 ~]$ gfortran -O1 corrected.f90 && ./a.out 100000000
200000000 300000000
Number of input arguments: 3
GOTO: n =100000000, ss = 0.4321400E+10, time = 0.232 (s)
SELECT CASE: n =100000000, ss = 0.4321400E+10, time = 0.438 (s)
IF-Goto: n =100000000, ss = 0.4321400E+10, time = 0.236 (s)
IF-noGoto: n =100000000, ss = 0.4321400E+10, time = 0.425 (s)
IF-ELSE: n =100000000, ss = 0.4321400E+10, time = 0.438 (s)
GOTO: n =200000000, ss = 0.8642800E+10, time = 0.470 (s)
SELECT CASE: n =200000000, ss = 0.8642800E+10, time = 0.878 (s)
IF-Goto: n =200000000, ss = 0.8642800E+10, time = 0.470 (s)
IF-noGoto: n =200000000, ss = 0.8642800E+10, time = 0.850 (s)
IF-ELSE: n =200000000, ss = 0.8642800E+10, time = 0.875 (s)
GOTO: n =300000000, ss = 0.1296420E+11, time = 0.701 (s)
SELECT CASE: n =300000000, ss = 0.1296420E+11, time = 1.316 (s)
IF-Goto: n =300000000, ss = 0.1296420E+11, time = 0.699 (s)
IF-noGoto: n =300000000, ss = 0.1296420E+11, time = 1.275 (s)
IF-ELSE: n =300000000, ss = 0.1296420E+11, time = 1.308 (s)
GOTO costs totally 1.403 (s)
SELECT CASE costs totally 2.631 (s)
IF-Goto costs totally 1.405 (s)
IF-noGoto costs totally 2.549 (s)
IF-ELSE costs totally 2.622 (s)
Total time: 10.611 (s)
----------------------------------------------------------------------
[tkoenig@cfarm120 ~]$ gfortran -O3 corrected.f90 && ./a.out 100000000
200000000 300000000
Number of input arguments: 3
GOTO: n =100000000, ss = 0.4321400E+10, time = 0.295 (s)
SELECT CASE: n =100000000, ss = 0.4321400E+10, time = 0.283 (s)
IF-Goto: n =100000000, ss = 0.4321400E+10, time = 0.313 (s)
IF-noGoto: n =100000000, ss = 0.4321400E+10, time = 0.241 (s)
IF-ELSE: n =100000000, ss = 0.4321400E+10, time = 0.275 (s)
GOTO: n =200000000, ss = 0.8642800E+10, time = 0.593 (s)
SELECT CASE: n =200000000, ss = 0.8642800E+10, time = 0.567 (s)
IF-Goto: n =200000000, ss = 0.8642800E+10, time = 0.744 (s)
IF-noGoto: n =200000000, ss = 0.8642800E+10, time = 0.467 (s)
IF-ELSE: n =200000000, ss = 0.8642800E+10, time = 0.595 (s)
GOTO: n =300000000, ss = 0.1296420E+11, time = 0.879 (s)
SELECT CASE: n =300000000, ss = 0.1296420E+11, time = 0.851 (s)
IF-Goto: n =300000000, ss = 0.1296420E+11, time = 0.833 (s)
IF-noGoto: n =300000000, ss = 0.1296420E+11, time = 0.708 (s)
IF-ELSE: n =300000000, ss = 0.1296420E+11, time = 0.881 (s)
GOTO costs totally 1.767 (s)
SELECT CASE costs totally 1.701 (s)
IF-Goto costs totally 1.891 (s)
IF-noGoto costs totally 1.415 (s)
IF-ELSE costs totally 1.751 (s)
Total time: 8.525 (s)
So -O1 IF-Goto (and GOTO) at -O1 is faster than anything at -O3.