SoC
  • Home
  • Arm
  • Arm Cortex M0/M0+
  • Arm Cortex M4
  • Arm Cortex M3
  • Contact
Reading: What is the difference between ARM and x64 assembly?
SUBSCRIBE
SoCSoC
Font ResizerAa
  • Home
  • Arm
  • Arm Cortex M0/M0+
  • Arm Cortex M4
Search
  • Home
  • Arm
  • Arm Cortex M0/M0+
  • Arm Cortex M4
Have an existing account? Sign In
Follow US
  • Looking for Something?
  • Privacy Policy
  • About Us
  • Sitemap
  • Contact Us
© S-O-C.ORG, All Rights Reserved.
Arm

What is the difference between ARM and x64 assembly?

Graham Kruk
Last updated: September 8, 2023 9:32 am
Graham Kruk 10 Min Read
Share
SHARE

ARM and x64 refer to two different instruction set architectures (ISAs) used for modern computer processors. The key differences between ARM and x64 assembly language stem from the differing designs and purposes of the ARM and x64 CPU architectures.

Contents
Overview of ARMOverview of x64Key DifferencesRISC vs CISCRegistersAddressing ModesConditional ExecutionCode DensityPower EfficiencySecurity FeaturesSIMD SupportInstruction Set ComparisonArithmetic InstructionsMemory AccessBranchingFunction CallsCalling Conventions and StacksInstruction EncodingPerformance and WorkloadsSoftware EcosystemSummary

Overview of ARM

ARM stands for Advanced RISC Machine. It is a family of reduced instruction set computing (RISC) instruction set architectures designed and licensed by ARM Holdings. The ARM ISA is known for its efficiency, simplicity, and low power consumption, making it dominant in the mobile and embedded device market. Key features of ARM architecture include:

  • RISC design with fixed length 32-bit instruction set
  • Load/store architecture where data is processed in registers and accessed from main memory
  • Condition code flags for conditional execution
  • Thumbs instruction set for improved code density
  • Memory Management Unit (MMU) for virtual memory support
  • Separate instruction and data caches
  • Advanced power management and multiple low power modes

The ARM architecture is open and licensable, allowing many companies to design their own ARM-based processors. ARM CPUs power the majority of smartphones, tablets, smartwatches, digital TVs, and other embedded systems. High performance ARM application processors are also used in laptops and desktops, such as Apple’s M1 chip.

Overview of x64

x64 is a 64-bit extension to the x86 instruction set architecture originally created by Intel for desktop and server processors. x86-64 or x64 for short extended the x86 ISA to 64-bit from its 32-bit roots, providing wider registers, physical address space, and improved performance. Key features of x64 architecture include:

  • CISC design with variable length instruction set
  • Support for 64-bit data and registers
  • 16 general purpose 64-bit registers
  • Additional XMM vector registers for SIMD operations
  • Larger virtual and physical address space
  • Memory Management Unit (MMU) for virtual memory
  • CMOV instructions for fast conditional branches

x64 is the dominant 64-bit architecture for desktops, laptops, workstations, and servers from AMD and Intel. It supports advanced performance features for computationally intensive workloads while retaining 32-bit x86 compatibility for older software.

Key Differences

Some key differences between the ARM and x64 assembly languages stem from the contrasting design goals and use cases of the two architectures:

RISC vs CISC

ARM uses a 32-bit and 64-bit reduced instruction set (RISC) with fixed length instructions, while x64 is a complex instruction set (CISC) evolved from x86 with variable length instructions. RISC aims for simplicity, while CISC aims for high performance.

Registers

ARM has 13 general purpose 32-bit registers, with an additional 16 64-bit registers in AArch64 state. x64 has 16 general purpose 64-bit registers, with additional registers for vector operations. The larger register file helps x64 performance.

Addressing Modes

ARM has fewer memory addressing modes than x64. Loads and stores use base + offset, with option for pre/post indexing the base. x64 has additional direct memory, register indirect, and indexed addressing modes.

Conditional Execution

Most ARM instructions can be conditionally executed based on the status flags. This avoids branching. x64 uses separate conditional move (CMOV) instructions for conditional execution.

Code Density

ARM Thumb instruction set optimizes for high code density, important in embedded devices. x64 has variable length instructions so lacks the code density of Thumb, but implements other size optimizations.

Power Efficiency

ARM cores are designed to be power efficient for use in mobile and battery powered devices. x64 emphasizes performance over power efficiency for desktop and server workloads.

Security Features

ARMv8-A adds security focused features like TrustZone. Intel and AMD have also added more security features to x64 like memory encryption. Both ISAs now support advanced security.

SIMD Support

ARM NEON provides SIMD vector processing for mobile workloads. x64 supplements its scalar architecture with robust SSE and AVX vector instructions ideal for media, scientific, and graphics applications.

Instruction Set Comparison

Here are some examples of common assembly instructions in ARM32, ARM64, and x64 that highlight their differences:

Arithmetic Instructions

ARM32: ADD R0, R1, R2 ; R0 = R1 + R2 ARM64: ADD X0, X1, X2 ; X0 = X1 + X2 x64: ADD RAX, RBX ; RAX = RAX + RBX

All three perform standard addition, but the ARM variants encode the operands as register numbers while x64 uses named registers.

Memory Access

ARM32: LDR R0, [R1, #8] ; R0 = [R1 + 8] ARM64: LDUR X0, [X1,#16] ; X0 = [X1 + 16] x64: MOV RAX, [RBX+16] ; RAX = [RBX + 16]

ARM uses LDR for all memory loads with base + offset addressing. x64 has separate MOV variants for memory vs registers.

Branching

ARM32: BEQ label ; branch if equal ARM64: B.EQ label ; branch if equal x64: JE label ; jump if equal

Branching checks the conditional status flags. ARM encodes condition in the instruction while x64 has separate conditional jump instructions.

Function Calls

ARM32: BL function ; call function ARM64: BL function ; call function x64: CALL function ; call function

Calling conventions differ, but BL and CALL semantics are similar between the architectures.

Calling Conventions and Stacks

The ARM and x64 architectures also differ in their calling conventions and stack usage:

  • ARM 32-bit passes the first few arguments in registers, others on the stack. x64 passes more arguments in registers.
  • x64 requires functions to maintain the stack pointer RSP. ARM stacks are managed by the linker.
  • ARM uses a full descending stack that grows downwards. x64 uses a contiguous stack that grows upwards.
  • Stack pointers point to the current top of stack. ARM uses SP, x64 uses RSP.

These conventions impact how functions call each other and use the stack for local data.

Instruction Encoding

There are also low level differences in how ARM and x64 encode instructions in binary:

  • ARM has fixed length 32-bit instructions. x64 has variable length 1 to 15 byte instructions.
  • ARM opcodes tend to be simpler. x64 has complex opcodes and modifiers.
  • x64 instructions have legacy prefixes and overrides for x86 compatibility.
  • ARM Thumb code is denser with 16-bit compressed opcodes.
  • x64 instructions can specify registers directly. ARM uses indexes.

These encoding choices reflect differing design goals. ARM values simplicity, while x64 values compatibility and performance.

Performance and Workloads

The performance profile and typical workloads of ARM and x64 CPUs also differ:

  • ARM CPUs optimize for low power consumption on battery powered devices.
  • x64 optimizes for maximum computational throughput and performance.
  • ARM excels at mobile, embedded, and low power workloads.
  • x64 dominates performance sensitive desktop, gaming, and server workloads.
  • Comparison depends heavily on specific microarchitecture implementations.

Newer ARM designs like Apple’s M1 chip are becoming more performance competitive with x64 for some workloads. But overall the architectures target differing use cases.

Software Ecosystem

The maturity of their software ecosystems is also different:

  • x64 benefits from extensive native software support given its PC dominance.
  • ARM relies more on ports, emulation, and custom embedded software.
  • Mobile operating systems like iOS and Android run natively on ARM.
  • ARM Windows support is limited compared to ubiquitous x64 Windows.
  • Many cross-platform applications, browsers, and web apps run on both.

ARM’s software support has improved considerably but still lags behind the deep library of x64 compatible applications.

Summary

In summary, ARM and x64 represent two different approaches to CPU architecture design with differing priorities. Key distinctions include:

  • RISC vs CISC – Simplicity vs Complexity
  • Registers and Instruction Sets
  • Conditional Execution
  • Code Density
  • Power Efficiency
  • Workloads and Software Ecosystem

ARM excels in low power and mobile applications, while x64 dominates performance-driven computing. But as ARM continues to advance, the differences between the ISAs continue to blur.

Newsletter Form (#3)

More ARM insights right in your inbox

 


Share This Article
Facebook Twitter Email Copy Link Print
Previous Article Is ARM Assembly Language Hard?
Next Article What instruction set do Cortex-M processors use?
Leave a comment Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

2k Followers Like
3k Followers Follow
10.1k Followers Pin
- Sponsored-
Ad image

You Might Also Like

Is Cortex-M0 32-bit?

The short answer is yes, the Cortex-M0 processor from ARM…

9 Min Read

How much power does ARM CPU use?

ARM CPUs are designed to be power efficient while still…

6 Min Read

ARM Cortex Microcontrollers

ARM Cortex microcontrollers are a series of low-power and high-performance…

6 Min Read

Does GCC work on ARM?

Yes, the GNU Compiler Collection (GCC) does work on ARM…

9 Min Read
SoCSoC
  • Looking for Something?
  • Privacy Policy
  • About Us
  • Sitemap
  • Contact Us
Welcome Back!

Sign in to your account