[cfe-commits] r172062 - in /cfe/trunk: lib/Driver/Tools.cpp test/Driver/mips-float.c
Reed Kotler
rkotler at mips.com
Sat Jan 12 10:22:08 PST 2013
On 01/10/2013 11:25 AM, Eli Friedman wrote:
> On Thu, Jan 10, 2013 at 4:36 AM, Simon Atanasyan <satanasyan-8NJIiSa5LzA at public.gmane.org> wrote:
>> Author: atanasyan
>> Date: Thu Jan 10 06:36:19 2013
>> New Revision: 172062
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=172062&view=rev
>> Log:
>> [Mips] Pass a combination of +soft-float and -mips16-hard-float flags to
>> the backend if hard float ABI is selected under -mips16 mode.
>>
>> Modified:
>> cfe/trunk/lib/Driver/Tools.cpp
>> cfe/trunk/test/Driver/mips-float.c
>>
>> Modified: cfe/trunk/lib/Driver/Tools.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=172062&r1=172061&r2=172062&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Driver/Tools.cpp (original)
>> +++ cfe/trunk/lib/Driver/Tools.cpp Thu Jan 10 06:36:19 2013
>> @@ -958,7 +958,9 @@
>>
>> StringRef FloatABI = getMipsFloatABI(D, Args);
>>
>> - if (FloatABI == "soft") {
>> + bool IsMips16 = Args.getLastArg(options::OPT_mips16) != NULL;
>> +
>> + if (FloatABI == "soft" || (FloatABI == "hard" && IsMips16)) {
>> // Floating point operations and argument passing are soft.
>> CmdArgs.push_back("-msoft-float");
>> CmdArgs.push_back("-mfloat-abi");
>> @@ -969,6 +971,11 @@
>> // Now it is the only method.
>> CmdArgs.push_back("-target-feature");
>> CmdArgs.push_back("+soft-float");
>> +
>> + if (FloatABI == "hard" && IsMips16) {
>> + CmdArgs.push_back("-mllvm");
>> + CmdArgs.push_back("-mips16-hard-float");
>> + }
>> }
>> else if (FloatABI == "single") {
>> // Restrict the use of hardware floating-point
>
> I don't understand this change; -mips16-hard-float isn't soft-float at
> all. (Normally, I would consider "soft-float" to mean "doesn't use
> floating-point registers".) Why are we passing the soft-float flag in
> the first place?
>
Mips16 does not have floating point, but mips16 is really a processor
mode and not an architecture.
Mips16 code is running on a mips32 processor (could theoretically be on
a mips64 processor but no such configuration exists in reality that I am
aware of).
We are using gcc nomenclature here, but hard float for mips 16 means
essentially to compile as soft float but to use a runtime library for
soft float float that is written with native mips32 floating point
instructions (those runtime routines will run in mips32 mode). From the
point of view of llvm then, it is soft float with different library
names (essentially).
Mips16 and mips32 can more or less freely call each other. There are
some issues when floating point arguments or return values are involved
but they don't involve any part of llvm beyond the target dependent part
of the mips compiler.
So we are compiling mips16 code with hard float using the soft float
argument, but when I see the additional -mips16-hard-float, then I
redefine the table of runtime library routines in llvm that are normally
called for soft float to be the hard float analogs.
There is a more to the mips16 hard float but for these purpose of the
driver, I have explained it fully.
Reed
> -Eli
>
More information about the cfe-commits
mailing list