http://vegard.wiki/mediawiki/index.php?title=SSE_routines&feed=atom&action=history
SSE routines - Revision history
2024-03-28T12:22:09Z
Revision history for this page on the wiki
MediaWiki 1.33.1
http://vegard.wiki/mediawiki/index.php?title=SSE_routines&diff=339&oldid=prev
Vegard: add link from saidwho12
2022-11-22T08:54:26Z
<p>add link from saidwho12</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 08:54, 22 November 2022</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l64" >Line 64:</td>
<td colspan="2" class="diff-lineno">Line 64:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* https://software.intel.com/sites/landingpage/IntrinsicsGuide/</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* https://software.intel.com/sites/landingpage/IntrinsicsGuide/</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">* https://woboq.com/blog/utf-8-processing-using-simd.html</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Programming]]</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Programming]]</div></td></tr>
</table>
Vegard
http://vegard.wiki/mediawiki/index.php?title=SSE_routines&diff=48&oldid=prev
Vegard at 22:33, 14 December 2019
2019-12-14T22:33:12Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 22:33, 14 December 2019</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l68" >Line 68:</td>
<td colspan="2" class="diff-lineno">Line 68:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Category:C]]</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Category:C]]</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Category:C++]]</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Category:C++]]</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">[[Category:x86]]</ins></div></td></tr>
</table>
Vegard
http://vegard.wiki/mediawiki/index.php?title=SSE_routines&diff=35&oldid=prev
Vegard: new page
2019-12-14T19:23:28Z
<p>new page</p>
<p><b>New page</b></p><div>=== Boilerplate ===<br />
<br />
<source lang="C"><br />
#include <emmintrin.h><br />
</source><br />
<br />
=== Get length of string prefix consisting of letters and underscore ===<br />
<br />
This can be useful for e.g. parsing identifiers.<br />
<br />
The string does not need to be aligned, but beware that up to 15 bytes after the NUL terminator may be loaded from memory, so if these cross a page boundary you can get spurious page faults.<br />
<br />
<source lang="C"><br />
int nr_alpha(const char *s)<br />
{<br />
const char *start = s;<br />
<br />
__m128i ch_A = _mm_set1_epi8('A' - 1);<br />
__m128i ch_Z = _mm_set1_epi8('Z');<br />
__m128i ch_underscore = _mm_set1_epi8('_');<br />
<br />
while (1) {<br />
__m128i ch = _mm_loadu_si128((__m128i *) s);<br />
__m128i b = _mm_and_si128(ch, _mm_set1_epi8(~0x20));<br />
b = _mm_or_si128(_mm_and_si128(_mm_cmpgt_epi8(b, ch_A),<br />
_mm_cmplt_epi8(b, ch_Z)),<br />
_mm_cmpeq_epi8(ch, ch_underscore));<br />
<br />
unsigned int ffs = __builtin_ffs(~_mm_movemask_epi8(b)) - 1;<br />
s += ffs;<br />
<br />
if (ffs < 16)<br />
return s - start;<br />
}<br />
}<br />
</source><br />
<br />
=== Get length of string prefix consisting of whitespace ===<br />
<br />
(See caveats above.)<br />
<br />
<source lang="C"><br />
int nr_whitespace(const char *s)<br />
{<br />
const char *start = s;<br />
<br />
while (1) {<br />
__m128i ch = _mm_loadu_si128((__m128i *) s);<br />
__m128i b = _mm_or_si128(_mm_cmpeq_epi8(ch, _mm_set1_epi8(' ')),<br />
_mm_cmpeq_epi8(ch, _mm_set1_epi8('\t')));<br />
b = _mm_or_si128(b, _mm_cmpeq_epi8(ch, _mm_set1_epi8('\r')));<br />
b = _mm_or_si128(b, _mm_cmpeq_epi8(ch, _mm_set1_epi8('\n')));<br />
<br />
unsigned int ffs = __builtin_ffs(~_mm_movemask_epi8(b)) - 1;<br />
s += ffs;<br />
<br />
if (ffs < 16)<br />
return s - start;<br />
}<br />
}<br />
</source><br />
<br />
== See also ==<br />
<br />
* https://software.intel.com/sites/landingpage/IntrinsicsGuide/<br />
<br />
[[Category:Programming]]<br />
[[Category:C]]<br />
[[Category:C++]]</div>
Vegard