-mips16e and -mips32r2 usage

David Daney ddaney@caviumnetworks.com
Thu May 20 21:07:00 GMT 2010


On 05/19/2010 08:16 PM, Ian Lance Taylor wrote:
> "Johan Schuld"<Johan.Schuld@fusiontransactive.com>  writes:
>
>> My first post in this group, so I hope it's the correct one.
>> I'm using a MIPS32 base processor (4KSd) which also has the MIPS16e extensions.
>>
>> First of all, some of the default compiler flags I have use the
>> -mips16e compiler flag, even though I can only find the -mips16
>> (so without the 'e') flag in the GNU GCC documentation
>> online. (http://gcc.gnu.org/onlinedocs/gcc-4.4.4/gcc/MIPS-Options.html#MIPS-Options). I can
>> not find any -mips16e specific documentation.)
>>
>> So for my project, I use both the -mips23r2 and -mips16e
>> compiler flags. Some of my files (startup files) contain assembly
>> code, and do not get compiled with the above settings (it does not
>> recognize 'di' 'sync' and 'ei' as valid opcodes). These opcodes
>> exist in the MIPS32r2 instruction set, but not in the MIPS16e
>> extensions.
>>
>> My assumption was that using the -mips16e compiler flag, would
>> only enable the use of the mips16e specific extensions, but it seems
>> like it will only use the compact instruction set? Can I use
>> -mips16e and -mips32r2 simultaneously, or does it force the compiler
>> to ONLY use the compact instruction set?
>
> gcc will generate MIPS16e code if you use the -mips16 option in
> combination with the -mips32 or -mips32r2 option.  So you should
> indeed get MIPS16e code with the options you are using.
>
> However, you are correct that using -mips16 will cause the compiler to
> only use the compact instruction set.  There is no way to flip back
> and forth in a single source file.  Files which contain non-MIPS16e
> assembler code must be compiled without the -mips16 option.

The GCC-4.5 manual indicates that this may not be the case.  The mips16 
and nomips16 function attributes appear to allow you to control this on 
a function by function basis.

David Daney



More information about the Gcc-help mailing list