3 ms·
I'd forgotten that these exist, but I'm not sure they are going to help here. You save something doing 2 ranges at once, but Agner says each pcmpistrm takes 3
by nkurz 11y ago
I'd forgotten that these exist, but I'm not sure they are going to help here. You save something doing 2 ranges at once, but Agner says each pcmpistrm takes 3 µops that must be on P0, while the pcmpgtb can go on P01, and the pand goes on P015. Certainly worth trying, though.
My instinct was that switching to AVX2 was going to be a big win, but doesn't help as much as I hoped. Part of this is that we're coming reading and writing to memory (that is, it gets faster if I make the buffers fit in L1) but still not astounding. Not sure what the limiting factor is.
Here's what I see on Skylake i7-6700 3.40GHz:
nate@skylake:~/git/WojciechMula-toys/base64/decode/sse$ ./speed
input size: 67108864
improved scalar... 0.024
scalar... 0.041 (speed up: 0.59)
SSE... 0.018 (speed up: 1.30)
SSE & BMI2... 0.016 (speed up: 1.47)
AVX & BMI2... 0.015 (speed up: 1.63)
- nkurz 11y agoThe straight 256-bit AVX solution (no pext) goes a bit faster out of memory: AVX... 0.013 (speed up: 1.80) And even better out of L1: nate@skylake:~/git/WojciechMula-toys/base64/decode/sse$ ./speed input size: 8192 improved scalar... 2.481 scalar... 4.839 (speed up: 0.51) SSE... 1.918 (speed up: 1.29) SSE & BMI2... 1.668 (speed up: 1.49) AVX... 1.127 (speed up: 2.20) AVX & BMI2... 1.290 (speed up: 1.92) (Absolute times aren't comparable between Mem and L1, just the ratios within each)