NO

Author Topic: memmove sporadic misbehavior  (Read 10940 times)

dienstag

  • Guest
Re: memmove sporadic misbehavior
« Reply #15 on: October 01, 2012, 10:35:55 AM »
Yesterday I stumbled over this comment in an older project of mine:

Code: [Select]
G200:   // edi is aligned now. Move 4 bytes at a time
        mov     edx, ecx
        shr     ecx, 2

            // Do not use rep movsd in negative direction, errors on AMD's

G210: sub edi, 4
mov eax, [edi + esi]
mov [edi], eax
dec ecx
jnz G210

The rep movsd is not the source of the problem here, since only two bytes were moved. However, there were other processor bugs reported for rep movs* for AMD as well as Intel processors (search for 'bug "rep movs"'). Occurence of these bugs usuallay depends on a number of side conditions, so they are hard to reproduce.

I could not reproduce the problem on a Windows XP, Athlon, Pelles 4.50.113.

The original code I used in the example above is from Agner Fog, www.agner.org/optimize (GPL).

CommonTater

  • Guest
Re: memmove sporadic misbehavior
« Reply #16 on: October 01, 2012, 01:40:54 PM »
If you are using Pelles C 4.50 you need to update... the current version is 7.00 available HERE