There is a trick borrowed from Lemire that I am using to implement left shift when unavailable: multiply by 2^n.
(The rest of the trick is that for right shifting, if you known that you data will "fit", you can left shift everything by some amount followed by a constant right shift on the whole batch).
With this, we can add missing variable shift on x86_64 for:
- SSE2:
- left
uint16_t
- left
uint32_t
- AVX2:
On top of this, we can implement variable shift by calling twice a shift twice + mask on an integer size twice as big, so that further enables:
- SSE2:
- AVX2:
- left
uint8_t
- right
uint16_t
- right
uint8_t
The main drawback is adding a new batch_constant API for left shift (more code to re-dispatch in the general case). This is necessary because we need the left shift to create the power of two.
I think this is still useful because it enables some shifts for the whole SSE inheritance.
I have a working partial implementation that I could turn into a PR in the next couple days, and hopefully into the 14.0 release. What do you think @serge-sans-paille?
There is a trick borrowed from Lemire that I am using to implement left shift when unavailable: multiply by 2^n.
(The rest of the trick is that for right shifting, if you known that you data will "fit", you can left shift everything by some amount followed by a constant right shift on the whole batch).
With this, we can add missing variable shift on
x86_64for:uint16_tuint32_tuint16_tOn top of this, we can implement variable shift by calling twice a shift twice + mask on an integer size twice as big, so that further enables:
uint8_tuint8_tuint16_tuint8_tThe main drawback is adding a new
batch_constantAPI for left shift (more code to re-dispatch in the general case). This is necessary because we need the left shift to create the power of two.I think this is still useful because it enables some shifts for the whole SSE inheritance.
I have a working partial implementation that I could turn into a PR in the next couple days, and hopefully into the 14.0 release. What do you think @serge-sans-paille?