The difference between MOV and LDR in arm instructions

Source: Internet
Author: User
ARM is a RISC structure, the movement of data from memory to CPU can only be done by l/s instruction, that is, ldr/str instruction.
For example, if you want to read data from somewhere in memory to a register, you can only use LDR
Like what:
Ldr R0, 0x12345678
is to store the value of the 0x12345678 address in the r0.
And MOV can not do this job, MOV can only move data between registers, or to move the number of immediate to register, this and x86 this CISC architecture chip difference is the biggest place.
There is no such instruction in x86 because x86 's MOV instruction can move data from memory to registers.

Another is the LDR pseudo-directive, although the LDR pseudo-directive and arm's LDR directive are very similar, but the function is not quite the same. LDR Pseudo-directives can be preceded by an immediate number = to indicate that an address is written to a register, such as:
Ldr R0, =0x12345678
In this way, the 0x12345678 address is written to the r0. Therefore, LDR Pseudo-instructions and MOV are more similar. Only the MOV instruction limits the immediate number of the length to 8 bits, that is, not more than 512. The LDR pseudo-directive does not have this limitation. If the LDR pseudo-directive is used and the immediate number followed is not more than 8 bits, then the LDR pseudo-directive is converted to the MOV instruction at the time of the actual assembly.

LDR Pseudo-directives and LDR directives are not the same thing.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The difference between MOV and LDR in arm instructions

Alibaba Cloud Hot Products

Elastic Compute Service (ECS) Dedicated Host (DDH) ApsaraDB RDS for MySQL (RDS) ApsaraDB for PolarDB(PolarDB) AnalyticDB for PostgreSQL (ADB for PG)
AnalyticDB for MySQL(ADB for MySQL) Data Transmission Service (DTS) Server Load Balancer (SLB) Global Accelerator (GA) Cloud Enterprise Network (CEN)
Object Storage Service (OSS) Content Delivery Network (CDN) Short Message Service (SMS) Container Service for Kubernetes (ACK) Data Lake Analytics (DLA)

ApsaraDB for Redis (Redis)

ApsaraDB for MongoDB (MongoDB) NAT Gateway VPN Gateway Cloud Firewall
Anti-DDoS Web Application Firewall (WAF) Log Service DataWorks MaxCompute
Elastic MapReduce (EMR) Elasticsearch

Alibaba Cloud Free Trail

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.