Skip to content

Commit

Permalink
Reverted change of 'dec ecx' to 'sub ecx,1'
Browse files Browse the repository at this point in the history
After benchmarking on Ivy Bridge and Sky Lake (the only two platforms
I have access to) it appears that /u/FUZxxl was wrong:
'dec ecx' performs faster.
  • Loading branch information
Thanassis Tsiodras authored and ttsiodras committed Jul 21, 2022
1 parent 7723047 commit dd994f5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/sse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void CoreLoopDoubleSSE(double xcur, double ycur, double xstep, unsigned char **p
"test %%eax,%%eax\n\t" // have both pixels overflowed ?

"je 2f\n\t" // yes, jump forward to label 2 (hence, 2f) and end the loop
"subl $1, %%ecx\n\t" // otherwise, repeat the loop iterations times...
"dec %%ecx\n\t" // otherwise, repeat the loop iterations times...
"jnz 22f\n\t" // but before redoing the loop, first do periodicity checking

// We've done the loop 'iterations' times.
Expand Down Expand Up @@ -225,7 +225,7 @@ void CoreLoopDoubleSSE(double xcur, double ycur, double xstep, unsigned char **p
"test %%eax,%%eax\n\t" // have both pixels overflowed ?

"je 2f\n\t" // yes, jump forward to label 2 (hence, 2f) and end the loop
"subl $1, %%ecx\n\t" // otherwise, repeat the loop 'iterations' times...
"dec %%ecx\n\t" // otherwise, repeat the loop 'iterations' times...
"jnz 22f\n\t" // but before redoing the loop, first do periodicity checking

// We've done the loop 'iterations' times.
Expand Down Expand Up @@ -317,7 +317,7 @@ void CoreLoopDoubleAVX(double xcur, double ycur, double xstep, unsigned char **p
"test %%eax,%%eax\n\t" // have all 4 pixels overflowed ?
"je 2f\n\t" // yes, jump forward to label 2 (hence, 2f) and end the loop
//
"subl $1, %%ecx\n\t" // otherwise, repeat the loop up to iterations times...
"dec %%ecx\n\t" // otherwise, repeat the loop up to iterations times...
"jnz 22f\n\t" // but before redoing the loop, first do periodicity checking

// We've done the loop iterations times.
Expand Down

0 comments on commit dd994f5

Please sign in to comment.