On Sat, 10 Dec 2016, Allan Sandfeld Jensen wrote:

Replaces the definitions of the shift intrinsics with GCC extension syntax to
allow GCC to reason about what the instructions does. Tests are added to
ensure the intrinsics still produce the right instructions, and that a few
basic optimizations now work.

I don't think we can do it in such a straightforward way. Those intrinsics are well defined for any shift argument, while operator<< and operator>> are considered undefined for many input values. I believe you may need to use an unsigned type for the lhs of left shifts, and write a << (b & 31) to match the semantics for the rhs (I haven't checked Intel's doc). Which might require adding a few patterns in sse.md to avoid generating code for that AND.

(also, the patch can't go in until next stage 1, around March or April, but that doesn't prevent from discussing it)

--
Marc Glisse

Reply via email to