Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Functions | Variables
mpv_sparc.c File Reference
#include "vis_proto.h"

Go to the source code of this file.

Classes

union  d64_2_i32
struct  d64_2_i32.i32s

Defines

#define BUFF_SIZE   256
#define A_BITS   19
#define A_MASK   ((1 << A_BITS) - 1)
#define DEF_VARS(N)
#define MUL_U32_S64_2(i)
#define MUL_U32_S64_2_D(i)
#define ADD_S64_U32(i)
#define ADD_S64_U32_D(i)
#define MUL_U32_S64_8(i)
#define MUL_U32_S64_D_8(i)
#define ADD_S64_U32_8(i)
#define ADD_S64_U32_D_8(i)

Typedefs

typedef int t_s32
typedef unsigned int t_u32
typedef long long t_s64
typedef unsigned long long t_u64
typedef double t_d64

Functions

t_u32 mul_add (t_u32 *z, t_u32 *x, t_u32 *y, int n, t_u32 a)
t_u32 mul_add_inp (t_u32 *x, t_u32 *y, int n, t_u32 a)

Variables

static t_u64 mask_cnst []

Class Documentation

union d64_2_i32

Definition at line 55 of file mpv_sparc.c.

Class Members
t_d64 d64
struct d64_2_i32 i32s
struct d64_2_i32 i32s
struct d64_2_i32.i32s

Definition at line 57 of file mpv_sparc.c.

Class Members
t_s32 i0
t_s32 i1

Define Documentation

#define A_BITS   19

Definition at line 67 of file mpv_sparc.c.

#define A_MASK   ((1 << A_BITS) - 1)

Definition at line 68 of file mpv_sparc.c.

Value:
s = buff[i] + x[i] + c;       \
  z[i] = s;                     \
  c = (s >> 32)

Definition at line 104 of file mpv_sparc.c.

Value:
ADD_S64_U32(i);               \
  ADD_S64_U32(i+1);             \
  ADD_S64_U32(i+2);             \
  ADD_S64_U32(i+3);             \
  ADD_S64_U32(i+4);             \
  ADD_S64_U32(i+5);             \
  ADD_S64_U32(i+6);             \
  ADD_S64_U32(i+7)

Definition at line 130 of file mpv_sparc.c.

Value:
s = buff[2*(i)] +(((t_s64)(buff[2*(i)+1]))<<A_BITS) + x[i] + uc;   \
  z[i] = s;                                     \
  uc = ((t_u64)s >> 32)

Definition at line 109 of file mpv_sparc.c.

Value:
ADD_S64_U32_D(i);             \
  ADD_S64_U32_D(i+1);           \
  ADD_S64_U32_D(i+2);           \
  ADD_S64_U32_D(i+3);           \
  ADD_S64_U32_D(i+4);           \
  ADD_S64_U32_D(i+5);           \
  ADD_S64_U32_D(i+6);           \
  ADD_S64_U32_D(i+7)

Definition at line 140 of file mpv_sparc.c.

#define BUFF_SIZE   256

Definition at line 65 of file mpv_sparc.c.

#define DEF_VARS (   N)
Value:
t_d64 *py = (t_d64*)y;                \
  t_d64 mask = *((t_d64*)mask_cnst);    \
  t_d64 ca = (1u << 31) - 1;            \
  t_d64 da = (t_d64)a;                  \
  t_s64 buff[N], s;                     \
  d64_2_i32 dy

Definition at line 78 of file mpv_sparc.c.

Value:
dy.d64 = vis_fxnor(mask, py[i]);                      \
  buff[2*(i)  ] = (ca - (t_d64)dy.i32s.i0) * da;        \
  buff[2*(i)+1] = (ca - (t_d64)dy.i32s.i1) * da

Definition at line 88 of file mpv_sparc.c.

Value:
dy.d64 = vis_fxnor(mask, py[i]);      \
  d0 = ca - (t_d64)dy.i32s.i0;          \
  d1 = ca - (t_d64)dy.i32s.i1;          \
  buff[4*(i)  ] = (t_s64)(d0 * da);     \
  buff[4*(i)+1] = (t_s64)(d0 * db);     \
  buff[4*(i)+2] = (t_s64)(d1 * da);     \
  buff[4*(i)+3] = (t_s64)(d1 * db)

Definition at line 93 of file mpv_sparc.c.

Value:
MUL_U32_S64_2(i);             \
  MUL_U32_S64_2(i+1);           \
  MUL_U32_S64_2(i+2);           \
  MUL_U32_S64_2(i+3)

Definition at line 116 of file mpv_sparc.c.

Value:
MUL_U32_S64_2_D(i);           \
  MUL_U32_S64_2_D(i+1);         \
  MUL_U32_S64_2_D(i+2);         \
  MUL_U32_S64_2_D(i+3)

Definition at line 122 of file mpv_sparc.c.


Typedef Documentation

typedef double t_d64

Definition at line 51 of file mpv_sparc.c.

typedef int t_s32

Definition at line 42 of file mpv_sparc.c.

typedef long long t_s64

Definition at line 48 of file mpv_sparc.c.

typedef unsigned int t_u32

Definition at line 43 of file mpv_sparc.c.

typedef unsigned long long t_u64

Definition at line 49 of file mpv_sparc.c.


Function Documentation

t_u32 mul_add ( t_u32 z,
t_u32 x,
t_u32 y,
int  n,
t_u32  a 
)

Definition at line 152 of file mpv_sparc.c.

{
  if (a < (1 << A_BITS)) {

    if (n == 8) {
      DEF_VARS(8);
      t_s32 c = 0;

      MUL_U32_S64_8(0);
      ADD_S64_U32_8(0);

      return c;

    } else if (n == 16) {
      DEF_VARS(16);
      t_s32 c = 0;

      MUL_U32_S64_8(0);
      MUL_U32_S64_8(4);
      ADD_S64_U32_8(0);
      ADD_S64_U32_8(8);

      return c;

    } else {
      DEF_VARS(BUFF_SIZE);
      t_s32 i, c = 0;

#pragma pipeloop(0)
      for (i = 0; i < (n+1)/2; i ++) {
        MUL_U32_S64_2(i);
      }

#pragma pipeloop(0)
      for (i = 0; i < n; i ++) {
        ADD_S64_U32(i);
      }

      return c;

    }
  } else {

    if (n == 8) {
      DEF_VARS(2*8);
      t_d64 d0, d1, db;
      t_u32 uc = 0;

      da = (t_d64)(a &  A_MASK);
      db = (t_d64)(a >> A_BITS);

      MUL_U32_S64_D_8(0);
      ADD_S64_U32_D_8(0);

      return uc;

    } else if (n == 16) {
      DEF_VARS(2*16);
      t_d64 d0, d1, db;
      t_u32 uc = 0;

      da = (t_d64)(a &  A_MASK);
      db = (t_d64)(a >> A_BITS);

      MUL_U32_S64_D_8(0);
      MUL_U32_S64_D_8(4);
      ADD_S64_U32_D_8(0);
      ADD_S64_U32_D_8(8);

      return uc;

    } else {
      DEF_VARS(2*BUFF_SIZE);
      t_d64 d0, d1, db;
      t_u32 i, uc = 0;

      da = (t_d64)(a &  A_MASK);
      db = (t_d64)(a >> A_BITS);

#pragma pipeloop(0)
      for (i = 0; i < (n+1)/2; i ++) {
        MUL_U32_S64_2_D(i);
      }

#pragma pipeloop(0)
      for (i = 0; i < n; i ++) {
        ADD_S64_U32_D(i);
      }

      return uc;
    }
  }
}
t_u32 mul_add_inp ( t_u32 x,
t_u32 y,
int  n,
t_u32  a 
)

Definition at line 248 of file mpv_sparc.c.

{
  return mul_add(x, x, y, n, a);
}

Here is the call graph for this function:


Variable Documentation

t_u64 mask_cnst[] [static]
Initial value:
 {
  0x8000000080000000ull
}

Definition at line 72 of file mpv_sparc.c.