swps3
DynProgr_altivec.cc File Reference

Profile generation and alignment on IBM Altivec^TM instruction set. More...

#include "matrix.h"
#include "DynProgr_altivec.h"
#include <cstdlib>
#include <malloc.h>
#include <float.h>
#include <cstdio>
#include <string.h>
#include <altivec.h>
#include <sys/types.h>
Include dependency graph for DynProgr_altivec.cc:

Go to the source code of this file.

Classes

struct  IsInteger< T >
 
struct  IsInteger< int16_t >
 
struct  IsInteger< int32_t >
 
struct  IsInteger< int8_t >
 
struct  IsInteger< u_int16_t >
 
struct  IsInteger< u_int32_t >
 
struct  IsInteger< u_int8_t >
 
struct  IsSigned< T >
 
struct  MaxValue< T >
 
struct  MaxValue< double >
 
struct  MaxValue< float >
 
struct  MinValue< T >
 
struct  MinValue< double >
 
struct  MinValue< float >
 
struct  Profile< T, V >
 

Macros

#define ALIGN16(x)   (((x)+15)&(-16))
 

Typedefs

typedef vector float v_float_t
 Saturated addition for floating point data types.
 

Functions

template<typename T , typename V >
static Profile< T, V > * allocateProfile (int len)
 Allocates a profile data structure.
 
template<typename T , typename V >
static T dynProgrLocal (const char *db, int dbLen, Profile< T, V > *profile, Options *options)
 Performs an local alignment using the given profile and database sequence.
 
template<typename T , typename V >
static T dynProgrLocal2 (const char *db, int dbLen, Profile< T, V > *profile, Options *options)
 Unrolled version of dynProgrLocal
 
template<typename T , typename V >
void freeProfile (Profile< T, V > *profile)
 Releases memory occupied by a profile data structure.
 
template<typename T >
static T max (T a, T b)
 
template<typename T >
static T min (T a, T b)
 
template<typename T , typename V , typename X >
EXPORT Profile< T, V > * swps3_createProfileAltivec (const char *query, int queryLen, X *simi)
 Template version for allocation and computation of a profile for the given data type and similarity matrix.
 
EXPORT void * swps3_createProfileByteAltivec (const char *query, int queryLen, SBMatrix matrix)
 C version for allocation and computation of a 8-bit integer profile for the given data type and similarity matrix.
 
EXPORT void * swps3_createProfileFloatAltivec (const char *query, int queryLen, SBMatrix matrix)
 C version for allocation and computation of a 32-bit floating point profile for the given data type and similarity matrix.
 
EXPORT void * swps3_createProfileShortAltivec (const char *query, int queryLen, SBMatrix matrix)
 C version for allocation and computation of a 16-bit integer profile for the given data type and similarity matrix.
 
template<typename T , typename V >
EXPORT double swps3_dynProgrAltivec (const char *db, int dbLen, Profile< T, V > *profile, Options *options)
 Template version of alignment routine for Altivec.
 
EXPORT double swps3_dynProgrByteAltivec (const char *db, int dbLen, void *profile, Options *options)
 C version of alignment routine for Altivec for signed 8-bit integers.
 
EXPORT double swps3_dynProgrFloatAltivec (const char *db, int dbLen, void *profile, Options *options)
 C version of alignment routine for Altivec for signed 32-bit floating point values.
 
EXPORT double swps3_dynProgrShortAltivec (const char *db, int dbLen, void *profile, Options *options)
 C version of alignment routine for Altivec for signed 16-bit integers.
 
template<typename V >
static V vec_addx (V a, V b)
 Saturated addition for integer data types.
 
template<>
static v_float_t vec_addx< v_float_t > (v_float_t a, v_float_t b)
 
template<typename V >
static V vec_subx (V a, V b)
 Saturated subtraction for integer data types.
 
template<>
static v_float_t vec_subx< v_float_t > (v_float_t a, v_float_t b)
 

Detailed Description

Profile generation and alignment on IBM Altivec^TM instruction set.

Definition in file DynProgr_altivec.cc.

Macro Definition Documentation

#define ALIGN16 (   x)    (((x)+15)&(-16))

Typedef Documentation

typedef vector float v_float_t

Saturated addition for floating point data types.

Saturated substraction for floating point data types.

Definition at line 118 of file DynProgr_altivec.cc.

Function Documentation

template<typename T , typename V >
static Profile<T,V>* allocateProfile ( int  len)
inlinestatic

Allocates a profile data structure.

Parameters
TThe datatype for the profile.
VThe datatype of the corresponding packed vectors.
lenThe query length.
Returns
A profile data structure.

Definition at line 81 of file DynProgr_altivec.cc.

References ALIGN16, Profile< T, V >::len, Profile< T, V >::loadOpt, MATRIX_DIM, profile, Profile< T, V >::profile, Profile< T, V >::rD, Profile< T, V >::storeOpt, and T.

template<typename T , typename V >
static T dynProgrLocal ( const char *  db,
int  dbLen,
Profile< T, V > *  profile,
Options options 
)
inlinestatic

Performs an local alignment using the given profile and database sequence.

Parameters
dbThe database sequence.
dbLenThe length of the database sequence.
profileThe profile created previously from the query sequence.
optionsSome global options.
Returns
The local alignment score or a maximum value if result exceeds threshold.

Definition at line 152 of file DynProgr_altivec.cc.

References ALIGN16, Profile< T, V >::bias, Options::gapExt, Options::gapOpen, Profile< T, V >::len, LIKELY, Profile< T, V >::loadOpt, Profile< T, V >::profile, Profile< T, V >::rD, Profile< T, V >::storeOpt, T, UNLIKELY, vec_addx(), and vec_subx().

template<typename T , typename V >
static T dynProgrLocal2 ( const char *  db,
int  dbLen,
Profile< T, V > *  profile,
Options options 
)
inlinestatic

Unrolled version of dynProgrLocal

Parameters
dbThe database sequence.
dbLenThe length of the database sequence.
profileThe profile created previously from the query sequence.
optionsSome global options.
Returns
The local alignment score or a maximum value if result exceeds threshold.
See Also
dynProgrLocal()
swps3_createProfileAltivec()

Definition at line 365 of file DynProgr_altivec.cc.

References ALIGN16, Profile< T, V >::bias, Options::gapExt, Options::gapOpen, Profile< T, V >::len, LIKELY, Profile< T, V >::loadOpt, Profile< T, V >::profile, Profile< T, V >::rD, Profile< T, V >::storeOpt, T, UNLIKELY, vec_addx(), and vec_subx().

template<typename T , typename V >
void freeProfile ( Profile< T, V > *  profile)

Releases memory occupied by a profile data structure.

Definition at line 98 of file DynProgr_altivec.cc.

References Profile< T, V >::loadOpt, Profile< T, V >::profile, Profile< T, V >::rD, and Profile< T, V >::storeOpt.

template<typename T >
static T max ( T  a,
T  b 
)
inlinestatic

Definition at line 44 of file DynProgr_altivec.cc.

template<typename T >
static T min ( T  a,
T  b 
)
inlinestatic

Definition at line 43 of file DynProgr_altivec.cc.

template<typename T , typename V , typename X >
EXPORT Profile<T,V>* swps3_createProfileAltivec ( const char *  query,
int  queryLen,
X *  simi 
)

Template version for allocation and computation of a profile for the given data type and similarity matrix.

Parameters
TThe data type for the alignment scores.
VThe corresponding packed vector data type.
XThe data type of the similarity matrix.
queryThe query sequence.
queryLenThe length of the query sequence.
simiThe similarity matrix.
Returns
An initialized profile data structure.

Definition at line 629 of file DynProgr_altivec.cc.

References ALIGN16, MATRIX_DIM, profile, Profile< T, V >::profile, and T.

EXPORT void* swps3_createProfileByteAltivec ( const char *  query,
int  queryLen,
SBMatrix  matrix 
)

C version for allocation and computation of a 8-bit integer profile for the given data type and similarity matrix.

Parameters
queryThe query sequence.
queryLenThe length of the query sequence.
matrixThe similarity matrix.
Returns
An initialized profile data structure.

Definition at line 774 of file DynProgr_altivec.cc.

Referenced by main().

EXPORT void* swps3_createProfileFloatAltivec ( const char *  query,
int  queryLen,
SBMatrix  matrix 
)

C version for allocation and computation of a 32-bit floating point profile for the given data type and similarity matrix.

Parameters
queryThe query sequence.
queryLenThe length of the query sequence.
matrixThe similarity matrix.
Returns
An initialized profile data structure.

Definition at line 804 of file DynProgr_altivec.cc.

Referenced by main().

EXPORT void* swps3_createProfileShortAltivec ( const char *  query,
int  queryLen,
SBMatrix  matrix 
)

C version for allocation and computation of a 16-bit integer profile for the given data type and similarity matrix.

Parameters
queryThe query sequence.
queryLenThe length of the query sequence.
matrixThe similarity matrix.
Returns
An initialized profile data structure.

Definition at line 789 of file DynProgr_altivec.cc.

Referenced by main().

template<typename T , typename V >
EXPORT double swps3_dynProgrAltivec ( const char *  db,
int  dbLen,
Profile< T, V > *  profile,
Options options 
)

Template version of alignment routine for Altivec.

To be called from C++ code.

Parameters
TThe data type for the alignment scores.
VThe corresponding packed vector data type.
dbThe database sequence.
dbLenThe length of the database sequence.
profileA profile data structure previously computed from the query sequence.
optionsSome global options.
Returns
The local alignment score or DBL_MAX if score exceeds threshold.
See Also
swps3_createProfileAltivec()

Definition at line 669 of file DynProgr_altivec.cc.

References profile, and T.

EXPORT double swps3_dynProgrByteAltivec ( const char *  db,
int  dbLen,
void *  profile,
Options options 
)

C version of alignment routine for Altivec for signed 8-bit integers.

Parameters
dbThe database sequence.
dbLenThe length of the database sequence.
profileA profile data structure previously computed from the query sequence.
optionsSome global options.
Returns
The local alignment score or DBL_MAX if score exceeds threshold.
See Also
swps3_createProfileByteAltivec()
swps3_dynProgrAltivec()

Definition at line 718 of file DynProgr_altivec.cc.

Referenced by main().

EXPORT double swps3_dynProgrFloatAltivec ( const char *  db,
int  dbLen,
void *  profile,
Options options 
)

C version of alignment routine for Altivec for signed 32-bit floating point values.

Parameters
dbThe database sequence.
dbLenThe length of the database sequence.
profileA profile data structure previously computed from the query sequence.
optionsSome global options.
Returns
The local alignment score or DBL_MAX if score exceeds threshold.
See Also
swps3_createProfileFloatAltivec()
swps3_dynProgrAltivec()

Definition at line 759 of file DynProgr_altivec.cc.

Referenced by main().

EXPORT double swps3_dynProgrShortAltivec ( const char *  db,
int  dbLen,
void *  profile,
Options options 
)

C version of alignment routine for Altivec for signed 16-bit integers.

Parameters
dbThe database sequence.
dbLenThe length of the database sequence.
profileA profile data structure previously computed from the query sequence.
optionsSome global options.
Returns
The local alignment score or DBL_MAX if score exceeds threshold.
See Also
swps3_createProfileShortAltivec()
swps3_dynProgrAltivec()

Definition at line 738 of file DynProgr_altivec.cc.

Referenced by main().

template<typename V >
static V vec_addx ( a,
b 
)
inlinestatic

Saturated addition for integer data types.

Definition at line 110 of file DynProgr_altivec.cc.

Referenced by dynProgrLocal(), and dynProgrLocal2().

template<>
static v_float_t vec_addx< v_float_t > ( v_float_t  a,
v_float_t  b 
)
inlinestatic

Definition at line 119 of file DynProgr_altivec.cc.

template<typename V >
static V vec_subx ( a,
b 
)
inlinestatic

Saturated subtraction for integer data types.

Definition at line 127 of file DynProgr_altivec.cc.

Referenced by dynProgrLocal(), and dynProgrLocal2().

template<>
static v_float_t vec_subx< v_float_t > ( v_float_t  a,
v_float_t  b 
)
inlinestatic

Definition at line 136 of file DynProgr_altivec.cc.