📄 custom_ops.h
字号:
#ifndef _CUSTOM_OPS_H_#define _CUSTOM_OPS_H_/**************************************************************************** * * custom_ops.h * @(#)custom_ops.h 1.34 10/06/99 * * custom_ops header file. * ****************************************************************************/#if defined(__TCS__)/* * TriMedia compiler driver tmcc defines __TCS__ * these are the custom_op prototypes for the compiler. * they are organized as in custom_defs.h. *//* * 1. Load/Store Operations * * these operations do not have macros * since they are expressible directly in C. * * basic load operations * load with displacement operations * load with index operations * load with scaled index operations * basic store operations * store with displacement operations * * 2. Compute Operations * * the operations which are not directly * expressible in C have macro defines below: * * arithmetic operations */custom_op long imax(long a, long b);custom_op long imin(long a, long b);custom_op unsigned long umin(unsigned long a, unsigned long b);custom_op unsigned long iabs(long a);custom_op long ineg(long a);/* * signed comparison operations * unsigned comparison operations * logical operations */custom_op unsigned long bitandinv(unsigned long a, unsigned long b);custom_op unsigned long rol(unsigned long a, unsigned long b);/* * sign extension operations */custom_op long sex8(long a);custom_op long sex16(long a);custom_op long zex8(long a);custom_op long zex16(long a);/* * 3. Immediate Operations * * the operations which are not directly * expressible in C have macro defines below: * * immediate operations * logical operations */custom_op unsigned long asli(unsigned long a, unsigned long b);custom_op unsigned long roli(unsigned long a, unsigned long b);custom_op unsigned long asri(unsigned long a, unsigned long b);custom_op unsigned long lsri(unsigned long a, unsigned long b);custom_op unsigned long lsli(unsigned long a, unsigned long b);/* * arithmetic operations */custom_op long iaddi(unsigned long a, long b);custom_op long isubi(unsigned long a, long b);/* * signed comparison operations */custom_op long igtri(long a, long b);custom_op long igeqi(long a, long b);custom_op long ieqli(long a, long b);custom_op long ineqi(long a, long b);custom_op long ilesi(long a, long b);custom_op long ileqi(long a, long b);/* * unsigned comparison operations */custom_op long ugtri(unsigned long a, unsigned long b);custom_op long ugeqi(unsigned long a, unsigned long b);custom_op long ueqli(unsigned long a, unsigned long b);custom_op long uneqi(unsigned long a, unsigned long b);custom_op long ulesi(unsigned long a, unsigned long b);custom_op long uleqi(unsigned long a, unsigned long b);/* * * 4. Special Compute Operations * * clipped arithmetic operations */custom_op long dspiadd(long a, long b);custom_op long dspisub(long a, long b);custom_op unsigned long dspuadd(unsigned long a, unsigned long b);custom_op unsigned long dspusub(unsigned long a, unsigned long b);custom_op long dspimul(long a, long b);custom_op unsigned long dspumul(unsigned long a, unsigned long b);custom_op unsigned long dspiabs(long a);/* * carry and borrow operations */custom_op long carry(unsigned long a, unsigned long b);custom_op long borrow(unsigned long a, unsigned long b);/* * special multiply operations */custom_op long imulm(long a, long b);custom_op unsigned long umulm(unsigned long a, unsigned long b);/* * dual arithmetic operations */custom_op unsigned long dspidualabs(long a);custom_op unsigned long dspidualadd(long a, long b);custom_op unsigned long dspidualsub(long a, long b);custom_op unsigned long dspidualmul(long a, long b);/* #if defined(__TCS_tm1100__) *//* * dual shifting operations */custom_op long dualasr(long a, unsigned long b);/* * dual clipping operations */custom_op long dualiclipi(long a, unsigned long b);custom_op unsigned long dualuclipi(long a, unsigned long b);/* #endif defined(__TCS_tm1100__) *//* * byte packing operations */custom_op unsigned long packbytes(long a, long b);custom_op unsigned long mergemsb(unsigned long a, unsigned long b);custom_op unsigned long mergelsb(unsigned long a, unsigned long b);custom_op unsigned long pack16msb(unsigned long a, unsigned long b);custom_op unsigned long pack16lsb(unsigned long a, unsigned long b);/* #if defined(__TCS_tm1100__) */custom_op unsigned long mergedual16lsb(unsigned long a, unsigned long b);/* #endif defined(__TCS_tm1100__) *//* * byte select operations */custom_op unsigned long ubytesel(long a, long b);custom_op long ibytesel(long a, long b);/* * sum of products operations */custom_op unsigned long ufir8uu(unsigned long a, unsigned long b);custom_op long ifir8ui(unsigned long a, long b);custom_op long ifir8ii(long a, long b);custom_op long ifir16(long a, long b);custom_op unsigned long ufir16(unsigned long a, unsigned long b);/* * sum of differences operations */custom_op unsigned long ume8ii(long a, long b);custom_op unsigned long ume8uu(unsigned long a, unsigned long b);/* * special byte shift operations */custom_op unsigned long funshift1(unsigned long a, unsigned long b);custom_op unsigned long funshift2(unsigned long a, unsigned long b);custom_op unsigned long funshift3(unsigned long a, unsigned long b);/* * clip operations */custom_op long iclipi(long a, unsigned long b);custom_op unsigned long uclipi(long a, unsigned long b);custom_op unsigned long uclipu(unsigned long a, unsigned long b);/* * quad arithmetic operations */custom_op unsigned long quadumulmsb(unsigned long a, unsigned long b);custom_op unsigned long quadavg(unsigned long a, unsigned long b);custom_op unsigned long dspuquadaddui(unsigned long a, long b);/* #if defined(__TCS_tm1100__) */custom_op unsigned long quadumax(unsigned long a, unsigned long b);custom_op unsigned long quadumin(unsigned long a, unsigned long b);/* #endif defined(__TCS_tm1100__) *//* * various special compute operations */custom_op long izero(long a, long b);custom_op long inonzero(long a, long b);custom_op long iavgonep(long a, long b);custom_op long iflip(long a, long b);/* * * 5. Special Register Operations * * PCSW operations */custom_op unsigned long readpcsw(void);custom_op void writepcsw(unsigned long val, unsigned long mask);/* * CCCOUNT operations * * cycles: * Return the lower 32 bits of the 64 bit internal clock in cycles * For TM1 running at 100 MHz, it runs up to 42.95 sec. * Unix system call clock() returns clock value in micro-seconds. * hicycles: * Return the upper 32 bits of the 64 bit internal clock in cycles. * Return 0 for UNIX implementation. */custom_op unsigned long cycles(void);custom_op unsigned long hicycles(void);/* * DPC and SPC operations */custom_op unsigned long readdpc(void);custom_op void writedpc(unsigned long val);custom_op unsigned long readspc(void);custom_op void writespc(unsigned long val);/* * * 6. Floating Point Operations * * the operations which are not directly * expressible in C have macro defines below. * * special note: the xxxflags operations are * meant to be used by the compiler and are * therefore not supported here. * * arithmetic operations * comparison operations * single argument operations */custom_op float fsqrt(float f);custom_op float fabsval(float f);custom_op long fsign(float f);/* * float to integer conversions */custom_op long ifixieee(float f);custom_op unsigned long ufixieee(float f);/* * integer to float conversions */custom_op float ifloatrz(long a);custom_op float ufloatrz(unsigned long a);/* * fzero and fnonzero analogous to izero/inonzero */custom_op float fzero(long a, float b);custom_op float fnonzero(long a, float b);/* * dirty tricks to calculate fmin and fmax * analogous to imin and imax * * DO NOT WORK WHEN BOTH FLOATS ARE NEGATIVE * * DO NOT SET APPROPRIATE IEEE FLAGS !! * *//************ READ COMMENT *************/custom_op float fmin(float a, float b);custom_op float fmax(float a, float b);/************ READ COMMENT *************//* * * 7. Cache Operations * * data-cache copyback and invalidate operations * data-cache tag and status operations * instruction-cache operations * data-cache prefetch operations * data-cache allocate operations * * 8. Control Flow Operations * * though these operations are not easily * expressible in C, they are unsafe to * expose to the programmer and therefore * are not supported. * * jumps * interruptable jumps * * 9. Special Compiler Custom_ops * * data-cache copyback and invalidate commands */custom_op void copyback(void const *a, unsigned long n);custom_op void invalidate(void *a, unsigned long n);custom_op void prefetch(void *a, unsigned long n);custom_op void allocate(void *a, unsigned long n);/* * mux between two values - * if a is true (TM boolean), return value of b, else return value of c * */custom_op long mux(long a, long b, long c);/* * fmux between two values - * if a is true (TM boolean), return value of b, else return value of c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -