> James E Wilson >> Jonathan Bastien-Filiatrault wrote: >> * We have defined BIT_PER_WORD to 16 and UNITS_PER_WORD to 1. On this >> DSP, there are two 40-bits accumulators. How do we make GCC take >> advantage of this and which machine mode do we use ? > > GCC has little support for non-power-of-2 sized accumulators. Traditionally > this would be done by using PSImode (because your target has a 64-bit SImode), > which you can enable by using the undocumented PARTIAL_INT_MODE(SI) macro in > your target modes.def file. See other targets for existing examples of this. > > Also, gcc has little support for targets with BITS_PER_UNIT != 8. I think the > (ti)c4x is the only one currently supported, and it is being obsoleted due to > lack of maintenance.
A basic thought (as no GCC language presently directly supports the full semantics offered by the c54's ISA and various modes, including notion of "guard bits" extending it's otherwise natural 32-bit wide accumulators); it may be simplest to treat the accumulator as a 32 bit word composed of a 16-bit hi and lo halves, ignoring the guard-bits, thereby more simply modeling the c54 as a basic 16-bit machine with 16-bit char's and ints, and 32-bit long and long-longs? Leaving the predominant remaining problem of identifying which mode maps to which corresponding type. Personally I believe it would be most ideal if GCC didn't presume that QImode size == BITS_PER_UNIT, but rather introduced the definition that QImode size == BITS_PER_BYTE, where then BITS_PER_UNIT may then more flexibly define the minimally sized addressable datum relative to it, thereby enabling for example: (although requiring some GCC refinement) #define BITS_PER_BYTE 8 /* or whatever */ #define QI_MODE_SIZE 1 /* BYTES, not units */ #define BITS_PER_QI_MODE (1 * BITS_PER_BYTE) #define HI_MODE_SIZE 2 /* BYTES, not units */ #define BITS_PER_HI_MODE (2 * BITS_PER_BYTE) #define SI_MODE_SIZE 4 /* BYTES, not units */ #define BITS_PER_SI_MODE (4 * BITS_PER_BYTE) ... #define UNIT_SIZE HI_MODE_SIZE /* minimum naturally addressable mode size */ #define BITS_PER_UNIT (UNIT_SIZE * BITS_PER_BYTE) #define WORD_SIZE HI_MODE_SIZE /* maximum naturally addressable mode size */ #define BITS_PER_WORD (WORD_SIZE * BITS_PER_BYTE) #define CHAR_SIZE HI_MODE_SIZE #define BITS_PER_CHAR (CHAR_SIZE * BITS_PER_BYTE) #define INT_SIZE HI_MODE_SIZE #define BITS_PER_INT (INT_SIZE * BITS_PER_BYTE) #define LONG_SIZE SI_MODE_SIZE #define BITS_PER_LONG (LONG_SIZE * BITS_PER_BYTE) #define LONG_LONG_SIZE SI_MODE_SIZE #define BITS_PER_LONG_LONG (LONG_LONG_SIZE * BITS_PER_BYTE) ...