Skip to content

Commit

Permalink
disable memcmpne for EMU_AVX2
Browse files Browse the repository at this point in the history
  • Loading branch information
moon-chilled committed Sep 13, 2022
1 parent 7a3945d commit a51ed15
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jsrc/je.h
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ extern D xdouble(X);
extern void readlock(S*,S);
extern void writelock(S*,S);
#endif
#if C_AVX2 || EMU_AVX2
#if C_AVX2 //|| EMU_AVX2
extern I memcmpne(void*, void*, I);
#else
#define memcmpne(s,t,l) (!!memcmp((s),(t),(l)))
Expand Down
2 changes: 2 additions & 0 deletions jsrc/v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ oneloop:;
}
// memcmpne: test for inequality, not caring about order, for exact inputs
// We use AVX2 instructions always, so this might be a little slower for repeat matches on short inputs; but it avoids misbranches
#if !EMU_AVX2
I memcmpne(void *s, void *t, I l){
if(unlikely(l==0))R 0; // loops require nonempty arrays - empties compare equal. If there are no atoms we can't safely fetch anything from memory
// If the first fetch miscompares, we can avoid the setup overhead. This will be worthwhile on long compares, and not too
Expand Down Expand Up @@ -174,6 +175,7 @@ I memcmpne(void *s, void *t, I l){
R !_mm256_testc_pd(_mm256_castsi256_pd(_mm256_cmpeq_epi64(u,v)),ones); // return 1 if any mismatch
// obsolete R 0!=~_mm256_movemask_epi8(_mm256_cmpeq_epi8(u,v)); // no miscompares, compare equal
}
#endif

// memcmpnefl: test for inequality, not caring about order, for float inputs, possibly with tolerance
// We use AVX2 instructions always, so this might be a little slower for repeat matches on short inputs; but it avoids misbranches
Expand Down

0 comments on commit a51ed15

Please sign in to comment.