InvestorsHub Logo
Followers 0
Posts 297
Boards Moderated 0
Alias Born 04/26/2004

Re: mmoy post# 46775

Tuesday, 11/02/2004 12:25:17 PM

Tuesday, November 02, 2004 12:25:17 PM

Post# of 97730
Loop alignment

In the assembler code of the rc4 the main loop has the label .Lstart

The top of this loop must be aligned on a natural boundary, preferably on a cache line boundary - 32 bytes. There should be an ALIGN directive. Note that the whole function is aligned at 16 bytes, this is pointless as far as I can see (compared to the main loop that is executed hundreds of times).

If the top of the loop is not aligned this will interfere with decoding and may reduce cache efficiency. The final stage of any really time-critical code is seeing where the code boundaries are.

Unless the code is specified to be on a certain boundary you have no idea where it will locate so the first run may be really, really fast then the second run slows right down. This is so common when code is being tested, the addition of a single, seemingly inconsequential, instruction can make or break the runtime. Often its the debug instructions themselves and when they are taken out the code is nowhere near as fast!
Volume:
Day Range:
Bid:
Ask:
Last Trade Time:
Total Trades:
  • 1D
  • 1M
  • 3M
  • 6M
  • 1Y
  • 5Y
Recent AMD News