https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100855
--- Comment #4 from Nadav Halahmi <nadavhalahmi560 at gmail dot com> ---
(In reply to Richard Biener from comment #3)
> Might be interesting to see whether ifort does any expression simplification
> here. Can you share the produced assembly?
gfortran pow.f90 -O3 -fno-tree-vectorize -S -o gnu.s:
.file "pow.f90"
.text
.section .rodata.str1.1,"aMS",@progbits,1
.LC5:
.string "pow.f90"
.LC6:
.string "(\"Time = \",f6.3,\" seconds.\")"
.text
.p2align 4
.type MAIN__, @function
MAIN__:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
xorl %eax, %eax
movl $10000, %ebp
pushq %rbx
.cfi_def_cfa_offset 24
.cfi_offset 3, -24
subq $568, %rsp
.cfi_def_cfa_offset 592
leaq 20(%rsp), %rdi
call _gfortran_cpu_time_4
pxor %xmm4, %xmm4
movss .LC1(%rip), %xmm2
movss %xmm4, 8(%rsp)
.L4:
movss .LC2(%rip), %xmm0
movl $1, %ebx
jmp .L3
.p2align 4,,10
.p2align 3
.L8:
movss .LC3(%rip), %xmm1
pxor %xmm0, %xmm0
movss %xmm2, 12(%rsp)
cvtsi2ssl %ebx, %xmm0
mulss %xmm2, %xmm1
addss .LC4(%rip), %xmm1
call powf
movss 12(%rsp), %xmm2
.L3:
addss 8(%rsp), %xmm0
addl $1, %ebx
mulss .LC3(%rip), %xmm2
movss %xmm0, 8(%rsp)
cmpl $10001, %ebx
jne .L8
subl $1, %ebp
jne .L4
leaq 16(%rsp), %rdi
xorl %eax, %eax
movss %xmm0, 24(%rsp)
call _gfortran_cpu_time_4
leaq 32(%rsp), %rdi
movabsq $25769803904, %rax
movq $.LC5, 40(%rsp)
movq %rax, 32(%rsp)
movl $21, 48(%rsp)
call _gfortran_st_write
leaq 24(%rsp), %rsi
movl $4, %edx
leaq 32(%rsp), %rdi
call _gfortran_transfer_real_write
leaq 32(%rsp), %rdi
call _gfortran_st_write_done
leaq 32(%rsp), %rdi
movabsq $25769807872, %rax
movq $.LC5, 40(%rsp)
movq %rax, 32(%rsp)
movl $22, 48(%rsp)
movq $.LC6, 112(%rsp)
movq $28, 120(%rsp)
call _gfortran_st_write
movss 16(%rsp), %xmm0
subss 20(%rsp), %xmm0
leaq 28(%rsp), %rsi
leaq 32(%rsp), %rdi
movl $4, %edx
movss %xmm0, 28(%rsp)
call _gfortran_transfer_real_write
leaq 32(%rsp), %rdi
call _gfortran_st_write_done
addq $568, %rsp
.cfi_def_cfa_offset 24
popq %rbx
.cfi_def_cfa_offset 16
popq %rbp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE0:
.size MAIN__, .-MAIN__
.section .text.startup,"ax",@progbits
.p2align 4
.globl main
.type main, @function
main:
.LFB1:
.cfi_startproc
subq $8, %rsp
.cfi_def_cfa_offset 16
call _gfortran_set_args
movl $options.2.0, %esi
movl $7, %edi
call _gfortran_set_options
call MAIN__
xorl %eax, %eax
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE1:
.size main, .-main
.section .rodata
.align 16
.type options.2.0, @object
.size options.2.0, 28
options.2.0:
.long 2116
.long 4095
.long 0
.long 1
.long 1
.long 0
.long 31
.section .rodata.cst4,"aM",@progbits,4
.align 4
.LC1:
.long 1073741824
.align 4
.LC2:
.long 1065353216
.align 4
.LC3:
.long 1056964608
.align 4
.LC4:
.long 1028443341
.ident "GCC: (GNU) 11.1.0"
.section .note.GNU-stack,"",@progbits