[llvm-dev] clang triple and clang target

Daniel Sanders via llvm-dev llvm-dev at lists.llvm.org
Tue Mar 15 07:59:31 PDT 2016


> 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

'-mcpu=mips32' should be '-mcpu=mips32r2' but even with that it doesn't vectorize your case. We haven't implemented TargetTransformInfo yet so we only get a very small amount of vectorization at the moment. As a quick experiment this afternoon, I tried a small implementation that only reports the number of vector registers and their width. This seems to make a significant improvement to some of the tests in SingleSource/UnitTests/Vector but makes your test case considerably worse. We'll have to find time to implement a proper TargetTransformInfo.

Also, you mentioned you were using clang 3.5 on another part of this thread. The 64-bit MIPS ABI's had a lot of bugs around that time, IIRC the majority of them were fixed in 3.5.1 and a couple rarer ones were fixed in 3.5.2 and 3.6.0.

________________________________
From: Rail Shafigulin [rail at esenciatech.com]
Sent: 14 March 2016 18:19
To: Daniel Sanders
Cc: Joerg Sonnenberger; llvm-dev
Subject: Re: [llvm-dev] clang triple and clang target

On Mon, Mar 14, 2016 at 8:27 AM, Daniel Sanders <Daniel.Sanders at imgtec.com<mailto: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/20160315/5db08d6b/attachment.html>


More information about the llvm-dev mailing list