https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100855

            Bug ID: 100855
           Summary: pow run time gfortran vs ifort
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nadavhalahmi560 at gmail dot com
  Target Milestone: ---

I wrote the code below:

```
program power
    implicit none

    real :: sum, n, q
    integer :: i, j
    integer :: limit
    real :: start, finish

    sum = 0d0
    limit = 10000
    n = 2.0
    q = 0.5
    call CPU_TIME(start)
    do j=1,limit
        do i=1, limit
            n = n*q
            sum = sum + (i ** (0.05 + n))
        end do
    end do
    call CPU_TIME(finish)
    print *, sum
    print '("Time = ",f6.3," seconds.")',finish-start
end program power
```

and compiled it using:

ifort pow.f90 -O3 -no-vec -o intel.out

gfortran pow.f90 -O3 -fno-tree-vectorize -o gnu.out

When I run `./intel.out` I get the following output:
  3.3554432E+07
Time =  1.615 seconds.

When I run `./gnu.out` I get the following output:
  33554432.0    
Time =  7.817 seconds.

Therefore, gfortran is much slower than ifort. I get similar behavior for `log`
and `exp` functions.

gfortran -v:
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/software/x86_64/3.10.0/gcc/11.1.0/libexec/gcc/x86_64-pc-linux-gnu/11.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/software/x86_64/3.10.0/gcc/11.1.0
--disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.1.0 (GCC) 

ifort -v:
ifort version 19.1.3.304

Reply via email to