[LLVMdev] ARM assembler bug on LLVM 3.5

Mikulas Patocka mikulas at artax.karlin.mff.cuni.cz
Mon Sep 22 18:13:04 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.

I downloaded pre-compiled llvm/clang 3.5 from the llvm.org website. Unlike 
the ubuntu clang, it doesn't attempt to parse the content of the asm 
statement when -no-integrated-as is used, so that trick with asm (".cpu 
cortex-a15 \n sdiv %0, %1, %2"...) works.

Using "-Wa,-mcpu=cortex-a15" doesn't work, clang puts ".cpu cortex-a8" to 
on third line of the assembler file and that reverts cpu=cortex-a15 set at 
the command line.

Setting ".cpu" in the assembler statement is hacky - I'd still like to 
know how to generate the sdiv instruction properly.

Mikulas



More information about the llvm-dev mailing list