我检查了程序集,它在生成的代码中显示了一些变化,虽然很小
4.7
__Z16mandelbrot_n_sseU8__vectorfS_i:
pushl %ebp
movl %esp, %ebp
andl $-16, %esp
subl $16, %esp
movl 8(%ebp), %ecx
movaps %xmm0, (%esp)
testl %ecx, %ecx
js L12
xorps %xmm0, %xmm0
xorl %eax, %eax
movaps %xmm0, %xmm2
movaps %xmm0, %xmm4
jmp L11
.p2align 4,,7
L19:
mulps %xmm4, %xmm2
addl $1, %eax
subps %xmm5, %xmm6
movaps (%esp), %xmm4
cmpl %eax, %ecx
addps %xmm6, %xmm4
addps %xmm2, %xmm2
addps %xmm1, %xmm2
jl L10
L11:
movaps %xmm4, %xmm6
movaps %xmm2, %xmm5
movaps LC5, %xmm7
mulps %xmm4, %xmm6
mulps %xmm2, %xmm5
movaps %xmm6, %xmm3
addps %xmm5, %xmm3
cmpltps LC4, %xmm3
andps %xmm3, %xmm7
movmskps %xmm3, %edx
testl %edx, %edx
addps %xmm7, %xmm0
jne L19
L10:
cvtps2dq %xmm0, %xmm0
leave
ret
L12:
xorps %xmm0, %xmm0
jmp L10
.globl __Z16mandelbrot_n_sseDv4_fS_i
5.1
__Z16mandelbrot_n_sseDv4_fS_i:
pushl %ebp
movl %esp, %ebp
andl $-16, %esp
subl $16, %esp
movl 8(%ebp), %ecx
movaps %xmm0, (%esp)
testl %ecx, %ecx
js L11
pxor %xmm0, %xmm0
xorl %edx, %edx
movaps %xmm0, %xmm5
movaps %xmm0, %xmm2
jmp L10
.p2align 4,,10
L18:
mulps %xmm2, %xmm5
addl $1, %edx
subps %xmm6, %xmm4
cmpl %edx, %ecx
addps %xmm5, %xmm5
addps (%esp), %xmm4
addps %xmm1, %xmm5
jl L9
movaps %xmm4, %xmm2
L10:
movaps %xmm2, %xmm4
movaps %xmm5, %xmm6
movaps LC7, %xmm7
mulps %xmm2, %xmm4
mulps %xmm5, %xmm6
movaps %xmm4, %xmm3
addps %xmm6, %xmm3
cmpltps LC6, %xmm3
andps %xmm3, %xmm7
movmskps %xmm3, %eax
testl %eax, %eax
addps %xmm7, %xmm0
jne L18
L9:
cvtps2dq %xmm0, %xmm0
leave
ret
L11:
pxor %xmm0, %xmm0
jmp L9
.section .text.unlikely,"x"
LCOLDE8:
.text
看来 5.1 版本是倒霉的一个,它 cst 15% 减速