Rail Shafigulin via llvm-dev
2016-Mar-12 19:51 UTC
[llvm-dev] clang triple and clang target
> > I assume with target you mean the backend? Consider the x86 backend. It > supports 32bit and 64bit mode, with the GNU x32 ABI in between. There > are three different executable formats support (ELF, PE, MachO) with > different constraints. Some platforms require 32bit alignment of the > stack, others require 128bit alignment. The list goes on. The triple > specifies > the combination of target, OS and potentially file format and sub-ABI. > > Joerg > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >Thanks for the response. I was trying to generate assembly which would use vector instructions. I need to see how they look, whether it is ARM, Mips or X86. However for some reason clang would generate an error saying that a given target does not exist. Here is the command line I used: clang -S test.c -o test.sse2.x86-64.s --target=x86-unknown-linux-eabi -mfloat-abi=hard -mcpu=x86-64 -mfpu=SSE2 -fslp-vectorize-aggressive -fslp-vectorize-aggressive -fslp-vectorize -fvectorize -fno-lax-vector-conversions Here is the response I got: clang: warning: argument unused during compilation: '-mfloat-abi=hard' clang: warning: argument unused during compilation: '-mcpu=x86-64' clang: warning: argument unused during compilation: '-mfpu=SSE2' error: unknown target triple 'x86-unknown-linux-eabi', please use -triple or -arch I tried every possible combination of --target I could think of but nothing worked. Would you mind helping me out? Any help is appreciated. -- Rail Shafigulin Software Engineer Esencia Technologies -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160312/49b23c81/attachment.html>
On 12 March 2016 at 11:51, Rail Shafigulin via llvm-dev <llvm-dev at lists.llvm.org> wrote:> I tried every possible combination of --target I could think of but nothing > worked. Would you mind helping me out?First, 64-bit x86 is "x86_64", and 32-bit is "i386" in the triple. For ARM you'd probably want "thumbv8" or "aarch64". Also, "eabi" is only a thing on ARM targets, try "gnu" for x86. Cheers. Tim.
Daniel Sanders via llvm-dev
2016-Mar-14 15:27 UTC
[llvm-dev] clang triple and clang target
> I need to see how they look, whether it is ARM, Mips or X86.The Mips triples you're most likely to need are: · mips-linux-gnu – 32-bit big-endian on GNU/Linux · mipsel-linux-gnu – 32-bit little-endian on GNU/Linux · mips64-linux-gnu – 64-bit big-endian on GNU/Linux · mips64el-linux-gnu – 64-bit little-endian on GNU/Linux I should mention that Mips has quite a few triple-related bugs but if you're just looking at assembly the one you're most likely to encounter is that mips-*/mipsel-* only work for 32-bit subtargets and mips64-*/mips64el-* only work for 64-bit subtargets. If you don't match them up correctly then you'll either get an assertion from the code generator or a crash. This isn't supposed to be the case but there's been some unfortunate misunderstandings about GNU triples and Clang triples (they're not quite the same thing) that are difficult to resolve. From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Rail Shafigulin via llvm-dev Sent: 12 March 2016 19:52 To: Joerg Sonnenberger; llvm-dev Subject: Re: [llvm-dev] clang triple and clang target I assume with target you mean the backend? Consider the x86 backend. It supports 32bit and 64bit mode, with the GNU x32 ABI in between. There are three different executable formats support (ELF, PE, MachO) with different constraints. Some platforms require 32bit alignment of the stack, others require 128bit alignment. The list goes on. The triple specifies the combination of target, OS and potentially file format and sub-ABI. Joerg _______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev Thanks for the response. I was trying to generate assembly which would use vector instructions. I need to see how they look, whether it is ARM, Mips or X86. However for some reason clang would generate an error saying that a given target does not exist. Here is the command line I used: clang -S test.c -o test.sse2.x86-64.s --target=x86-unknown-linux-eabi -mfloat-abi=hard -mcpu=x86-64 -mfpu=SSE2 -fslp-vectorize-aggressive -fslp-vectorize-aggressive -fslp-vectorize -fvectorize -fno-lax-vector-conversions Here is the response I got: clang: warning: argument unused during compilation: '-mfloat-abi=hard' clang: warning: argument unused during compilation: '-mcpu=x86-64' clang: warning: argument unused during compilation: '-mfpu=SSE2' error: unknown target triple 'x86-unknown-linux-eabi', please use -triple or -arch I tried every possible combination of --target I could think of but nothing worked. Would you mind helping me out? Any help is appreciated. -- Rail Shafigulin Software Engineer Esencia Technologies -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160314/e6e1cc27/attachment.html>
Rail Shafigulin via llvm-dev
2016-Mar-14 18:19 UTC
[llvm-dev] clang triple and clang target
On Mon, Mar 14, 2016 at 8:27 AM, Daniel Sanders <Daniel.Sanders at imgtec.com> wrote:> > I need to see how they look, whether it is ARM, Mips or X86. > > > > The Mips triples you're most likely to need are: > > · mips-linux-gnu – 32-bit big-endian on GNU/Linux > > · mipsel-linux-gnu – 32-bit little-endian on GNU/Linux > > · mips64-linux-gnu – 64-bit big-endian on GNU/Linux > > · mips64el-linux-gnu – 64-bit little-endian on GNU/Linux > > > > I should mention that Mips has quite a few triple-related bugs but if > you're just looking at assembly the one you're most likely to encounter is > that mips-*/mipsel-* only work for 32-bit subtargets and > mips64-*/mips64el-* only work for 64-bit subtargets. If you don't match > them up correctly then you'll either get an assertion from the code > generator or a crash. This isn't supposed to be the case but there's been > some unfortunate misunderstandings about GNU triples and Clang triples > (they're not quite the same thing) that are difficult to resolve. > > >Daniel, Thanks for the response. I tried using the option you recommended but for some reason I didn't see any vector instructions in the output. Can you explain what am I doing wrong? Here is the command line I ran clang -S test.c -o test.msa.mips.s --target=mips-pc-linux-gnu -mmsa -mfp64 -mfloat-abi=hard -mcpu=mips32 -fslp-vectorize-aggressive -fslp-vectorize-aggressive -fslp-vectorize -fvectorize -fno-lax-vector-conversions -O3 I'm attaching test.c as well as test.msa.mips.s so you could see input as well as output. Any help is appreciated. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160314/2a548668/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: test.c Type: text/x-csrc Size: 206 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160314/2a548668/attachment.c> -------------- next part -------------- A non-text attachment was scrubbed... Name: test.msa.mips.s Type: application/octet-stream Size: 740 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160314/2a548668/attachment.obj>
Rail Shafigulin via llvm-dev
2016-Mar-14 18:37 UTC
[llvm-dev] clang triple and clang target
On Sat, Mar 12, 2016 at 2:38 PM, Tim Northover <t.p.northover at gmail.com> wrote:> On 12 March 2016 at 11:51, Rail Shafigulin via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > I tried every possible combination of --target I could think of but > nothing > > worked. Would you mind helping me out? > > First, 64-bit x86 is "x86_64", and 32-bit is "i386" in the triple. For > ARM you'd probably want "thumbv8" or "aarch64". Also, "eabi" is only a > thing on ARM targets, try "gnu" for x86. > > Cheers. > > Tim. >Hi Tim. Thanks for the response. I tried the x86 suggestion but it didn't work. Clearly I'm doing something wrong, but I don't know what exactly. I would really appreciate your help in this. Here is the command line I'm using clang -S test.c -o test.sse2.x86_64.s --target=x86_64-pc-linux-gnu -mfloat-abi=hard -mcpu=k8 -mfpu=SSE2 -fslp-vectorize-aggressive -fslp-vectorize-aggressive -fslp-vectorize -fvectorize -fno-lax-vector-conversions -O3 Here is the response that I get: clang-3.5: warning: argument unused during compilation: '-mfloat-abi=hard' clang-3.5: warning: argument unused during compilation: '-mcpu=k8' clang-3.5: warning: argument unused during compilation: '-mfpu=SSE2' error: unable to create target: 'No available targets are compatible with this triple, see -version for the available targets.' clang --version command produces the following result: clang version 3.5.0 Target: x86_64-unknown-linux-gnu Thread model: posix test.c is attached to this email. So what am I doing wrong? -- Rail Shafigulin Software Engineer Esencia Technologies -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160314/8f332672/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: test.c Type: text/x-csrc Size: 206 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160314/8f332672/attachment.c>