vec_lvsl is deprecated for little endian; use assignment for unaligned loads

Jeffrey Walton noloader@gmail.com
Wed Sep 20 08:49:00 GMT 2017


Hi Everyone,

We are catching a warning using AltiVec built-ins:

test.cpp:913:42: warning: vec_lvsl is deprecated for little endian;
use assignment for unaligned loads and stores [-Wdeprecated]
  const uint8x16_p8 perm = vec_lvsl(0, src);

The warning is coming from this type of code, which was taken from the
AltiVec PIM:

// Loads a byte array, does not perform an endian conversion.
//  This function requires the subkey table is correct endianess.
inline VectorType VectorLoadKey(const byte src[16])
{
    const uint8x16_p8 perm = vec_lvsl(0, src);
    const uint8x16_p8 low = vec_ld(0, src);
    const uint8x16_p8 high = vec_ld(15, src);
    return (VectorType)vec_perm(low, high, perm);
}

Its not clear to me how to use assignment to load a vector or store a
vector. I'm also not sure if it includes the automatic endian
conversion, which is something we don't want because the byte arrays
are big endian. (Otherwise we would use a newer function like
vec_vsx_ld).

How do does one load a vector with assignment and not invoke the
automatic endian conversions?

Jeff



More information about the Gcc-help mailing list