The right option combination to compile into ARM/Thumb2 code.

Hello,

I'm trying to convince llc to compile into thumb2 ISA on ARMv7. I'm using:

-march=thumb -mattr=v7,thumb2,vfp3

but llc complains about this with:

llc: error: invalid target 'thumb -mattr=v7,thumb2,vfp3'

I'm using LLVM from Aug 29 2011. To me the set of options looks sane so I'd like to ask what's wrong with this.

Thanks!
Karel

Hi Karel,

It actually looks like the argument parser has parsed "thumb -mattr=v7,thumb2,vfp3" as the full argument to "-march=". Strange.

The easiest way to get what you want is probably "-mtriple thumbv7--". v7 has Thumb2 enabled and VFPv3 (along with NEON) by default.

Cheers,

James

Hi James,

Hi Karel,

It actually looks like the argument parser has parsed "thumb -mattr=v7,thumb2,vfp3" as the full argument to "-march=". Strange.

thanks a lot for this remark. It actually solved my issue. It was caused by me telling GHC to pass all those params by using one -optlc parameter but this indeed results in llc receiving whole this string as one parameter. So instead of wrong:

-optlc="-march=thumb -mattr=v7,thumb2,vfp3"

I need to use:

-optlc=-march=thumb -optlc=-mattr=v7,thumb2,vfp3

where -optlc passes its argument to llc command.

Thanks!
Karel