12.12 Using Accumulators

To access only HI or LO of an accumulator, use a union type as follows.

  typedef union
  {
    long long a;   // One 64-bit accumulator
    int b[2];      // 32-bit HI and LO
  } a64_union;

To access HI, use b[1]. To access LO, use b[0].

Example:

  int test (long long a, v2q15 b, v2q15 c)
  {
    a64_union temp;
    temp.a = __builtin_mips_dpaq_s_w_ph (a, b, c);
    return temp.b[0];  // access LO.
  }