diff options
author | Dominik Maier <domenukk@gmail.com> | 2022-01-19 23:03:19 +0100 |
---|---|---|
committer | Dominik Maier <domenukk@gmail.com> | 2022-01-19 23:03:19 +0100 |
commit | 1d9d5936d953841d9244031271871d4225569b89 (patch) | |
tree | e83a8e94cedae2006d221f5c11b3bd96d6157158 /include/coverage-64.h | |
parent | 7afad147d17a7e7bfb7fa3235187277056f2bae3 (diff) | |
parent | 550ba4d77294e61597a5259d00769c61281e0042 (diff) | |
download | afl++-1d9d5936d953841d9244031271871d4225569b89.tar.gz |
Merge remote-tracking branch 'origin/dev' into dev
Diffstat (limited to 'include/coverage-64.h')
-rw-r--r-- | include/coverage-64.h | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/include/coverage-64.h b/include/coverage-64.h index 54fe9d33..aab79d79 100644 --- a/include/coverage-64.h +++ b/include/coverage-64.h @@ -116,11 +116,12 @@ inline u32 skim(const u64 *virgin, const u64 *current, const u64 *current_end) { __mmask8 mask = _mm512_testn_epi64_mask(value, value); /* All bytes are zero. */ - if (mask == 0xff) continue; + if (likely(mask == 0xff)) continue; /* Look for nonzero bytes and check for new bits. */ - #define UNROLL(x) \ - if (!(mask & (1 << x)) && classify_word(current[x]) & virgin[x]) return 1 + #define UNROLL(x) \ + if (unlikely(!(mask & (1 << x)) && classify_word(current[x]) & virgin[x])) \ + return 1 UNROLL(0); UNROLL(1); UNROLL(2); @@ -152,13 +153,17 @@ inline u32 skim(const u64 *virgin, const u64 *current, const u64 *current_end) { u32 mask = _mm256_movemask_epi8(cmp); /* All bytes are zero. */ - if (mask == (u32)-1) continue; + if (likely(mask == (u32)-1)) continue; /* Look for nonzero bytes and check for new bits. */ - if (!(mask & 0xff) && classify_word(current[0]) & virgin[0]) return 1; - if (!(mask & 0xff00) && classify_word(current[1]) & virgin[1]) return 1; - if (!(mask & 0xff0000) && classify_word(current[2]) & virgin[2]) return 1; - if (!(mask & 0xff000000) && classify_word(current[3]) & virgin[3]) return 1; + if (unlikely(!(mask & 0xff) && classify_word(current[0]) & virgin[0])) + return 1; + if (unlikely(!(mask & 0xff00) && classify_word(current[1]) & virgin[1])) + return 1; + if (unlikely(!(mask & 0xff0000) && classify_word(current[2]) & virgin[2])) + return 1; + if (unlikely(!(mask & 0xff000000) && classify_word(current[3]) & virgin[3])) + return 1; } @@ -174,10 +179,10 @@ inline u32 skim(const u64 *virgin, const u64 *current, const u64 *current_end) { for (; current < current_end; virgin += 4, current += 4) { - if (current[0] && classify_word(current[0]) & virgin[0]) return 1; - if (current[1] && classify_word(current[1]) & virgin[1]) return 1; - if (current[2] && classify_word(current[2]) & virgin[2]) return 1; - if (current[3] && classify_word(current[3]) & virgin[3]) return 1; + if (unlikely(current[0] && classify_word(current[0]) & virgin[0])) return 1; + if (unlikely(current[1] && classify_word(current[1]) & virgin[1])) return 1; + if (unlikely(current[2] && classify_word(current[2]) & virgin[2])) return 1; + if (unlikely(current[3] && classify_word(current[3]) & virgin[3])) return 1; } |