On Mon, Mar 5, 2012 at 10:38 AM, Bernd Schmidt <ber...@codesourcery.com> wrote: > On 03/05/2012 05:24 PM, Peter Bigot wrote: >> And is there any reason (other than it doesn't seem to have been done >> before) to believe PSImode is the wrong way to support a >> general-purpose 20-bit integral type in gcc? > > If you're using 4.7.0, it should be possible to use FRACTIONAL_INT_MODE > and get reasonable results. However, it hasn't been tested much, since > the final bits of the patch series which would have added 40 bit int > support to the C frontend didn't make it in. See the discussion following > http://gcc.gnu.org/ml/gcc-patches/2011-07/msg00079.html
Thanks; I've updated to 4.7.0. In this thread I found: >On 07/01/11 23:18, Bernd Schmidt wrote: >>> What is the function of having both PARTIAL_INT_MODE and >>> FRACTIONAL_INT_MODE? >> >> Not having to change all the targets using PARTIAL_INT_MODE immediately >> to use the better mechanism. > > Also, come to think of it, preventing the rest of the compiler from > trying to use such a mode in case the target only supports some very > specific operations on it. A port could choose to use PImode, defined in > machmode.def (and get __int40_t support), or it could add its own > private PDImode to use in specific situations only. Another major difference seems to be that PARTIAL_INT_MODE places the type in MODE_PARTIAL_INT, while FRACTIONAL_INT_MODE places it in MODE_INT, and allows it to participate in things like GET_MODE_WIDER_MODE regardless of whether the fractional mode is actually available on the target. I'd really wanted to be able to make general-use 20-bit integers available to the programmer, but it's looking ugly. Does it still make sense to use FRACTIONAL_INT_MODE on a target where there's essentially an (incomplete) superset of instructions that operate on the standard registers with 20-bits instead of their original 16-bits? Those instructions are only available on a subset of the target chips, and are enabled by a target-specific user option. genmodes doesn't seem to support that constraint. Peter