Created
May 30, 2018 13:41
-
-
Save geofflangdale/c3d9e21cf7d160847bc2c6e56d038ac3 to your computer and use it in GitHub Desktop.
SMH "good bits", without DEBUG code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct SIMD_SMH_PART { | |
m256 shuf_mask; | |
m256 cmp_mask; | |
m256 and_mask; // not yet used | |
m256 sub_mask; // not yet used | |
u32 doit(m256 d) { | |
return _mm256_movemask_epi8( | |
_mm256_cmpeq_epi8(_mm256_shuffle_epi8(d, shuf_mask), | |
cmp_mask)); | |
} | |
}; | |
struct GPR_SMH_PART { | |
u64 hi; | |
u64 low; | |
u64 doit(u64 m, bool loose_fit) { | |
if (loose_fit) { | |
return (m + low) & hi; | |
} else { | |
return ((m & ~hi) + low) & (m & hi); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment