[LLVMdev] ARM assembler bug on LLVM 3.5

Mikulas Patocka mikulas at artax.karlin.mff.cuni.cz
Mon Sep 22 17:31:53 PDT 2014



On Mon, 22 Sep 2014, Renato Golin wrote:

> On 22 September 2014 15:48, Mikulas Patocka
> <mikulas at artax.karlin.mff.cuni.cz> wrote:
> > What's the purpose of rejecting "sdiv" and other instructions?
> 
> Warning the user that some of the options are not consistent. Handling
> the .cpu in inline assembly is not always a good thing
> (https://sourceware.org/ml/binutils/2014-08/msg00119.html) and a
> compile-time warning system should be used. It's not because GAS does
> it that it's right.
> 
> 
> > I have tried it and it doesn't work (clang 3.5 in Ubuntu Trusty on ARM).
> > With -no-integrated-as, clang uses the system assembler, but it parses the
> > asm string nonetheless and reports an error on sdiv instruction.
> 
> Ubuntu 3.5 is not the same as LLVM 3.5, unfortunately. I've discussed
> this with Debian packagers and we'll have to fix this there.
> 
> It's not because the (x86) host assembler doesn't "recognize" the (arm) 
> target's instruction that we should just allow any instruction in inline 
> asm. This has been discussed on both LLVM and GCC lists extensively and 
> the LLVM position is that inline assembly validation is a good thing.

Why is it good?

Read the thread that you referenced above (and bug 
http://llvm.org/bugs/show_bug.cgi?id=20447 that is referenced in that 
thread) and you'll see that other people have the same problems as me. 
They can't write NEON-optimized piece of assembler because the assembler 
rejects it.

All these problems would go away if the assembler didn't limit the 
instruction set - then we wouldn't have to use hacks with .cpu and .fpu.

> In this case, you're not being kosher and the
> assembler is complaining, which is good and I don't think we should
> change that.

So, I ask again - how can I use the sdiv instruction on ARM cores that 
support it and yet make the program work on ARM cores that don't have 
sdiv? If you think that the program that I posted at the beginning of this 
thread is wrong - please say how to do it correctly.

> cheers,
> --renato

Mikulas



More information about the llvm-dev mailing list