[php-src] PR #23795: ext/standard: Remove useless _mm_movemask_epi8 check in rot13
| From: | LamentXU123 | Date: | Sun, 20 Sep 2026 16:01:40 +0000 |
| Subject: | [php-src] PR #23795: ext/standard: Remove useless _mm_movemask_epi8 check in rot13 | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-38633@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23795
Author: LamentXU123
The _mm_movemask_epi8 if-branch seems useless. From comparing, the only possible cases for each byte
is 0x00 and 0xFF. So just perform the
and and or command anyways is always
correct.
When the mask aren't all zero, removing them is certainly faster cuz we save a
_mm_movemask_epi8 call. When it is all zero, from my limited knowledge I think the
[pand](https://uops.info/html-instr/PAND_XMM_XMM.html#MTL-P) and
[por](https://uops.info/html-instr/POR_XMM_XMM.html#MTL-P) command is always faster
than [pmovmskb](https://uops.info/html-instr/PMOVMSKB_R32_XMM.html#MTL-P). But I might
be wrong.
I tested this on my personal PC and the improvements are quite stable. ~1.2x-1.3x But note that my
env is kind of noisy.