4

I'm interested if ARM assembly common for all types of ARM's? For example if I write some function in ARM assembly will it works the same on Cortex, Nvidia Tegra, Qualcomm etc? Can I use the same instruction set or SIMD engines or NEON on different ARM processors (like in x86-64 assembly)?

Oleksandr Karaberov
  • 12,573
  • 10
  • 43
  • 70

2 Answers2

5

You list Cortex, Nvidia Tegra, and Qualcomm in one sentence which is sort of mixing concepts - Cortex is the name of the CPU core family developed by ARM, while Tegra names a system-on-chip using ARM CPU, e.g. Tegra 2/3 chips use Cortex-A9 cores.

What's important for you is the instruction set supported by each of the target chips, which in turn depends on ARM core used. This overview of existing ARM cores can be a good starting point. Also, this diagram from ARM's page gives a great, quick overview.

Another good document to check is ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition (you need to register for a free account to access it).

As of NEON, according to ARM web page, Cortex-A7, Cortex-A8 and Cortex-A15 cores are equipped with NEON by default, while for Cortex-A5 and Cortex-A9 it's optional feature (i.e. chip manufacturer decides about including it). Again, you have to consult the chip's datasheet in this case to check if NEON is supported.

Val
  • 762
  • 8
  • 32
Code Painters
  • 7,175
  • 2
  • 31
  • 47
3

There is only one NEON instruction set (so far). Any ARM processor which supports it is capable of running the same code. Not all ARM CPU's include support for NEON. Android provides a function to test for its presence and WindowsRT requires it. There are several versions of the basic ARM instruction set. All of the recent releases of processors you listed support the latest shipping version (ARMv7A). There are two instruction sets contained at this level:

  1. ARM 32-bit instructions
  2. Thumb2 16-bit instructions

It's up to the operating system if it allows use of either/both. For example, WindowsRT will only allow code to execute in Thumb2 mode.

In other words, the ARM world is less fragmented than Intel's. There has been no NEON version 2, 3, 4, 4.1, etc.

As mentioned in the comments, there is an ARMv8 64-bit instruction set, but it is not yet available in consumer hardware.

BitBank
  • 8,500
  • 3
  • 28
  • 46
  • 1
    ARMv8 uses a brand new A64 instruction set. It can also execute "old" code compiled for ARM-v7A architecture. There are basically two modes of execution - new one, called `AArch64`, and ARM-v7A compatible one called `AArch32`. Unfortunately, I'm not able to answer how the switching is done without digging into ARMs manuals. – Code Painters Oct 30 '12 at 15:20
  • it's interesting to know that Windows RT only allows Thumb2 mode. I don't know why they decide to use a reduced ISA like that as execution speed will be affected – phuclv Sep 03 '13 at 09:06
  • 1
    I agree - I'm currently porting my apps to WinRT and SurfaceRT. The Thumb-2 restriction is causing me to add instructions to make up for its limitations. I guess the shorter instructions pay off in terms of app size. – BitBank Sep 03 '13 at 15:44