📄 custom_ops.h
字号:
* */custom_op float fmux(long a, float b, float 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. * * these are the direct mapping to the implementation routines, * organized as in custom_defs.h. */#include <ops/ops.h>#include <ops/fops.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 */#define sparc_imax(a, b) hw_imax(a, b)#define sparc_imin(a, b) hw_imin(a, b)#define sparc_umin(a, b) hw_uclipu(a, b)#define sparc_iabs(a) hw_h_iabs(0, a)#define sparc_ineg(a) hw_isub(0, a)/* * signed comparison operations * unsigned comparison operations * logical operations */#define sparc_bitandinv(a, b) hw_bitandinv(a, b)#define sparc_rol(a, b) hw_rol(a,b)/* * sign extension operations */#define sparc_sex8(a) hw_sex8(a)#define sparc_sex16(a) hw_sex16(a)#define sparc_zex8(a) hw_zex8(a)#define sparc_zex16(a) hw_zex16(a)/* * 3. Immediate Operations * * the operations which are not directly * expressible in C have macro defines below: * * immediate operations * logical operations */#define sparc_asli(shift,a) hw_asli(a,shift)#define sparc_roli(shift,a) hw_roli(a,shift)#define sparc_asri(shift,a) hw_asri(a,shift)#define sparc_lsri(shift,a) hw_lsri(a,shift)#define sparc_lsli(shift,a) hw_asli(a,shift)/* * arithmetic operations */#define sparc_iaddi(imm,a) hw_iaddi(a,imm)#define sparc_isubi(imm,a) hw_isubi(a,imm)/* * signed comparison operations */#define sparc_igtri(imm,a) hw_igtri(a,imm)#define sparc_igeqi(imm,a) hw_igeqi(a,imm)#define sparc_ieqli(imm,a) hw_ieqli(a,imm)#define sparc_ineqi(imm,a) hw_ineqi(a,imm)#define sparc_ilesi(imm,a) hw_ilesi(a,imm)#define sparc_ileqi(imm,a) hw_ileqi(a,imm)/* * unsigned comparison operations */#define sparc_ugtri(imm,a) hw_ugtri(a,imm)#define sparc_ugeqi(imm,a) hw_ugeqi(a,imm)#define sparc_ueqli(imm,a) hw_ueqli(a,imm)#define sparc_uneqi(imm,a) hw_uneqi(a,imm)#define sparc_ulesi(imm,a) hw_ulesi(a,imm)#define sparc_uleqi(imm,a) hw_uleqi(a,imm)/* * * 4. Special Compute Operations * * clipped arithmetic operations */#define sparc_dspiadd(a,b) hw_dspiadd(a,b)#define sparc_dspisub(a,b) hw_dspisub(a,b)#define sparc_dspuadd(a,b) hw_dspuadd(a,b)#define sparc_dspusub(a, b) hw_dspusub(a, b)#define sparc_dspimul(a, b) hw_dspimul(a, b)#define sparc_dspumul(a, b) hw_dspumul(a, b)#define sparc_dspiabs(a) hw_h_dspiabs(0, a)/* * carry and borrow operations */#define sparc_carry(a, b) hw_carry(a, b)#define sparc_borrow(a,b) hw_ugtr(b, a)/* * special multiply operations */#define sparc_imulm(a, b) hw_imulm(a, b)#define sparc_umulm(a, b) hw_umulm(a, b)/* * dual arithmetic operations */#define sparc_dspidualabs(a) hw_h_dspidualabs(0, a)#define sparc_dspidualadd(a, b) hw_dspidualadd(a, b)#define sparc_dspidualsub(a, b) hw_dspidualsub(a, b)#define sparc_dspidualmul(a, b) hw_dspidualmul(a, b)/* #if defined(__TCS_tm1100__) *//* * dual shifting operations */#define sparc_dualasr(a, b) hw_dualasr(a, b)/* * dual clipping operations */#define sparc_dualiclipi(a, b) hw_dualiclipi(a, b)#define sparc_dualuclipi(a, b) hw_dualuclipi(a, b)/* #endif defined(__TCS_tm1100__) *//* * byte packing operations */#define sparc_packbytes(a, b) hw_packbytes(a, b)#define sparc_mergemsb(a, b) hw_mergemsb(a, b)#define sparc_mergelsb(a, b) hw_mergelsb(a, b)#define sparc_pack16msb(a, b) hw_pack16msb(a, b)#define sparc_pack16lsb(a, b) hw_pack16lsb(a, b)/* #if defined(__TCS_tm1100__) */#define sparc_mergedual16lsb(a, b) hw_mergedual16lsb(a, b)/* #endif defined(__TCS_tm1100__) *//* * byte select operations */#define sparc_ubytesel(a, b) hw_ubytesel(a, b)#define sparc_ibytesel(a, b) hw_ibytesel(a, b)/* * sum of products operations */#define sparc_ufir8uu(a, b) hw_ufir8uu(a, b)#define sparc_ifir8ui(a, b) hw_ifir8ui(a, b)#define sparc_ifir8ii(a, b) hw_ifir8ii(a, b)#define sparc_ifir16(a, b) hw_ifir16(a, b)#define sparc_ufir16(a, b) hw_ufir16(a, b)/* * sum of differences operations */#define sparc_ume8ii(a, b) hw_ume8ii(a, b)#define sparc_ume8uu(a, b) hw_ume8uu(a, b)/* * special byte shift operations */#define sparc_funshift1(a, b) hw_funshift1(a, b)#define sparc_funshift2(a, b) hw_funshift2(a, b)#define sparc_funshift3(a, b) hw_funshift3(a, b)/* * clip operations */#define sparc_iclipi(a, b) hw_iclipi(a, b)#define sparc_uclipi(a, b) hw_uclipi(a, b)#define sparc_uclipu(a, b) hw_uclipu(a, b)/* * quad arithmetic operations */#define sparc_quadumulmsb(a,b) hw_quadumulmsb(a,b)#define sparc_quadavg(a,b) hw_quadavg(a,b)#define sparc_dspuquadaddui(a,b) hw_dspuquadaddui(a,b)/* #if defined(__TCS_tm1100__) */#define sparc_quadumax(a, b) hw_quadumax(a,b)#define sparc_quadumin(a, b) hw_quadumin(a,b)/* #endif defined(__TCS_tm1100__) *//* * various special compute operations */#define sparc_izero(a, b) hw_izero(a, b)#define sparc_inonzero(a, b) hw_inonzero(a, b)#define sparc_iavgonep(a, b) hw_iavgonep(a, b)#define sparc_iflip(a, b) hw_iflip(a, b)/* * * 5. Special Register Operations * * PCSW operations */unsigned int sparc_readpcsw(void);void sparc_writepcsw(unsigned int val, unsigned int 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. */#define sparc_cycles() ((UnSignedWord) (clock()))#define sparc_hicycles() ((UnSignedWord) 0)/* * DPC and SPC operations * * these operations have no meaning when compiled * on the sparc target (no way to retrieve PC on sparc). * */#define sparc_readdpc() (__not_implemented__)#define sparc_writedpc(val) (__not_implemented__)#define sparc_readspc() (__not_implemented__)#define sparc_writespc(val) (__not_implemented__)/* * * 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 */float sparc_fsqrt(float f);float sparc_fabsval(float f);int sparc_fsign(float f);/* * float to integer conversions */int sparc_ifixieee(float f);unsigned int sparc_ufixieee(float f);/* * integer to float conversions */float sparc_ifloatrz(SignedWord a);float sparc_ufloatrz(UnSignedWord a);/* * fzero and fnonzero analogous to izero/inonzero */float sparc_fzero(SignedWord a, float b);float sparc_fnonzero(SignedWord a, float b);/* * dirty tricks to calculate fmin and fmax analogous * DO NOT SET APPROPRIATE IEEE FLAGS !! * */float sparc_fmin(float a, float b);float sparc_fmax(float a, float 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, invalidate, * prefetch and allocate commands * */#define sparc_copyback(a,n) (0)#define sparc_invalidate(a,n) (0)#define sparc_prefetch(a,n) (0)#define sparc_allocate(a,n) (0)#endif /* defined(__TCS__) */#endif /* __CUSTOM_OPS_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -