public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* how to generate code-loops
@ 2006-09-30 13:39 David Livshin
  2006-09-30 13:55 ` Brian Budge
  0 siblings, 1 reply; 12+ messages in thread
From: David Livshin @ 2006-09-30 13:39 UTC (permalink / raw)
  To: gcc-help


Hi,

Is there a way ( command line option ) to instruct the compiler to 
generate code-loops ( when possible ):

Label:
    <code>
    conditional jump to 'Label'


Compiling

for ( k=0 ; k<n ; k++ )
{
    x[k] = y[k+1] - y[k];
}


with the command line options

" -O3 -fomit-frame-pointer -funroll-all-loops -ffast-math 
-march=pentium4 -mfpmath=sse -msse2 -mmmx"

produces

.L1064:
    movsd as1+32032(,%edx,8), %xmm1
    subsd as1+32024(,%edx,8), %xmm1
    movsd %xmm1, as1+24016(,%edx,8)
    cmpl %ecx, %edx
    je .L1010
.L1012:
    leal 1(%edx), %esi
    movsd as1+32032(,%esi,8), %xmm0
    subsd as1+32024(,%esi,8), %xmm0
    movsd %xmm0, as1+24016(,%esi,8)
    leal 2(%edx), %ebx
    movsd as1+32032(,%ebx,8), %xmm7
    subsd as1+32024(,%ebx,8), %xmm7
    movsd %xmm7, as1+24016(,%ebx,8)
    leal 3(%edx), %eax
    movsd as1+32032(,%eax,8), %xmm6
    subsd as1+32024(,%eax,8), %xmm6
    movsd %xmm6, as1+24016(,%eax,8)
    leal 4(%edx), %esi
    movsd as1+32032(,%esi,8), %xmm5
    subsd as1+32024(,%esi,8), %xmm5
    movsd %xmm5, as1+24016(,%esi,8)
    leal 5(%edx), %ebx
    movsd as1+32032(,%ebx,8), %xmm4
    subsd as1+32024(,%ebx,8), %xmm4
    movsd %xmm4, as1+24016(,%ebx,8)
    leal 6(%edx), %eax
    movsd as1+32032(,%eax,8), %xmm3
    subsd as1+32024(,%eax,8), %xmm3
    movsd %xmm3, as1+24016(,%eax,8)
    leal 7(%edx), %esi
    movsd as1+32032(,%esi,8), %xmm2
    subsd as1+32024(,%esi,8), %xmm2
    movsd %xmm2, as1+24016(,%esi,8)
    addl $8, %edx
    jmp .L1064
.L1010:

which is not a loop; it is difficult to process ( and also runs slower 
then when the code is a loop ).

Thank you in advance,

David

-- 
David Livshin
david.livshin@dalsoft.com

http://www.dalsoft.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2006-10-01  1:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-30 13:39 how to generate code-loops David Livshin
2006-09-30 13:55 ` Brian Budge
2006-09-30 18:38   ` David Livshin
2006-09-30 19:50     ` Artūras Moskvinas
2006-09-30 20:04       ` David Livshin
2006-09-30 20:28         ` regarding privilege levels of pentium 4 ranjith kumar
2006-09-30 20:32           ` Sven Eschenberg
2006-09-30 22:09             ` ranjith kumar
2006-09-30 22:28               ` Artūras Moskvinas
2006-10-01  1:03                 ` Tim Prince
2006-09-30 22:32               ` Sven Eschenberg
2006-10-01  0:51     ` how to generate code-loops Tim Prince

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).