https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110331

            Bug ID: 110331
           Summary: ppc64 vec_extract with constant index is suboptimal on
                    P8
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: guihaoc at gcc dot gnu.org
  Target Milestone: ---

//test.c
#include <altivec.h>

#ifdef __BIG_ENDIAN__
#define LANE_B 3
#else
#define LANE_B 12
#endif

unsigned char foo1 (vector unsigned char v)
{
  return vec_extract (v, LANE_B);
}

Trunk generates:
        vspltb 2,2,3
        mfvsrd 3,34
        rlwinm 3,3,0,0xff

While it can be optimized as:
        mfvsrd 3,34
        rldicl 3,3,32,56

Reply via email to