📄 custom_defs.h
字号:
* are not supported. * * jumps * interruptable jumps * * 9. Special Compiler Custom_ops * * data-cache copyback and invalidate commands */#define COPYBACK(a,n) (copyback((a),(n)))#define INVALIDATE(a,n) (invalidate((a),(n)))#define PREFETCH(a,n) (prefetch((a),(n)))#define ALLOCATE(a,n) (allocate((a),(n)))/* * mux between two values - * if a is true, return value of b, else return value of c * * may be used for conditional assignments, e.g. * * x = MUX(x < 0, x, 0); "if (x < 0) x = 0;" * * note: the comparison against zero is necessary because * the mux pseudo-operation at .t level expects TM booleans. */#define MUX(a,b,c) (mux((a) != 0,(b),(c)))/* * mux between two floating point values - * if a is true, return value of float b, else return value of float c * * may be used for conditional assignments, e.g. * * x = FMUX(x < 0, x, 0.0); "if (x < 0) x = 0.0;" * * note: the comparison against zero is necessary because * the mux pseudo-operation at .t level expects TM booleans. */#define FMUX(a,b,c) (fmux((a) != 0,(b),(c)))#else /* __TCS__ not defined *//* * Any compiler other than tmcc. * Custom_ops are mapped to the glue routines in custom_ops.c * which are mapped to implementation routines in (f)ops.c. * They are not directly mapped to implementation routines because: * Floating point implementation routines return pointers, not values, * so they cannot be directly mapped. To make the whole thing * uniform, use glue (sparc_) prefix all over. *//* * 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 */#define IMAX(a,b) (sparc_imax((a),(b)))#define IMIN(a,b) (sparc_imin((a),(b)))#define UMIN(a,b) (sparc_umin((a),(b)))#define IABS(a) (sparc_iabs(a))#define INEG(a) (sparc_ineg(a))/* * signed comparison operations * unsigned comparison operations * logical operations */#define BITANDINV(a,b) (sparc_bitandinv((a),(b)))#define ROL(a,b) (sparc_rol((a),(b)))/* * sign extension operations */#define SEX8(a) (sparc_sex8(a))#define SEX16(a) (sparc_sex16(a))#define ZEX8(a) (sparc_zex8(a))#define ZEX16(a) (sparc_zex16(a))/* * 3. Immediate Operations * * the operations which are not directly * expressible in C have macro defines below: * * immediate operations * logical operations */#define ASLI(shift,a) (sparc_asli(shift,a))#define ROLI(shift,a) (sparc_roli(shift,a))#define ASRI(shift,a) (sparc_asri(shift,a))#define LSRI(shift,a) (sparc_lsri(shift,a))#define LSLI(shift,a) (sparc_lsli(shift,a))/* * arithmetic operations */#define IADDI(imm,a) (sparc_iaddi(imm,a))#define ISUBI(imm,a) (sparc_isubi(imm,a))/* * signed comparison operations */#define IGTRI(imm,a) (sparc_igtri(imm,a))#define IGEQI(imm,a) (sparc_igeqi(imm,a))#define IEQLI(imm,a) (sparc_ieqli(imm,a))#define INEQI(imm,a) (sparc_ineqi(imm,a))#define ILESI(imm,a) (sparc_ilesi(imm,a))#define ILEQI(imm,a) (sparc_ileqi(imm,a))/* * unsigned comparison operations */#define UGTRI(imm,a) (sparc_ugtri(imm,a))#define UGEQI(imm,a) (sparc_ugeqi(imm,a))#define UEQLI(imm,a) (sparc_ueqli(imm,a))#define UNEQI(imm,a) (sparc_uneqi(imm,a))#define ULESI(imm,a) (sparc_ulesi(imm,a))#define ULEQI(imm,a) (sparc_uleqi(imm,a))/* * * 4. Special Compute Operations * * clipped arithmetic operations */#define DSPIADD(a,b) (sparc_dspiadd((a),(b)))#define DSPISUB(a,b) (sparc_dspisub((a),(b)))#define DSPUADD(a,b) (sparc_dspuadd((a),(b)))#define DSPUSUB(a,b) (sparc_dspusub((a),(b)))#define DSPIMUL(a,b) (sparc_dspimul((a),(b)))#define DSPUMUL(a,b) (sparc_dspumul((a),(b)))#define DSPIABS(a) (sparc_dspiabs(a))/* * carry and borrow operations */#define CARRY(a,b) (sparc_carry((a),(b)))#define BORROW(a,b) (sparc_borrow((a),(b)))/* * special multiply operations */#define IMULM(a,b) (sparc_imulm((a),(b)))#define UMULM(a,b) (sparc_umulm((a),(b)))/* * dual arithmetic operations */#define DSPIDUALABS(a) (sparc_dspidualabs(a))#define DSPIDUALADD(a,b) (sparc_dspidualadd((a),(b)))#define DSPIDUALSUB(a,b) (sparc_dspidualsub((a),(b)))#define DSPIDUALMUL(a,b) (sparc_dspidualmul((a),(b)))/* #if defined(__TCS_tm1100__) *//* * dual shifting operations */#define DUALASR(a,b) (sparc_dualasr((a),(b)))/* * dual clipping operations */#define DUALICLIPI(a,b) (sparc_dualiclipi((a),(b)))#define DUALUCLIPI(a,b) (sparc_dualuclipi((a),(b)))/* #endif defined(__TCS_tm1100__) *//* * byte packing operations */#define PACKBYTES(a,b) (sparc_packbytes((a),(b)))#define MERGEMSB(a,b) (sparc_mergemsb((a),(b)))#define MERGELSB(a,b) (sparc_mergelsb((a),(b)))#define PACK16MSB(a,b) (sparc_pack16msb((a),(b)))#define PACK16LSB(a,b) (sparc_pack16lsb((a),(b)))/* #if defined(__TCS_tm1100__) */#define MERGEDUAL16LSB(a,b) (sparc_mergedual16lsb((a),(b)))/* #endif defined(__TCS_tm1100__) *//* * byte select operations */#define UBYTESEL(a,sel) (sparc_ubytesel((a),(sel)))#define IBYTESEL(a,sel) (sparc_ibytesel((a),(sel)))/* * sum of products operations */#define UFIR8UU(a,b) (sparc_ufir8uu((a),(b)))#define IFIR8UI(a,b) (sparc_ifir8ui((a),(b)))#define IFIR8IU(a,b) (sparc_ifir8ui((b),(a)))#define IFIR8II(a,b) (sparc_ifir8ii((a),(b)))#define IFIR16(a,b) (sparc_ifir16((a),(b)))#define UFIR16(a,b) (sparc_ufir16((a),(b)))/* * sum of differences operations */#define UME8II(a,b) (sparc_ume8ii((a),(b)))#define UME8UU(a,b) (sparc_ume8uu((a),(b)))/* * special byte shift operations */#define FUNSHIFT1(a,b) (sparc_funshift1((a),(b)))#define FUNSHIFT2(a,b) (sparc_funshift2((a),(b)))#define FUNSHIFT3(a,b) (sparc_funshift3((a),(b)))/* * clip operations */#define ICLIPI(a,b) (sparc_iclipi((a),(b)))#define UCLIPI(a,b) (sparc_uclipi((a),(b)))#define UCLIPU(a,b) (sparc_uclipu((a),(b)))/* * quad arithmetic operations */#define QUADUMULMSB(a,b) (sparc_quadumulmsb((a),(b)))#define QUADAVG(a,b) (sparc_quadavg((a),(b)))#define DSPUQUADADDUI(a,b) (sparc_dspuquadaddui((a),(b)))/* #if defined(__TCS_tm1100__) */#define QUADUMAX(a,b) (sparc_quadumax((a),(b)))#define QUADUMIN(a,b) (sparc_quadumin((a),(b)))/* #endif defined(__TCS_tm1100__) *//* * various special compute operations */#define IZERO(a,b) (sparc_izero((a),(b)))#define INONZERO(a,b) (sparc_inonzero((a),(b)))#define IAVGONEP(a,b) (sparc_iavgonep((a),(b)))#define IFLIP(a,b) (sparc_iflip((a),(b)))/* * * 5. Special Register Operations * * PCSW operations */#define READPCSW() (sparc_readpcsw())#define WRITEPCSW(val,mask) (sparc_writepcsw((val),(mask)))/* * CCCOUNT operations */#define CYCLES() (sparc_cycles())#define HICYCLES() (sparc_hicycles())/* * DPC and SPC operations */#define READDPC() (sparc_readdpc())#define WRITEDPC(val) (sparc_writedpc(val))#define READSPC() (sparc_readspc())#define WRITESPC(val) (sparc_writespc(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 */#define FSQRT(f) (sparc_fsqrt(f))#define FABSVAL(f) (sparc_fabsval(f))#define FSIGN(f) (sparc_fsign(f))/* * float to integer conversions */#define IFIXIEEE(f) (sparc_ifixieee(f))#define UFIXIEEE(f) (sparc_ufixieee(f))/* * integer to float conversions */#define IFLOATRZ(a) (sparc_ifloatrz(a))#define UFLOATRZ(a) (sparc_ufloatrz(a))/* * fzero and fnonzero analogous to izero/inonzero */#define FZERO(a,b) sparc_fzero((a), (b))#define FNONZERO(a,b) sparc_fnonzero((a), (b))/* * dirty tricks to calculate fmin and fmax analogous * DO NOT SET APPROPRIATE IEEE FLAGS !! * */#define FMIN(a,b) sparc_fmin((a), (b))#define FMAX(a,b) sparc_fmax((a), (b))/* * * 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 */#define COPYBACK(a,n) (sparc_copyback((a),(n)))#define INVALIDATE(a,n) (sparc_invalidate((a),(n)))#define PREFETCH(a,n) (sparc_prefetch((a),(n)))#define ALLOCATE(a,n) (sparc_allocate((a),(n)))/* * mux between two values - * if a is true, return value of b, else return value of c * * may be used for conditional assignments, e.g. * * x = MUX(x < 0, x, 0); "if (x < 0) x = 0;" * */#define MUX(a,b,c) (IZERO((a),(b)) | INONZERO((a),(c)))/* * mux between two floating point values - * if a is true, return value of float b, else return value of float c * * may be used for conditional assignments, e.g. * * x = FMUX(x < 0, x, 0.0); "if (x < 0) x = 0.0;" * */#define FMUX(a,b,c) ((a) ? (b) : (c))#endif /* defined(__TCS__) *//**************************************************************************** * Compiler independent part. * * Macro definitions built on top of custom_ops. * They are here mainly for backward compatibility, not for general use. * ****************************************************************************//* * clip integer a between lowerbound b and upperbound c * */#define CLIP(a,b,c) IMIN(IMAX(a,b),c)/* * iclipi(a,b), uclipi(a,b), uclipu(a,b) clips a between * ~b <= a <= b * * ICLIPBITS(a,b) clips a to b bits. * */#define ICLIPBITS(a,b) ICLIPI(a,((1<<(b-1))-1))#define ICLIPI8(a) ICLIPBITS(a,8)#define ICLIPI9(a) ICLIPBITS(a,9)#define ICLIPI10(a) ICLIPBITS(a,10)#define ICLIPI11(a) ICLIPBITS(a,11)#define ICLIPI12(a) ICLIPBITS(a,12)#define ICLIPI16(a) ICLIPBITS(a,16)#define ICLIPI24(a) ICLIPBITS(a,24)#define UCLIPI8(a) UCLIPI(a,255)#define UCLIPU8(a) UCLIPU(a,255)/* * comment on rounding: * * / 2 - round toward zero (signed integer divide by 2) * IAVGONEP - round toward infinity (real average for two positive ints) * >> 1 - round toward negative infinity * */#endif /* _CUSTOM_DEFS_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -