4 ms·
the SIMD usage is mainly to do two things. In the lexer, it is used for block comment skipping. It will find the end of block comments 16 characters at a tim
by DannyBee 13y ago
the SIMD usage is mainly to do two things.
In the lexer, it is used for block comment skipping. It will find the end of block comments 16 characters at a time (on both PPC and x86).
During line number computation, it will also find newlines 16 characters at a time.
This could actually (nowadays) be done 32 characters at a time on newer processors, but isn't.
- WalterBright 13y agoI'm curious how much of an effect this has.
- jevinskie 13y ago64 characters with AVX-512? =)
- DannyBee 13y agoI didn't check to see if the instructions exist, but possibly :) You do start to hit two issues though as oyu increase the size of the skipping: 1. Alignment 2. If the average block comment/line is < 64 characters, you may lose more time performing the instruction and then counting the trailing zeros in the result to find the place it ended. I have no numbers to back up whether this matters, of course :)
- pbsd 13y agoAVX-512 does not seem to have PMOVMSKB, which is how I assume it is being done with SSE2. There are other ways to skin that cat, but it's unclear whether they have any advantage over using AVX2 with VPMOVMSKB.
- jfb 13y agoThis is flat-out fascinating. Thanks.