6.60.16 MIPS SIMD Architecture (MSA) Support

GCC provides intrinsics to access the SIMD instructions provided by the MSA MIPS SIMD Architecture. The interface is made available by including <msa.h> and using -mmsa -mhard-float -mfp64 -mnan=2008. For each __builtin_msa_*, there is a shortened name of the intrinsic, __msa_*.

MSA implements 128-bit wide vector registers, operating on 8-, 16-, 32- and 64-bit integer, 16- and 32-bit fixed-point, or 32- and 64-bit floating point data elements. The following vectors typedefs are included in msa.h:

  • v16i8, a vector of sixteen signed 8-bit integers;
  • v16u8, a vector of sixteen unsigned 8-bit integers;
  • v8i16, a vector of eight signed 16-bit integers;
  • v8u16, a vector of eight unsigned 16-bit integers;
  • v4i32, a vector of four signed 32-bit integers;
  • v4u32, a vector of four unsigned 32-bit integers;
  • v2i64, a vector of two signed 64-bit integers;
  • v2u64, a vector of two unsigned 64-bit integers;
  • v4f32, a vector of four 32-bit floats;
  • v2f64, a vector of two 64-bit doubles.

Instructions and corresponding built-ins may have additional restrictions and/or input/output values manipulated:

  • imm0_1, an integer literal in range 0 to 1;
  • imm0_3, an integer literal in range 0 to 3;
  • imm0_7, an integer literal in range 0 to 7;
  • imm0_15, an integer literal in range 0 to 15;
  • imm0_31, an integer literal in range 0 to 31;
  • imm0_63, an integer literal in range 0 to 63;
  • imm0_255, an integer literal in range 0 to 255;
  • imm_n16_15, an integer literal in range -16 to 15;
  • imm_n512_511, an integer literal in range -512 to 511;
  • imm_n1024_1022, an integer literal in range -512 to 511 left shifted by 1 bit, i.e., -1024, -1022, …, 1020, 1022;
  • imm_n2048_2044, an integer literal in range -512 to 511 left shifted by 2 bits, i.e., -2048, -2044, …, 2040, 2044;
  • imm_n4096_4088, an integer literal in range -512 to 511 left shifted by 3 bits, i.e., -4096, -4088, …, 4080, 4088;
  • imm1_4, an integer literal in range 1 to 4;
  • i32, i64, u32, u64, f32, f64, defined as follows:
{
typedef int i32;
#if __LONG_MAX__ == __LONG_LONG_MAX__
typedef long i64;
#else
typedef long long i64;
#endif

typedef unsigned int u32;
#if __LONG_MAX__ == __LONG_LONG_MAX__
typedef unsigned long u64;
#else
typedef unsigned long long u64;
#endif

typedef double f64;
typedef float f32;
}

Next: , Previous: , Up: Target Builtins [Contents][Index]

© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-9.3.0/gcc/MIPS-SIMD-Architecture-_0028MSA_0029-Support.html