arch-specific template code

Ulrich Drepper drepper@gmail.com
Sat Sep 8 18:01:00 GMT 2012


On Sat, Sep 8, 2012 at 10:18 AM, Marc Glisse <marc.glisse@inria.fr> wrote:
> So this one is equivalent to doing >> or << on each element independently?
> Should already work in C, and 54427 should add it to C++ then :-)

If you test it...


> I believe every __builtin_shuffle that can be done in a single instruction
> is already properly expanded on x86. For this 16 byte vector shuffle, it
> uses pshufb. Is there a better instruction?

The shuffle operations need a memory or [xy]mm register parameter.
That's expensive to set up.  The shuffling which doesn't rearrange
bytes but just rotates them should use the equivalent of the

  _mm_srli_si128

and

  _mm_slli_si128

intrinsics.  I agree, if the shuffle operations can recognize these
special cases there is no further operation needed.



More information about the Libstdc++ mailing list