------- Comment #7 from malitzke at metronets dot com 2007-05-23 02:09 -------
Thank you Mr Taylor; your suggestion to use volatile certainly work in this
drastically reduced test case. If it will work when nsec is part of a kernel
structure I will leave to the experts. I, certainly, know better than to argue
with you, who wrote uucp and has been active on gcc for probably 15 years or
more.
The *.s file and the results of time follow: (both obtained with -O1)
.file "rmgg.c"
.text
.p2align 4,,15
.globl rmg
.type rmg, @function
rmg:
movl sec.1647, %ecx
pushl %ebp
movl %esp, %ebp
testl %ecx, %ecx
jg .L18
.L6:
movl nsec.1646, %eax
movl nsec.1646+4, %edx
addl $1, %eax
adcl $0, %edx
movl %eax, nsec.1646
movl %edx, nsec.1646+4
movl nsec.1646, %eax
movl nsec.1646+4, %edx
cmpl $0, %edx
jbe .L15
.L13:
movl nsec.1646, %eax
movl nsec.1646+4, %edx
addl $-1000000000, %eax
adcl $-1, %edx
incl %ecx
movl %eax, nsec.1646
movl %edx, nsec.1646+4
movl nsec.1646, %eax
movl nsec.1646+4, %edx
cmpl $0, %edx
ja .L13
.p2align 4,,15
.L15:
cmpl $999999999, %eax
ja .L13
testl %ecx, %ecx
jle .L6
.L18:
popl %ebp
movl %ecx, %eax
movl %ecx, sec.1647
ret
.size rmg, .-rmg
.p2align 4,,15
.globl main
.type main, @function
main:
leal 4(%esp), %ecx
andl $-16, %esp
pushl -4(%ecx)
pushl %ebp
movl %esp, %ebp
pushl %ecx
call rmg
popl %ecx
popl %ebp
leal -4(%ecx), %esp
ret
.size main, .-main
.local sec.1647
.comm sec.1647,4,4
.local nsec.1646
.comm nsec.1646,8,8
.ident "GCC: (GNU) 4.3.0 20070522 (experimental)"
.section .note.GNU-stack,"",@progbits
real 0m16.433s
user 0m16.425s
sys 0m0.004s
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32044