Skip to content

Commit

Permalink
optimization blocking clobbers
Browse files Browse the repository at this point in the history
  • Loading branch information
camel-cdr committed Sep 3, 2024
1 parent 0d8eee1 commit 507739a
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bench/ascii_to_utf16.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
void
ascii_to_utf16_scalar(uint16_t *restrict dest, uint8_t const *restrict src, size_t len)
{
while (len--) *dest++ = *src++, BENCH_CLOBBER();
while (len--) BENCH_CLOBBER(), *dest++ = *src++;
}

void
Expand Down
2 changes: 1 addition & 1 deletion bench/ascii_to_utf32.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
void
ascii_to_utf32_scalar(uint32_t *restrict dest, uint8_t const *restrict src, size_t len)
{
while (len--) *dest++ = *src++, BENCH_CLOBBER();
while (len--) BENCH_CLOBBER(), *dest++ = *src++;
}

void
Expand Down
3 changes: 0 additions & 3 deletions bench/mandelbrot.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ mandelbrot_scalar_f32(size_t width, size_t maxIter, uint32_t *res)
zxS = zxS - zyS + cx;
zy = 2 * zx * zy + cy;
zx = zxS;
BENCH_VOLATILE_REG(zx);
zxS = zx*zx;
zyS = zy*zy;
++iter;
BENCH_CLOBBER();
}
*res++ = iter;
}
Expand All @@ -41,7 +39,6 @@ mandelbrot_scalar_f64(size_t width, size_t maxIter, uint32_t *res)
zxS = zxS - zyS + cx;
zy = 2 * zx * zy + cy;
zx = zxS;
BENCH_VOLATILE_REG(zx);
zxS = zx*zx;
zyS = zy*zy;
++iter;
Expand Down
2 changes: 1 addition & 1 deletion bench/utf8_count.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ upopcnt(ux x)
x = (x & (-(ux)1/15*3)) + ((x >> 2) & (-(ux)1/15*3));
/* 8-bit sums */
x = (x + (x >> 4)) & (-(ux)1/255*15);
BENCH_VOLATILE_REG(x);
BENCH_CLOBBER();
/* now we can just add the sums together, because can't overflow,
* since there can't be more than 255 bits set */
x += (x >> 8); /* 16-bit sums */
Expand Down

0 comments on commit 507739a

Please sign in to comment.