3 ms·
As it turns out, yes: https://godbolt.org/z/xEqrx5dY4 https://godbolt.org/z/xEqrx5dY4 SSE2 adds the PSRL/PSLL operators, which are basically i128 shift operato
by jcranmer 2y ago
As it turns out, yes: https://godbolt.org/z/xEqrx5dY4 https://godbolt.org/z/xEqrx5dY4
SSE2 adds the PSRL/PSLL operators, which are basically i128 shift operators on vector registers (i.e., shift continues between lanes), so you can pretty easily map i128 to vector registers if you're only doing and/or/xor/shifts.
- pbsd 2y agoThe 128-bit wide shifts PS{L,R}LDQ only have byte granularity. They're a special case of a byte shuffle.
- acchow 2y agoNo, it doesn't shift across 64-bit boundaries. Take a look at the gcc output in your link ``` movdqa xmm0, XMMWORD PTR [rdi] movdqa xmm1, xmm0 psrlq xmm0, 10 psrldq xmm1, 8 psllq xmm1, 54 por xmm0, xmm1 movdqa xmm1, XMMWORD PTR .LC0[rip] ``` That's a lot of psr and psl instructions for a "single 128-bit wide shift"...