[LLVMdev] how to add some default target flags?
Daniel Sanders
Daniel.Sanders at imgtec.com
Wed Jun 3 08:18:09 PDT 2015
> -----Original Message-----
> From: Manuel Lauss [mailto:manuel.lauss at gmail.com]
> Sent: 03 June 2015 15:28
> To: Daniel Sanders
> Cc: llvmdev at dcs-maillist2.engr.illinois.edu
> Subject: Re: [LLVMdev] how to add some default target flags?
>
> On Wed, Jun 3, 2015 at 12:59 PM, Daniel Sanders
> <Daniel.Sanders at imgtec.com> wrote:
> > We haven't implemented host detection yet. However, I'm not sure it
> would help in
> > this case since lacking an FPU isn't always a good reason to use soft-float.
> This is because
> > soft-float binaries are incompatible with hard-float binaries (see below).
> > Could you tell me more about the target?
>
> It's alchemy chips (mips32r1 le). I maintain a complete soft-float
> gentoo userland for them,
> and a kernel patch which kills all fpu users with SIGILL.
Ah ok, soft-float makes sense for your situation.
The best I can think of at the moment is applying a small patch to clang so that soft-float is the default. 'llc' shouldn't be changed since it's not a user tool and changing its default behaviours will break 'make check'.
> > Many fpu-less targets (particularly those running linux distributions) should
> generate
> > hard-float code regardless and rely on fpu emulation in the kernel. For
> example, I have
> > an EdgeRouter Pro running Debian Jessie. This target lacks an fpu but I can't
> use
> > soft-float because that would change the calling convention and therefore
> break
> > compatibility with the libraries installed on the system.
>
> the in-kernel emulator is slow, so years ago I started maintaining my
> own softfloat
> userland. I routinely try new things and with llvm I noticed that it
> defaults to hardfloat
> (i.e. when used by mesa).
Yes, it's definitely slow. I have some examples of 3 minute tests that take a couple hours via emulation.
I've thought of a couple ways to significantly reduce the overhead but I lack the time to work on them.
> >> Is there a way to have llc/llvm always use "-march=mipsle -mcpu=mips32
> >> -mattr=+soft-float" as a default command line, something similar to
> >> gcc's "--with-arch=mips32 --with-float=soft" configure switches?
> >
> > Not that I know of. The triple is the only thing you could use in LLVM and
> that doesn't specify soft-float vs hard-float.
>
> Well, gcc is configured as "mipsel-softfloat-linux-gnu-gcc" and that works
> beautifully.
>
> Thanks!
> Manuel
That triple is encoding ABI information in the 'vendor' field. This works for GCC (and GNU tools in general) because there's no real correlation between the triple and the behaviour of the tool. For those tools, the ./configure options are what really matters and the triple just provides overridable defaults.
I have another thread on LLVMdev that goes into more detail but LLVM's internals currently believe that GNU triples more meaningful than they actually are. It turns out that they are ambiguous, incomplete, and even misleading but LLVM uses them to make decisions in a number of places. This is a particular problem in the Mips target at the moment but other targets have encountered it too.
> >> -----Original Message-----
> >> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-
> bounces at cs.uiuc.edu]
> >> On Behalf Of Manuel Lauss
> >> Sent: 31 May 2015 16:26
> >> To: llvmdev at dcs-maillist2.engr.illinois.edu
> >> Subject: [LLVMdev] how to add some default target flags?
> >>
> >> Hello,
> >>
> >> I've built LLVM natively on a fpu-less (soft-float) mips32 target, and
> >> built mesa to use it.
> >> However llvm apparently cannot determine what machine it's running on
> and
> >> builds
> >> code for a generic mips target with fpu.
> >>
> >> Is there a way to have llc/llvm always use "-march=mipsle -mcpu=mips32
> >> -mattr=+soft-float" as a default command line, something similar to
> >> gcc's "--with-arch=mips32 --with-float=soft" configure switches?
> >>
> >> Thanks!
> >> Manuel Lauss
> >> _______________________________________________
> >> LLVM Developers mailing list
> >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list