Bit-wise operation and strict alising
I am trying to write some high-performance functions for bit-based operations that taking the advantage of latest features of hardware, the problem I am facing is:
I want to include a bit-wise count operation, in which case I used Intel SSE4.2
's popcnt
that only accecpt integer type values.
Whilst, if I need to conduct other bitwise logical operations, then AVX
support 256-bit wide bit-wise logical operations like VORPD
(instead of SSE2
's 128 bit wide bit-wise logical operations), but only on floating data.
Coupling with the fact for bit-wise setting/resetting operations, char is fastest, so I may need at least three types of pointers pointed to the same memory locations: a char type, a long long (64-bit integer for optimal bit-wise counting), and a floating type pointers, however the co-existence of Integer and floating type of pointers break the strict-aliasing rules.
Any suggestion to working around with this? thanks.